Explorar o código

ipv6: Add rt6_get_peer() helper.

To go along side ipv4's rt_get_peer().

Signed-off-by: David S. Miller <davem@davemloft.net>
David S. Miller %!s(int64=14) %!d(string=hai) anos
pai
achega
15c054251a
Modificáronse 1 ficheiros con 9 adicións e 0 borrados
  1. 9 0
      include/net/ip6_route.h

+ 9 - 0
include/net/ip6_route.h

@@ -59,6 +59,15 @@ static inline unsigned int rt6_flags2srcprefs(int flags)
 extern void			rt6_bind_peer(struct rt6_info *rt,
 extern void			rt6_bind_peer(struct rt6_info *rt,
 					      int create);
 					      int create);
 
 
+static inline struct inet_peer *rt6_get_peer(struct rt6_info *rt)
+{
+	if (rt->rt6i_peer)
+		return rt->rt6i_peer;
+
+	rt6_bind_peer(rt, 0);
+	return rt->rt6i_peer;
+}
+
 extern void			ip6_route_input(struct sk_buff *skb);
 extern void			ip6_route_input(struct sk_buff *skb);
 
 
 extern struct dst_entry *	ip6_route_output(struct net *net,
 extern struct dst_entry *	ip6_route_output(struct net *net,