diff options
-rw-r--r-- | include/net/inetpeer.h | 10 | ||||
-rw-r--r-- | net/ipv4/inetpeer.c | 9 | ||||
-rw-r--r-- | net/ipv4/ip_fragment.c | 2 | ||||
-rw-r--r-- | net/ipv4/route.c | 6 | ||||
-rw-r--r-- | net/ipv6/route.c | 2 |
5 files changed, 11 insertions, 18 deletions
diff --git a/include/net/inetpeer.h b/include/net/inetpeer.h index 733edc641b76..b84b32fd5df1 100644 --- a/include/net/inetpeer.h +++ b/include/net/inetpeer.h | |||
@@ -83,11 +83,11 @@ static inline bool inet_metrics_new(const struct inet_peer *p) | |||
83 | } | 83 | } |
84 | 84 | ||
85 | /* can be called with or without local BH being disabled */ | 85 | /* can be called with or without local BH being disabled */ |
86 | struct inet_peer *inet_getpeer(struct net *net, | 86 | struct inet_peer *inet_getpeer(struct inet_peer_base *base, |
87 | const struct inetpeer_addr *daddr, | 87 | const struct inetpeer_addr *daddr, |
88 | int create); | 88 | int create); |
89 | 89 | ||
90 | static inline struct inet_peer *inet_getpeer_v4(struct net *net, | 90 | static inline struct inet_peer *inet_getpeer_v4(struct inet_peer_base *base, |
91 | __be32 v4daddr, | 91 | __be32 v4daddr, |
92 | int create) | 92 | int create) |
93 | { | 93 | { |
@@ -95,10 +95,10 @@ static inline struct inet_peer *inet_getpeer_v4(struct net *net, | |||
95 | 95 | ||
96 | daddr.addr.a4 = v4daddr; | 96 | daddr.addr.a4 = v4daddr; |
97 | daddr.family = AF_INET; | 97 | daddr.family = AF_INET; |
98 | return inet_getpeer(net, &daddr, create); | 98 | return inet_getpeer(base, &daddr, create); |
99 | } | 99 | } |
100 | 100 | ||
101 | static inline struct inet_peer *inet_getpeer_v6(struct net *net, | 101 | static inline struct inet_peer *inet_getpeer_v6(struct inet_peer_base *base, |
102 | const struct in6_addr *v6daddr, | 102 | const struct in6_addr *v6daddr, |
103 | int create) | 103 | int create) |
104 | { | 104 | { |
@@ -106,7 +106,7 @@ static inline struct inet_peer *inet_getpeer_v6(struct net *net, | |||
106 | 106 | ||
107 | *(struct in6_addr *)daddr.addr.a6 = *v6daddr; | 107 | *(struct in6_addr *)daddr.addr.a6 = *v6daddr; |
108 | daddr.family = AF_INET6; | 108 | daddr.family = AF_INET6; |
109 | return inet_getpeer(net, &daddr, create); | 109 | return inet_getpeer(base, &daddr, create); |
110 | } | 110 | } |
111 | 111 | ||
112 | /* can be called from BH context or outside */ | 112 | /* can be called from BH context or outside */ |
diff --git a/net/ipv4/inetpeer.c b/net/ipv4/inetpeer.c index 9d89a381f0e1..e4cba56a5349 100644 --- a/net/ipv4/inetpeer.c +++ b/net/ipv4/inetpeer.c | |||
@@ -391,12 +391,6 @@ static void unlink_from_pool(struct inet_peer *p, struct inet_peer_base *base, | |||
391 | call_rcu(&p->rcu, inetpeer_free_rcu); | 391 | call_rcu(&p->rcu, inetpeer_free_rcu); |
392 | } | 392 | } |
393 | 393 | ||
394 | static struct inet_peer_base *family_to_base(struct net *net, | ||
395 | int family) | ||
396 | { | ||
397 | return family == AF_INET ? net->ipv4.peers : net->ipv6.peers; | ||
398 | } | ||
399 | |||
400 | /* perform garbage collect on all items stacked during a lookup */ | 394 | /* perform garbage collect on all items stacked during a lookup */ |
401 | static int inet_peer_gc(struct inet_peer_base *base, | 395 | static int inet_peer_gc(struct inet_peer_base *base, |
402 | struct inet_peer __rcu **stack[PEER_MAXDEPTH], | 396 | struct inet_peer __rcu **stack[PEER_MAXDEPTH], |
@@ -434,12 +428,11 @@ static int inet_peer_gc(struct inet_peer_base *base, | |||
434 | return cnt; | 428 | return cnt; |
435 | } | 429 | } |
436 | 430 | ||
437 | struct inet_peer *inet_getpeer(struct net *net, | 431 | struct inet_peer *inet_getpeer(struct inet_peer_base *base, |
438 | const struct inetpeer_addr *daddr, | 432 | const struct inetpeer_addr *daddr, |
439 | int create) | 433 | int create) |
440 | { | 434 | { |
441 | struct inet_peer __rcu **stack[PEER_MAXDEPTH], ***stackptr; | 435 | struct inet_peer __rcu **stack[PEER_MAXDEPTH], ***stackptr; |
442 | struct inet_peer_base *base = family_to_base(net, daddr->family); | ||
443 | struct inet_peer *p; | 436 | struct inet_peer *p; |
444 | unsigned int sequence; | 437 | unsigned int sequence; |
445 | int invalidated, gccnt = 0; | 438 | int invalidated, gccnt = 0; |
diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c index 22c6bab9717a..8d07c973409c 100644 --- a/net/ipv4/ip_fragment.c +++ b/net/ipv4/ip_fragment.c | |||
@@ -184,7 +184,7 @@ static void ip4_frag_init(struct inet_frag_queue *q, void *a) | |||
184 | qp->daddr = arg->iph->daddr; | 184 | qp->daddr = arg->iph->daddr; |
185 | qp->user = arg->user; | 185 | qp->user = arg->user; |
186 | qp->peer = sysctl_ipfrag_max_dist ? | 186 | qp->peer = sysctl_ipfrag_max_dist ? |
187 | inet_getpeer_v4(net, arg->iph->saddr, 1) : NULL; | 187 | inet_getpeer_v4(net->ipv4.peers, arg->iph->saddr, 1) : NULL; |
188 | } | 188 | } |
189 | 189 | ||
190 | static __inline__ void ip4_frag_free(struct inet_frag_queue *q) | 190 | static __inline__ void ip4_frag_free(struct inet_frag_queue *q) |
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index cf78343940de..2aa663a6ae9e 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
@@ -1328,7 +1328,7 @@ void rt_bind_peer(struct rtable *rt, __be32 daddr, int create) | |||
1328 | struct net *net = dev_net(rt->dst.dev); | 1328 | struct net *net = dev_net(rt->dst.dev); |
1329 | struct inet_peer *peer; | 1329 | struct inet_peer *peer; |
1330 | 1330 | ||
1331 | peer = inet_getpeer_v4(net, daddr, create); | 1331 | peer = inet_getpeer_v4(net->ipv4.peers, daddr, create); |
1332 | 1332 | ||
1333 | if (peer && cmpxchg(&rt->peer, NULL, peer) != NULL) | 1333 | if (peer && cmpxchg(&rt->peer, NULL, peer) != NULL) |
1334 | inet_putpeer(peer); | 1334 | inet_putpeer(peer); |
@@ -1684,7 +1684,7 @@ unsigned short ip_rt_frag_needed(struct net *net, const struct iphdr *iph, | |||
1684 | unsigned short est_mtu = 0; | 1684 | unsigned short est_mtu = 0; |
1685 | struct inet_peer *peer; | 1685 | struct inet_peer *peer; |
1686 | 1686 | ||
1687 | peer = inet_getpeer_v4(net, iph->daddr, 1); | 1687 | peer = inet_getpeer_v4(net->ipv4.peers, iph->daddr, 1); |
1688 | if (peer) { | 1688 | if (peer) { |
1689 | unsigned short mtu = new_mtu; | 1689 | unsigned short mtu = new_mtu; |
1690 | 1690 | ||
@@ -1929,7 +1929,7 @@ static void rt_init_metrics(struct rtable *rt, const struct flowi4 *fl4, | |||
1929 | if (fl4 && (fl4->flowi4_flags & FLOWI_FLAG_PRECOW_METRICS)) | 1929 | if (fl4 && (fl4->flowi4_flags & FLOWI_FLAG_PRECOW_METRICS)) |
1930 | create = 1; | 1930 | create = 1; |
1931 | 1931 | ||
1932 | rt->peer = peer = inet_getpeer_v4(net, rt->rt_dst, create); | 1932 | rt->peer = peer = inet_getpeer_v4(net->ipv4.peers, rt->rt_dst, create); |
1933 | if (peer) { | 1933 | if (peer) { |
1934 | rt->rt_peer_genid = rt_peer_genid(); | 1934 | rt->rt_peer_genid = rt_peer_genid(); |
1935 | if (inet_metrics_new(peer)) | 1935 | if (inet_metrics_new(peer)) |
diff --git a/net/ipv6/route.c b/net/ipv6/route.c index 9586c27e069c..8fc41d502bbd 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c | |||
@@ -306,7 +306,7 @@ void rt6_bind_peer(struct rt6_info *rt, int create) | |||
306 | struct net *net = dev_net(rt->dst.dev); | 306 | struct net *net = dev_net(rt->dst.dev); |
307 | struct inet_peer *peer; | 307 | struct inet_peer *peer; |
308 | 308 | ||
309 | peer = inet_getpeer_v6(net, &rt->rt6i_dst.addr, create); | 309 | peer = inet_getpeer_v6(net->ipv6.peers, &rt->rt6i_dst.addr, create); |
310 | if (peer && cmpxchg(&rt->rt6i_peer, NULL, peer) != NULL) | 310 | if (peer && cmpxchg(&rt->rt6i_peer, NULL, peer) != NULL) |
311 | inet_putpeer(peer); | 311 | inet_putpeer(peer); |
312 | else | 312 | else |