Skip to content

Commit 9bb5a14

Browse files
yoshfujidavem330
authored andcommitted
ipv6: Introduce rt6_nexthop() to select nexthop address.
For RTF_GATEWAY route, return rt->rt6i_gateway. Otherwise, return 2nd argument (destination address). This will be used by following patches which remove rt->n dependency patches in ip6_dst_lookup_tail() and ip6_finish_output2(). Signed-off-by: YOSHIFUJI Hideaki <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 2152cae commit 9bb5a14

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

include/net/ip6_route.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ struct route_info {
2323
#include <net/sock.h>
2424
#include <linux/ip.h>
2525
#include <linux/ipv6.h>
26+
#include <linux/route.h>
2627

2728
#define RT6_LOOKUP_F_IFACE 0x00000001
2829
#define RT6_LOOKUP_F_REACHABLE 0x00000002
@@ -194,4 +195,11 @@ static inline int ip6_skb_dst_mtu(struct sk_buff *skb)
194195
skb_dst(skb)->dev->mtu : dst_mtu(skb_dst(skb));
195196
}
196197

198+
static inline struct in6_addr *rt6_nexthop(struct rt6_info *rt, struct in6_addr *dest)
199+
{
200+
if (rt->rt6i_flags & RTF_GATEWAY)
201+
return &rt->rt6i_gateway;
202+
return dest;
203+
}
204+
197205
#endif

0 commit comments

Comments
 (0)