Skip to contentSkip to conversation

kprobes-netpktlog-268-rc3.patch

PATCH In review Prasanna S Panchamukhi 1 participant 1 message Aug 5, 2004

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 3/3 kprobes-netpktlog-268-rc3.patch

Hi,

Below is the [3/3] kprobes-netpktlog-268-rc3.patch

This patch provides network packet tracing using source and destination IP by trapping at various routines in the network stack.It demonstrates how a packet travels through the network stack, as suggested by Andi Kleen.

Usage:
Compile the kernel with options CONFIG_KPROBES, CONFIG_NETPKTLOG,
CONFIG_NETFILTER, CONFIG_IP_NF_IPTABLES and CONFIG_IP_NF_TARGET_LOG enabled. You need to specify the parameters to the netpktlog module.
To filter packets based on source and target ip, insert the module with source and target ip.

	$insmod netpktlog.ko [email protected],9.182.15.188
To filter packets based on only source ip, insert module with source ip.
	$insmod netpktlog.ko [email protected],
To filter packets based on target ip, insert module with target ip.
	$insmod netpktlog.ko netpktlog=@,9.182.15.188

Please see the description of the patch for more details.

Your comments are welcome!

Thanks
prasanna

Signature · 8 lines
Have a Nice Day!

Thanks & Regards
Prasanna S Panchamukhi
Linux Technology Center
India Software Labs, IBM Bangalore
Ph: 91-80-25044636
<[email protected]>

This patch provides network packet tracing using source and destination IP by trapping at various routines in the network stack. It demonstrates how a packet travels through the network stack, as suggested by Andi Kleen.

---

---

drivers/net/Kconfig renamed from drivers/net/Kconfig~kprobes-netpktlog-268-rc3 +13 -0
diff -puN drivers/net/Kconfig~kprobes-netpktlog-268-rc3 drivers/net/Kconfig
@@ -2598,3 +2598,16 @@ config NETCONSOLE
 	If you want to log kernel messages over the network, enable this.
 	See Documentation/networking/netconsole.txt for details.
 
+config NETPKTLOG
+	tristate "Network packet Tracer using kernel probes(EXPERIMENTAL)"
+	depends on KPROBES && IP_NF_TARGET_LOG
+	---help---
+	Network packet tracering is achived using kernel probes allowing you
+	to see the network packets while moving up and down the stack. This
+	module uses kprobes mechanism which is highly efficient for dynamic
+	tracing.
+
+	See driver/net/netpktlog.c for details.
+	To compile this driver as a module, choose M.If unsure, say N.
+	This driver will be always compiled as kernel module.
+
drivers/net/Makefile renamed from drivers/net/Makefile~kprobes-netpktlog-268-rc3 +4 -0
diff -puN drivers/net/Makefile~kprobes-netpktlog-268-rc3 drivers/net/Makefile
@@ -191,3 +191,7 @@ obj-$(CONFIG_HAMRADIO) += hamradio/
 obj-$(CONFIG_IRDA) += irda/
 
 obj-$(CONFIG_NETCONSOLE) += netconsole.o
+ifeq ($(CONFIG_NETPKTLOG),y)
+ obj-m += netpktlog.o
+endif
+
drivers/net/netpktlog.c new file +237 -0

237 lines not on this page · raw message

include/linux/netpktlog.h new file +87 -0

87 lines not on this page · raw message

net/ipv4/ip_forward.c renamed from net/ipv4/ip_forward.c~kprobes-netpktlog-268-rc3 +1 -0
diff -puN net/ipv4/ip_forward.c~kprobes-netpktlog-268-rc3 net/ipv4/ip_forward.c
@@ -125,3 +125,4 @@ drop:
 	kfree_skb(skb);
 	return NET_RX_DROP;
 }
+EXPORT_SYMBOL(ip_forward);
net/ipv4/ip_input.c renamed from net/ipv4/ip_input.c~kprobes-netpktlog-268-rc3 +1 -0
diff -puN net/ipv4/ip_input.c~kprobes-netpktlog-268-rc3 net/ipv4/ip_input.c
@@ -431,3 +431,4 @@ out:
 
 EXPORT_SYMBOL(ip_rcv);
 EXPORT_SYMBOL(ip_statistics);
+EXPORT_SYMBOL(ip_local_deliver);
net/ipv4/ip_output.c renamed from net/ipv4/ip_output.c~kprobes-netpktlog-268-rc3 +1 -0
diff -puN net/ipv4/ip_output.c~kprobes-netpktlog-268-rc3 net/ipv4/ip_output.c
@@ -1326,6 +1326,7 @@ EXPORT_SYMBOL(ip_fragment);
 EXPORT_SYMBOL(ip_generic_getfrag);
 EXPORT_SYMBOL(ip_queue_xmit);
 EXPORT_SYMBOL(ip_send_check);
+EXPORT_SYMBOL(ip_output);
 
 #ifdef CONFIG_SYSCTL
 EXPORT_SYMBOL(sysctl_ip_default_ttl);
net/ipv4/tcp_input.c renamed from net/ipv4/tcp_input.c~kprobes-netpktlog-268-rc3 +2 -1
diff -puN net/ipv4/tcp_input.c~kprobes-netpktlog-268-rc3 net/ipv4/tcp_input.c
@@ -3229,7 +3229,7 @@ static __inline__ void tcp_dsack_extend(
 		tcp_sack_extend(tp->duplicate_sack, seq, end_seq);
 }
 
-static void tcp_send_dupack(struct sock *sk, struct sk_buff *skb)
+void tcp_send_dupack(struct sock *sk, struct sk_buff *skb)
 {
 	struct tcp_opt *tp = tcp_sk(sk);
 
@@ -4864,3 +4864,4 @@ EXPORT_SYMBOL(tcp_cwnd_application_limit
 EXPORT_SYMBOL(tcp_parse_options);
 EXPORT_SYMBOL(tcp_rcv_established);
 EXPORT_SYMBOL(tcp_rcv_state_process);
+EXPORT_SYMBOL(tcp_send_dupack);
net/ipv4/tcp_ipv4.c renamed from net/ipv4/tcp_ipv4.c~kprobes-netpktlog-268-rc3 +1 -0
diff -puN net/ipv4/tcp_ipv4.c~kprobes-netpktlog-268-rc3 net/ipv4/tcp_ipv4.c
@@ -2646,6 +2646,7 @@ EXPORT_SYMBOL(tcp_v4_rebuild_header);
 EXPORT_SYMBOL(tcp_v4_remember_stamp);
 EXPORT_SYMBOL(tcp_v4_send_check);
 EXPORT_SYMBOL(tcp_v4_syn_recv_sock);
+EXPORT_SYMBOL(tcp_v4_rcv);
 
 #ifdef CONFIG_PROC_FS
 EXPORT_SYMBOL(tcp_proc_register);

_