Linux Audio

Check our new training course

Loading...
v6.2
 1/* SPDX-License-Identifier: GPL-2.0 */
 2#undef TRACE_SYSTEM
 3#define TRACE_SYSTEM fib6
 4
 5#if !defined(_TRACE_FIB6_H) || defined(TRACE_HEADER_MULTI_READ)
 6#define _TRACE_FIB6_H
 7
 8#include <linux/in6.h>
 9#include <net/flow.h>
10#include <net/ip6_fib.h>
11#include <linux/tracepoint.h>
12
13TRACE_EVENT(fib6_table_lookup,
14
15	TP_PROTO(const struct net *net, const struct fib6_result *res,
16		 struct fib6_table *table, const struct flowi6 *flp),
17
18	TP_ARGS(net, res, table, flp),
19
20	TP_STRUCT__entry(
21		__field(	u32,	tb_id		)
22		__field(	int,	err		)
23		__field(	int,	oif		)
24		__field(	int,	iif		)
25		__field(	__u8,	tos		)
26		__field(	__u8,	scope		)
27		__field(	__u8,	flags		)
28		__array(	__u8,	src,	16	)
29		__array(	__u8,	dst,	16	)
30		__field(        u16,	sport		)
31		__field(        u16,	dport		)
32		__field(        u8,	proto		)
33		__field(        u8,	rt_type		)
34		__array(		char,	name,	IFNAMSIZ )
35		__array(		__u8,	gw,	16	 )
36	),
37
38	TP_fast_assign(
39		struct in6_addr *in6;
40
41		__entry->tb_id = table->tb6_id;
42		__entry->err = ip6_rt_type_to_error(res->fib6_type);
43		__entry->oif = flp->flowi6_oif;
44		__entry->iif = flp->flowi6_iif;
45		__entry->tos = ip6_tclass(flp->flowlabel);
46		__entry->scope = flp->flowi6_scope;
47		__entry->flags = flp->flowi6_flags;
48
49		in6 = (struct in6_addr *)__entry->src;
50		*in6 = flp->saddr;
51
52		in6 = (struct in6_addr *)__entry->dst;
53		*in6 = flp->daddr;
54
55		__entry->proto = flp->flowi6_proto;
56		if (__entry->proto == IPPROTO_TCP ||
57		    __entry->proto == IPPROTO_UDP) {
58			__entry->sport = ntohs(flp->fl6_sport);
59			__entry->dport = ntohs(flp->fl6_dport);
60		} else {
61			__entry->sport = 0;
62			__entry->dport = 0;
63		}
64
65		if (res->nh && res->nh->fib_nh_dev) {
66			strlcpy(__entry->name, res->nh->fib_nh_dev->name, IFNAMSIZ);
67		} else {
68			strcpy(__entry->name, "-");
69		}
70		if (res->f6i == net->ipv6.fib6_null_entry) {
71			struct in6_addr in6_zero = {};
72
73			in6 = (struct in6_addr *)__entry->gw;
74			*in6 = in6_zero;
75
76		} else if (res->nh) {
77			in6 = (struct in6_addr *)__entry->gw;
78			*in6 = res->nh->fib_nh_gw6;
79		}
80	),
81
82	TP_printk("table %3u oif %d iif %d proto %u %pI6c/%u -> %pI6c/%u tos %d scope %d flags %x ==> dev %s gw %pI6c err %d",
83		  __entry->tb_id, __entry->oif, __entry->iif, __entry->proto,
84		  __entry->src, __entry->sport, __entry->dst, __entry->dport,
85		  __entry->tos, __entry->scope, __entry->flags,
86		  __entry->name, __entry->gw, __entry->err)
87);
88
89#endif /* _TRACE_FIB6_H */
90
91/* This part must be outside protection */
92#include <trace/define_trace.h>
v4.10.11
 
 1#undef TRACE_SYSTEM
 2#define TRACE_SYSTEM fib6
 3
 4#if !defined(_TRACE_FIB6_H) || defined(TRACE_HEADER_MULTI_READ)
 5#define _TRACE_FIB6_H
 6
 7#include <linux/in6.h>
 8#include <net/flow.h>
 9#include <net/ip6_fib.h>
10#include <linux/tracepoint.h>
11
12TRACE_EVENT(fib6_table_lookup,
13
14	TP_PROTO(const struct net *net, const struct rt6_info *rt,
15		 u32 tb_id, const struct flowi6 *flp),
16
17	TP_ARGS(net, rt, tb_id, flp),
18
19	TP_STRUCT__entry(
20		__field(	u32,	tb_id		)
21
22		__field(	int,	oif		)
23		__field(	int,	iif		)
24		__field(	__u8,	tos		)
25		__field(	__u8,	scope		)
26		__field(	__u8,	flags		)
27		__array(	__u8,	src,	16	)
28		__array(	__u8,	dst,	16	)
29
30		__dynamic_array(	char,	name,	IFNAMSIZ )
 
 
 
31		__array(		__u8,	gw,	16	 )
32	),
33
34	TP_fast_assign(
35		struct in6_addr *in6;
36
37		__entry->tb_id = tb_id;
 
38		__entry->oif = flp->flowi6_oif;
39		__entry->iif = flp->flowi6_iif;
40		__entry->tos = ip6_tclass(flp->flowlabel);
41		__entry->scope = flp->flowi6_scope;
42		__entry->flags = flp->flowi6_flags;
43
44		in6 = (struct in6_addr *)__entry->src;
45		*in6 = flp->saddr;
46
47		in6 = (struct in6_addr *)__entry->dst;
48		*in6 = flp->daddr;
49
50		if (rt->rt6i_idev) {
51			__assign_str(name, rt->rt6i_idev->dev->name);
 
 
 
 
 
 
 
 
 
 
52		} else {
53			__assign_str(name, "");
54		}
55		if (rt == net->ipv6.ip6_null_entry) {
56			struct in6_addr in6_zero = {};
57
58			in6 = (struct in6_addr *)__entry->gw;
59			*in6 = in6_zero;
60
61		} else if (rt) {
62			in6 = (struct in6_addr *)__entry->gw;
63			*in6 = rt->rt6i_gateway;
64		}
65	),
66
67	TP_printk("table %3u oif %d iif %d src %pI6c dst %pI6c tos %d scope %d flags %x ==> dev %s gw %pI6c",
68		  __entry->tb_id, __entry->oif, __entry->iif,
69		  __entry->src, __entry->dst, __entry->tos, __entry->scope,
70		  __entry->flags, __get_str(name), __entry->gw)
 
71);
72
73#endif /* _TRACE_FIB6_H */
74
75/* This part must be outside protection */
76#include <trace/define_trace.h>