0001
0002 #undef TRACE_SYSTEM
0003 #define TRACE_SYSTEM fib6
0004
0005 #if !defined(_TRACE_FIB6_H) || defined(TRACE_HEADER_MULTI_READ)
0006 #define _TRACE_FIB6_H
0007
0008 #include <linux/in6.h>
0009 #include <net/flow.h>
0010 #include <net/ip6_fib.h>
0011 #include <linux/tracepoint.h>
0012
0013 TRACE_EVENT(fib6_table_lookup,
0014
0015 TP_PROTO(const struct net *net, const struct fib6_result *res,
0016 struct fib6_table *table, const struct flowi6 *flp),
0017
0018 TP_ARGS(net, res, table, flp),
0019
0020 TP_STRUCT__entry(
0021 __field( u32, tb_id )
0022 __field( int, err )
0023 __field( int, oif )
0024 __field( int, iif )
0025 __field( __u8, tos )
0026 __field( __u8, scope )
0027 __field( __u8, flags )
0028 __array( __u8, src, 16 )
0029 __array( __u8, dst, 16 )
0030 __field( u16, sport )
0031 __field( u16, dport )
0032 __field( u8, proto )
0033 __field( u8, rt_type )
0034 __array( char, name, IFNAMSIZ )
0035 __array( __u8, gw, 16 )
0036 ),
0037
0038 TP_fast_assign(
0039 struct in6_addr *in6;
0040
0041 __entry->tb_id = table->tb6_id;
0042 __entry->err = ip6_rt_type_to_error(res->fib6_type);
0043 __entry->oif = flp->flowi6_oif;
0044 __entry->iif = flp->flowi6_iif;
0045 __entry->tos = ip6_tclass(flp->flowlabel);
0046 __entry->scope = flp->flowi6_scope;
0047 __entry->flags = flp->flowi6_flags;
0048
0049 in6 = (struct in6_addr *)__entry->src;
0050 *in6 = flp->saddr;
0051
0052 in6 = (struct in6_addr *)__entry->dst;
0053 *in6 = flp->daddr;
0054
0055 __entry->proto = flp->flowi6_proto;
0056 if (__entry->proto == IPPROTO_TCP ||
0057 __entry->proto == IPPROTO_UDP) {
0058 __entry->sport = ntohs(flp->fl6_sport);
0059 __entry->dport = ntohs(flp->fl6_dport);
0060 } else {
0061 __entry->sport = 0;
0062 __entry->dport = 0;
0063 }
0064
0065 if (res->nh && res->nh->fib_nh_dev) {
0066 strlcpy(__entry->name, res->nh->fib_nh_dev->name, IFNAMSIZ);
0067 } else {
0068 strcpy(__entry->name, "-");
0069 }
0070 if (res->f6i == net->ipv6.fib6_null_entry) {
0071 struct in6_addr in6_zero = {};
0072
0073 in6 = (struct in6_addr *)__entry->gw;
0074 *in6 = in6_zero;
0075
0076 } else if (res->nh) {
0077 in6 = (struct in6_addr *)__entry->gw;
0078 *in6 = res->nh->fib_nh_gw6;
0079 }
0080 ),
0081
0082 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",
0083 __entry->tb_id, __entry->oif, __entry->iif, __entry->proto,
0084 __entry->src, __entry->sport, __entry->dst, __entry->dport,
0085 __entry->tos, __entry->scope, __entry->flags,
0086 __entry->name, __entry->gw, __entry->err)
0087 );
0088
0089 #endif
0090
0091
0092 #include <trace/define_trace.h>