aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/protocol.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2013-02-05 14:42:23 -0500
committerDavid S. Miller <davem@davemloft.net>2013-02-05 14:42:23 -0500
commit547472b8e1da72ae226430c0c4273e36fc8ca768 (patch)
tree2300023f8d0fa943725e1b4ea3b2b95c91de4430 /net/ipv4/protocol.c
parent9d6ddb19905223828485d8c40deaec76e4dea3a5 (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/protocol.c')
-rw-r--r--net/ipv4/protocol.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/net/ipv4/protocol.c b/net/ipv4/protocol.c
index 0f9d09f54bd9..ce848461acbb 100644
--- a/net/ipv4/protocol.c
+++ b/net/ipv4/protocol.c
@@ -37,6 +37,12 @@ const struct net_offload __rcu *inet_offloads[MAX_INET_PROTOS] __read_mostly;
37 37
38int inet_add_protocol(const struct net_protocol *prot, unsigned char protocol) 38int inet_add_protocol(const struct net_protocol *prot, unsigned char protocol)
39{ 39{
40 if (!prot->netns_ok) {
41 pr_err("Protocol %u is not namespace aware, cannot register.\n",
42 protocol);
43 return -EINVAL;
44 }
45
40 return !cmpxchg((const struct net_protocol **)&inet_protos[protocol], 46 return !cmpxchg((const struct net_protocol **)&inet_protos[protocol],
41 NULL, prot) ? 0 : -1; 47 NULL, prot) ? 0 : -1;
42} 48}