1 #ifndef __NET_ROUTE_H_WRAPPER
2 #define __NET_ROUTE_H_WRAPPER
4 #include_next <net/route.h>
6 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39)
39 struct flowi_common __fl_common;
40 #define flowi4_oif __fl_common.flowic_oif
41 #define flowi4_iif __fl_common.flowic_iif
42 #define flowi4_mark __fl_common.flowic_mark
43 #define flowi4_tos __fl_common.flowic_tos
44 #define flowi4_scope __fl_common.flowic_scope
45 #define flowi4_proto __fl_common.flowic_proto
46 #define flowi4_flags __fl_common.flowic_flags
47 #define flowi4_secid __fl_common.flowic_secid
48 #define flowi4_tun_key __fl_common.flowic_tun_key
51 #define fl4_gre_key uli.gre_key
53 /* (saddr,daddr) must be grouped, same order as in IP header */
57 } __attribute__((__aligned__(BITS_PER_LONG/8)));
60 struct flowi_common __fl_common;
61 #define flowi6_oif __fl_common.flowic_oif
62 #define flowi6_iif __fl_common.flowic_iif
63 #define flowi6_mark __fl_common.flowic_mark
64 #define flowi6_tos __fl_common.flowic_tos
65 #define flowi6_scope __fl_common.flowic_scope
66 #define flowi6_proto __fl_common.flowic_proto
67 #define flowi6_flags __fl_common.flowic_flags
68 #define flowi6_secid __fl_common.flowic_secid
69 #define flowi6_tun_key __fl_common.flowic_tun_key
70 struct in6_addr daddr;
71 struct in6_addr saddr;
74 #define fl6_sport uli.ports.sport
75 #define fl6_dport uli.ports.dport
76 #define fl6_icmp_type uli.icmpt.type
77 #define fl6_icmp_code uli.icmpt.code
78 #define fl6_ipsec_spi uli.spi
79 #define fl6_mh_type uli.mht.type
80 #define fl6_gre_key uli.gre_key
81 } __attribute__((__aligned__(BITS_PER_LONG/8)));
83 static inline struct rtable *rpl_ip_route_output_key(struct net *net, struct flowi4 *flp)
86 /* Tunnel configuration keeps DSCP part of TOS bits, But Linux
87 * router expect RT_TOS bits only.
90 struct flowi fl = { .nl_u = { .ip4_u = {
93 .tos = RT_TOS(flp->flowi4_tos) } },
94 .mark = flp->flowi4_mark,
95 .proto = flp->flowi4_proto };
97 if (unlikely(ip_route_output_key(net, &rt, &fl)))
98 return ERR_PTR(-EADDRNOTAVAIL);
99 flp->saddr = fl.nl_u.ip4_u.saddr;
102 #define ip_route_output_key rpl_ip_route_output_key
104 static inline int ip4_dst_hoplimit(const struct dst_entry *dst)
106 return dst_metric(dst, RTAX_HOPLIMIT);