Skip to contentSkip to conversation

ipv6: Introduce rt6_nexthop() to select nexthop address.

PATCH In review YOSHIFUJI Hideaki 1 participant 1 message Jan 15, 2013

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 5/13 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 for rt->n removal.

---
 include/net/ip6_route.h |    9 +++++++++
 1 file changed, 9 insertions(+)
include/net/ip6_route.h +9 -0
index 27d8318..9af6480 100644
@@ -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
@@ -194,4 +195,12 @@ 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)
+{
+	BUG_ON(rt == NULL);
+	if (rt->rt6i_flags & RTF_GATEWAY)
+		return &rt->rt6i_gateway;
+	return dest;
+}
+
 #endif
Signature · 1 line
1.7.9.5