aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/inetpeer.h
diff options
context:
space:
mode:
authorGao feng <gaofeng@cn.fujitsu.com>2012-06-07 21:20:41 -0400
committerDavid S. Miller <davem@davemloft.net>2012-06-08 17:27:23 -0400
commitc8a627ed06d6d49bf65015a2185c519335c4c83f (patch)
tree2a67acd810661f3655162868bef0306e7ec51b86 /include/net/inetpeer.h
parent1578e7778fa04eb7e32da561effee6cd38139b0f (diff)
inetpeer: add namespace support for inetpeer
now inetpeer doesn't support namespace,the information will be leaking across namespace. this patch move the global vars v4_peers and v6_peers to netns_ipv4 and netns_ipv6 as a field peers. add struct pernet_operations inetpeer_ops to initial pernet inetpeer data. and change family_to_base and inet_getpeer to support namespace. Signed-off-by: Gao feng <gaofeng@cn.fujitsu.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/inetpeer.h')
-rw-r--r--include/net/inetpeer.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/include/net/inetpeer.h b/include/net/inetpeer.h
index 2040bff945d4..fef9dfab5d45 100644
--- a/include/net/inetpeer.h
+++ b/include/net/inetpeer.h
@@ -75,7 +75,9 @@ static inline bool inet_metrics_new(const struct inet_peer *p)
75} 75}
76 76
77/* can be called with or without local BH being disabled */ 77/* can be called with or without local BH being disabled */
78struct inet_peer *inet_getpeer(const struct inetpeer_addr *daddr, int create); 78struct inet_peer *inet_getpeer(struct net *net,
79 const struct inetpeer_addr *daddr,
80 int create);
79 81
80static inline struct inet_peer *inet_getpeer_v4(__be32 v4daddr, int create) 82static inline struct inet_peer *inet_getpeer_v4(__be32 v4daddr, int create)
81{ 83{
@@ -83,7 +85,7 @@ static inline struct inet_peer *inet_getpeer_v4(__be32 v4daddr, int create)
83 85
84 daddr.addr.a4 = v4daddr; 86 daddr.addr.a4 = v4daddr;
85 daddr.family = AF_INET; 87 daddr.family = AF_INET;
86 return inet_getpeer(&daddr, create); 88 return inet_getpeer(&init_net, &daddr, create);
87} 89}
88 90
89static inline struct inet_peer *inet_getpeer_v6(const struct in6_addr *v6daddr, int create) 91static inline struct inet_peer *inet_getpeer_v6(const struct in6_addr *v6daddr, int create)
@@ -92,14 +94,14 @@ static inline struct inet_peer *inet_getpeer_v6(const struct in6_addr *v6daddr,
92 94
93 *(struct in6_addr *)daddr.addr.a6 = *v6daddr; 95 *(struct in6_addr *)daddr.addr.a6 = *v6daddr;
94 daddr.family = AF_INET6; 96 daddr.family = AF_INET6;
95 return inet_getpeer(&daddr, create); 97 return inet_getpeer(&init_net, &daddr, create);
96} 98}
97 99
98/* can be called from BH context or outside */ 100/* can be called from BH context or outside */
99extern void inet_putpeer(struct inet_peer *p); 101extern void inet_putpeer(struct inet_peer *p);
100extern bool inet_peer_xrlim_allow(struct inet_peer *peer, int timeout); 102extern bool inet_peer_xrlim_allow(struct inet_peer *peer, int timeout);
101 103
102extern void inetpeer_invalidate_tree(int family); 104extern void inetpeer_invalidate_tree(struct net *net, int family);
103 105
104/* 106/*
105 * temporary check to make sure we dont access rid, ip_id_count, tcp_ts, 107 * temporary check to make sure we dont access rid, ip_id_count, tcp_ts,