|
@@ -104,6 +104,36 @@ static struct rt6_info *rt6_get_route_info(struct net *net,
|
|
|
const struct in6_addr *gwaddr, int ifindex);
|
|
|
#endif
|
|
|
|
|
|
+static void rt6_bind_peer(struct rt6_info *rt, int create)
|
|
|
+{
|
|
|
+ struct inet_peer_base *base;
|
|
|
+ struct inet_peer *peer;
|
|
|
+
|
|
|
+ base = inetpeer_base_ptr(rt->_rt6i_peer);
|
|
|
+ if (!base)
|
|
|
+ return;
|
|
|
+
|
|
|
+ peer = inet_getpeer_v6(base, &rt->rt6i_dst.addr, create);
|
|
|
+ if (peer) {
|
|
|
+ if (!rt6_set_peer(rt, peer))
|
|
|
+ inet_putpeer(peer);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+static struct inet_peer *__rt6_get_peer(struct rt6_info *rt, int create)
|
|
|
+{
|
|
|
+ if (rt6_has_peer(rt))
|
|
|
+ return rt6_peer_ptr(rt);
|
|
|
+
|
|
|
+ rt6_bind_peer(rt, create);
|
|
|
+ return (rt6_has_peer(rt) ? rt6_peer_ptr(rt) : NULL);
|
|
|
+}
|
|
|
+
|
|
|
+static struct inet_peer *rt6_get_peer_create(struct rt6_info *rt)
|
|
|
+{
|
|
|
+ return __rt6_get_peer(rt, 1);
|
|
|
+}
|
|
|
+
|
|
|
static u32 *ipv6_cow_metrics(struct dst_entry *dst, unsigned long old)
|
|
|
{
|
|
|
struct rt6_info *rt = (struct rt6_info *) dst;
|
|
@@ -312,22 +342,6 @@ static void ip6_dst_destroy(struct dst_entry *dst)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-void rt6_bind_peer(struct rt6_info *rt, int create)
|
|
|
-{
|
|
|
- struct inet_peer_base *base;
|
|
|
- struct inet_peer *peer;
|
|
|
-
|
|
|
- base = inetpeer_base_ptr(rt->_rt6i_peer);
|
|
|
- if (!base)
|
|
|
- return;
|
|
|
-
|
|
|
- peer = inet_getpeer_v6(base, &rt->rt6i_dst.addr, create);
|
|
|
- if (peer) {
|
|
|
- if (!rt6_set_peer(rt, peer))
|
|
|
- inet_putpeer(peer);
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
static void ip6_dst_ifdown(struct dst_entry *dst, struct net_device *dev,
|
|
|
int how)
|
|
|
{
|