1 /* SPDX-License-Identifier: GPL-2.0 */
3 #define TRACE_SYSTEM icmp
5 #if !defined(_TRACE_ICMP_H) || defined(TRACE_HEADER_MULTI_READ)
8 #include <linux/icmp.h>
9 #include <linux/tracepoint.h>
11 TRACE_EVENT(icmp_send
,
13 TP_PROTO(const struct sk_buff
*skb
, int type
, int code
),
15 TP_ARGS(skb
, type
, code
),
18 __field(const void *, skbaddr
)
21 __array(__u8
, saddr
, 4)
22 __array(__u8
, daddr
, 4)
25 __field(unsigned short, ulen
)
29 struct iphdr
*iph
= ip_hdr(skb
);
30 struct udphdr
*uh
= udp_hdr(skb
);
31 int proto_4
= iph
->protocol
;
34 __entry
->skbaddr
= skb
;
38 if (proto_4
!= IPPROTO_UDP
|| (u8
*)uh
< skb
->head
||
39 (u8
*)uh
+ sizeof(struct udphdr
)
40 > skb_tail_pointer(skb
)) {
45 __entry
->sport
= ntohs(uh
->source
);
46 __entry
->dport
= ntohs(uh
->dest
);
47 __entry
->ulen
= ntohs(uh
->len
);
50 p32
= (__be32
*) __entry
->saddr
;
53 p32
= (__be32
*) __entry
->daddr
;
57 TP_printk("icmp_send: type=%d, code=%d. From %pI4:%u to %pI4:%u ulen=%d skbaddr=%p",
58 __entry
->type
, __entry
->code
,
59 __entry
->saddr
, __entry
->sport
, __entry
->daddr
,
60 __entry
->dport
, __entry
->ulen
, __entry
->skbaddr
)
63 #endif /* _TRACE_ICMP_H */
65 /* This part must be outside protection */
66 #include <trace/define_trace.h>