lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu,  5 Aug 2021 11:57:45 -0700
From:   Cong Wang <xiyou.wangcong@...il.com>
To:     netdev@...r.kernel.org
Cc:     Qitao Xu <qitao.xu@...edance.com>,
        Cong Wang <cong.wang@...edance.com>
Subject: [Patch net-next 08/13] ipv4: introduce tracepoint trace_ip_local_deliver_finish()

From: Qitao Xu <qitao.xu@...edance.com>

Tracepoint trace_ip_local_deliver_finish() is introduced to trace
skb at the exit of IP layer on RX side.

Reviewed-by: Cong Wang <cong.wang@...edance.com>
Signed-off-by: Qitao Xu <qitao.xu@...edance.com>
---
 include/trace/events/ip.h | 17 +++++++++++++++++
 net/ipv4/ip_input.c       |  7 ++++++-
 2 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/include/trace/events/ip.h b/include/trace/events/ip.h
index 6cd0907728ce..9653bc3c7fa0 100644
--- a/include/trace/events/ip.h
+++ b/include/trace/events/ip.h
@@ -117,6 +117,23 @@ TRACE_EVENT(ipv6_rcv,
 );
 #endif
 
+TRACE_EVENT(ip_local_deliver_finish,
+
+	TP_PROTO(const struct sk_buff *skb),
+
+	TP_ARGS(skb),
+
+	TP_STRUCT__entry(
+		__field(const void *, skbaddr)
+	),
+
+	TP_fast_assign(
+		__entry->skbaddr = skb;
+	),
+
+	TP_printk("skbaddr=%px", __entry->skbaddr)
+);
+
 #endif /* _TRACE_IP_H */
 
 /* This part must be outside protection */
diff --git a/net/ipv4/ip_input.c b/net/ipv4/ip_input.c
index 2eb7a0cbc0d3..31c5c6903fff 100644
--- a/net/ipv4/ip_input.c
+++ b/net/ipv4/ip_input.c
@@ -244,15 +244,20 @@ int ip_local_deliver(struct sk_buff *skb)
 	 *	Reassemble IP fragments.
 	 */
 	struct net *net = dev_net(skb->dev);
+	int ret;
 
 	if (ip_is_fragment(ip_hdr(skb))) {
 		if (ip_defrag(net, skb, IP_DEFRAG_LOCAL_DELIVER))
 			return 0;
 	}
 
-	return NF_HOOK(NFPROTO_IPV4, NF_INET_LOCAL_IN,
+	ret = NF_HOOK(NFPROTO_IPV4, NF_INET_LOCAL_IN,
 		       net, NULL, skb, skb->dev, NULL,
 		       ip_local_deliver_finish);
+	if (!ret)
+		trace_ip_local_deliver_finish(skb);
+	return ret;
+
 }
 EXPORT_SYMBOL(ip_local_deliver);
 
-- 
2.27.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ