2017-10-13 23:03:16 +03:00
|
|
|
#undef TRACE_SYSTEM
|
|
|
|
#define TRACE_SYSTEM tcp
|
|
|
|
|
|
|
|
#if !defined(_TRACE_TCP_H) || defined(TRACE_HEADER_MULTI_READ)
|
|
|
|
#define _TRACE_TCP_H
|
|
|
|
|
|
|
|
#include <linux/ipv6.h>
|
|
|
|
#include <linux/tcp.h>
|
|
|
|
#include <linux/tracepoint.h>
|
|
|
|
#include <net/ipv6.h>
|
|
|
|
|
2017-10-23 19:20:22 +03:00
|
|
|
/*
|
|
|
|
* tcp event with arguments sk and skb
|
|
|
|
*
|
|
|
|
* Note: this class requires a valid sk pointer; while skb pointer could
|
|
|
|
* be NULL.
|
|
|
|
*/
|
|
|
|
DECLARE_EVENT_CLASS(tcp_event_sk_skb,
|
2017-10-13 23:03:16 +03:00
|
|
|
|
2017-10-23 19:20:23 +03:00
|
|
|
TP_PROTO(const struct sock *sk, const struct sk_buff *skb),
|
2017-10-13 23:03:16 +03:00
|
|
|
|
|
|
|
TP_ARGS(sk, skb),
|
|
|
|
|
|
|
|
TP_STRUCT__entry(
|
2017-10-23 19:20:23 +03:00
|
|
|
__field(const void *, skbaddr)
|
|
|
|
__field(const void *, skaddr)
|
2017-10-13 23:03:16 +03:00
|
|
|
__field(__u16, sport)
|
|
|
|
__field(__u16, dport)
|
|
|
|
__array(__u8, saddr, 4)
|
|
|
|
__array(__u8, daddr, 4)
|
|
|
|
__array(__u8, saddr_v6, 16)
|
|
|
|
__array(__u8, daddr_v6, 16)
|
|
|
|
),
|
|
|
|
|
|
|
|
TP_fast_assign(
|
|
|
|
struct inet_sock *inet = inet_sk(sk);
|
|
|
|
struct in6_addr *pin6;
|
|
|
|
__be32 *p32;
|
|
|
|
|
|
|
|
__entry->skbaddr = skb;
|
|
|
|
__entry->skaddr = sk;
|
|
|
|
|
|
|
|
__entry->sport = ntohs(inet->inet_sport);
|
|
|
|
__entry->dport = ntohs(inet->inet_dport);
|
|
|
|
|
|
|
|
p32 = (__be32 *) __entry->saddr;
|
|
|
|
*p32 = inet->inet_saddr;
|
|
|
|
|
|
|
|
p32 = (__be32 *) __entry->daddr;
|
|
|
|
*p32 = inet->inet_daddr;
|
|
|
|
|
2017-10-18 18:17:29 +03:00
|
|
|
#if IS_ENABLED(CONFIG_IPV6)
|
|
|
|
if (sk->sk_family == AF_INET6) {
|
2017-10-13 23:03:16 +03:00
|
|
|
pin6 = (struct in6_addr *)__entry->saddr_v6;
|
2017-10-17 01:32:07 +03:00
|
|
|
*pin6 = sk->sk_v6_rcv_saddr;
|
2017-10-13 23:03:16 +03:00
|
|
|
pin6 = (struct in6_addr *)__entry->daddr_v6;
|
2017-10-17 01:32:07 +03:00
|
|
|
*pin6 = sk->sk_v6_daddr;
|
2017-10-18 18:17:29 +03:00
|
|
|
} else
|
|
|
|
#endif
|
|
|
|
{
|
2017-10-13 23:03:16 +03:00
|
|
|
pin6 = (struct in6_addr *)__entry->saddr_v6;
|
|
|
|
ipv6_addr_set_v4mapped(inet->inet_saddr, pin6);
|
|
|
|
pin6 = (struct in6_addr *)__entry->daddr_v6;
|
|
|
|
ipv6_addr_set_v4mapped(inet->inet_daddr, pin6);
|
|
|
|
}
|
|
|
|
),
|
|
|
|
|
2017-10-17 00:24:02 +03:00
|
|
|
TP_printk("sport=%hu dport=%hu saddr=%pI4 daddr=%pI4 saddrv6=%pI6c daddrv6=%pI6c",
|
2017-10-13 23:03:16 +03:00
|
|
|
__entry->sport, __entry->dport, __entry->saddr, __entry->daddr,
|
|
|
|
__entry->saddr_v6, __entry->daddr_v6)
|
|
|
|
);
|
|
|
|
|
2017-10-23 19:20:22 +03:00
|
|
|
DEFINE_EVENT(tcp_event_sk_skb, tcp_retransmit_skb,
|
|
|
|
|
2017-10-23 19:20:23 +03:00
|
|
|
TP_PROTO(const struct sock *sk, const struct sk_buff *skb),
|
2017-10-23 19:20:22 +03:00
|
|
|
|
|
|
|
TP_ARGS(sk, skb)
|
|
|
|
);
|
|
|
|
|
2017-10-13 23:03:16 +03:00
|
|
|
#endif /* _TRACE_TCP_H */
|
|
|
|
|
|
|
|
/* This part must be outside protection */
|
|
|
|
#include <trace/define_trace.h>
|