aboutsummaryrefslogtreecommitdiffstats
path: root/include/net
diff options
context:
space:
mode:
authorWANG Cong <xiyou.wangcong@gmail.com>2014-07-25 18:25:08 -0400
committerDavid S. Miller <davem@davemloft.net>2014-07-29 14:43:50 -0400
commit20e61da7ffcfd84a1b6f797e745608572e5bc218 (patch)
tree19738d56563acf91956bb2a0b44de9ff2e1640cd /include/net
parent9d7e3ea73c6be20538a69c14ab8bfb3b36f8d1a8 (diff)
ipv4: fail early when creating netdev named all or default
We create a proc dir for each network device, this will cause conflicts when the devices have name "all" or "default". Rather than emitting an ugly kernel warning, we could just fail earlier by checking the device name. Reported-by: Stephane Chazelas <stephane.chazelas@gmail.com> Cc: "David S. Miller" <davem@davemloft.net> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net')
-rw-r--r--include/net/ip.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/include/net/ip.h b/include/net/ip.h
index ca14799545fd..09b32da1b929 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -216,6 +216,12 @@ static inline int inet_is_local_reserved_port(struct net *net, int port)
216 return 0; 216 return 0;
217 return test_bit(port, net->ipv4.sysctl_local_reserved_ports); 217 return test_bit(port, net->ipv4.sysctl_local_reserved_ports);
218} 218}
219
220static inline bool sysctl_dev_name_is_allowed(const char *name)
221{
222 return strcmp(name, "default") != 0 && strcmp(name, "all") != 0;
223}
224
219#else 225#else
220static inline int inet_is_local_reserved_port(struct net *net, int port) 226static inline int inet_is_local_reserved_port(struct net *net, int port)
221{ 227{