Skip to content

Commit

Permalink
ipv6: Introduce rt6_nexthop() to select nexthop address.
Browse files Browse the repository at this point in the history
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 <yoshfuji@linux-ipv6.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
YOSHIFUJI Hideaki / 吉藤英明 authored and David S. Miller committed Jan 17, 2013
1 parent 2152cae commit 9bb5a14
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions include/net/ip6_route.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ struct route_info {
#include <net/sock.h>
#include <linux/ip.h>
#include <linux/ipv6.h>
#include <linux/route.h>

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

static inline struct in6_addr *rt6_nexthop(struct rt6_info *rt, struct in6_addr *dest)
{
if (rt->rt6i_flags & RTF_GATEWAY)
return &rt->rt6i_gateway;
return dest;
}

#endif

0 comments on commit 9bb5a14

Please sign in to comment.