diff options
author | David S. Miller <davem@davemloft.net> | 2013-02-05 14:42:23 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-02-05 14:42:23 -0500 |
commit | 547472b8e1da72ae226430c0c4273e36fc8ca768 (patch) | |
tree | 2300023f8d0fa943725e1b4ea3b2b95c91de4430 /net/ipv4/af_inet.c | |
parent | 9d6ddb19905223828485d8c40deaec76e4dea3a5 (diff) |
ipv4: Disallow non-namespace aware protocols to register.
All in-tree ipv4 protocol implementations are now namespace
aware. Therefore all the run-time checks are superfluous.
Reject registry of any non-namespace aware ipv4 protocol.
Eventually we'll remove prot->netns_ok and this registry
time check as well.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/af_inet.c')
-rw-r--r-- | net/ipv4/af_inet.c | 19 |
1 files changed, 0 insertions, 19 deletions
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c index 49ddca31c4da..1aec92bf8018 100644 --- a/net/ipv4/af_inet.c +++ b/net/ipv4/af_inet.c | |||
@@ -263,21 +263,6 @@ void build_ehash_secret(void) | |||
263 | } | 263 | } |
264 | EXPORT_SYMBOL(build_ehash_secret); | 264 | EXPORT_SYMBOL(build_ehash_secret); |
265 | 265 | ||
266 | static inline int inet_netns_ok(struct net *net, __u8 protocol) | ||
267 | { | ||
268 | const struct net_protocol *ipprot; | ||
269 | |||
270 | if (net_eq(net, &init_net)) | ||
271 | return 1; | ||
272 | |||
273 | ipprot = rcu_dereference(inet_protos[protocol]); | ||
274 | if (ipprot == NULL) { | ||
275 | /* raw IP is OK */ | ||
276 | return 1; | ||
277 | } | ||
278 | return ipprot->netns_ok; | ||
279 | } | ||
280 | |||
281 | /* | 266 | /* |
282 | * Create an inet socket. | 267 | * Create an inet socket. |
283 | */ | 268 | */ |
@@ -350,10 +335,6 @@ lookup_protocol: | |||
350 | !ns_capable(net->user_ns, CAP_NET_RAW)) | 335 | !ns_capable(net->user_ns, CAP_NET_RAW)) |
351 | goto out_rcu_unlock; | 336 | goto out_rcu_unlock; |
352 | 337 | ||
353 | err = -EAFNOSUPPORT; | ||
354 | if (!inet_netns_ok(net, protocol)) | ||
355 | goto out_rcu_unlock; | ||
356 | |||
357 | sock->ops = answer->ops; | 338 | sock->ops = answer->ops; |
358 | answer_prot = answer->prot; | 339 | answer_prot = answer->prot; |
359 | answer_no_check = answer->no_check; | 340 | answer_no_check = answer->no_check; |