1 /* SPDX-License-Identifier: GPL-2.0 */
3 #define TRACE_SYSTEM fib6
5 #if !defined(_TRACE_FIB6_H) || defined(TRACE_HEADER_MULTI_READ)
10 #include <net/ip6_fib.h>
11 #include <linux/tracepoint.h>
13 TRACE_EVENT(fib6_table_lookup
,
15 TP_PROTO(const struct net
*net
, const struct fib6_result
*res
,
16 struct fib6_table
*table
, const struct flowi6
*flp
),
18 TP_ARGS(net
, res
, table
, flp
),
26 __field( __u8
, scope
)
27 __field( __u8
, flags
)
28 __array( __u8
, src
, 16 )
29 __array( __u8
, dst
, 16 )
33 __field( u8
, rt_type
)
34 __dynamic_array( char, name
, IFNAMSIZ
)
35 __array( __u8
, gw
, 16 )
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
;
49 in6
= (struct in6_addr
*)__entry
->src
;
52 in6
= (struct in6_addr
*)__entry
->dst
;
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
);
65 if (res
->nh
&& res
->nh
->fib_nh_dev
) {
66 __assign_str(name
, res
->nh
->fib_nh_dev
);
68 __assign_str(name
, "-");
70 if (res
->f6i
== net
->ipv6
.fib6_null_entry
) {
71 struct in6_addr in6_zero
= {};
73 in6
= (struct in6_addr
*)__entry
->gw
;
77 in6
= (struct in6_addr
*)__entry
->gw
;
78 *in6
= res
->nh
->fib_nh_gw6
;
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 __get_str(name
), __entry
->gw
, __entry
->err
)
89 #endif /* _TRACE_FIB6_H */
91 /* This part must be outside protection */
92 #include <trace/define_trace.h>