diff options
author | Eric W. Biederman <ebiederm@xmission.com> | 2010-02-13 22:25:51 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-02-16 18:55:17 -0500 |
commit | 02291680ffba92e5b5865bc0c5e7d1f3056b80ec (patch) | |
tree | fde485582de465b211cc907710a23ef8ca84408e /include/linux/inetdevice.h | |
parent | 9e3f8063a72a946f2ba29068b34190436573dffe (diff) |
net ipv4: Decouple ipv4 interface parameters from binary sysctl numbers
Stop using the binary sysctl enumeartion in sysctl.h as an index into
a per interface array. This leads to unnecessary binary sysctl number
allocation, and a fragility in data structure and implementation
because of unnecessary coupling.
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/inetdevice.h')
-rw-r--r-- | include/linux/inetdevice.h | 42 |
1 files changed, 36 insertions, 6 deletions
diff --git a/include/linux/inetdevice.h b/include/linux/inetdevice.h index cf257809771b..2be1a1a2beb9 100644 --- a/include/linux/inetdevice.h +++ b/include/linux/inetdevice.h | |||
@@ -10,10 +10,40 @@ | |||
10 | #include <linux/timer.h> | 10 | #include <linux/timer.h> |
11 | #include <linux/sysctl.h> | 11 | #include <linux/sysctl.h> |
12 | 12 | ||
13 | enum | ||
14 | { | ||
15 | IPV4_DEVCONF_FORWARDING=1, | ||
16 | IPV4_DEVCONF_MC_FORWARDING, | ||
17 | IPV4_DEVCONF_PROXY_ARP, | ||
18 | IPV4_DEVCONF_ACCEPT_REDIRECTS, | ||
19 | IPV4_DEVCONF_SECURE_REDIRECTS, | ||
20 | IPV4_DEVCONF_SEND_REDIRECTS, | ||
21 | IPV4_DEVCONF_SHARED_MEDIA, | ||
22 | IPV4_DEVCONF_RP_FILTER, | ||
23 | IPV4_DEVCONF_ACCEPT_SOURCE_ROUTE, | ||
24 | IPV4_DEVCONF_BOOTP_RELAY, | ||
25 | IPV4_DEVCONF_LOG_MARTIANS, | ||
26 | IPV4_DEVCONF_TAG, | ||
27 | IPV4_DEVCONF_ARPFILTER, | ||
28 | IPV4_DEVCONF_MEDIUM_ID, | ||
29 | IPV4_DEVCONF_NOXFRM, | ||
30 | IPV4_DEVCONF_NOPOLICY, | ||
31 | IPV4_DEVCONF_FORCE_IGMP_VERSION, | ||
32 | IPV4_DEVCONF_ARP_ANNOUNCE, | ||
33 | IPV4_DEVCONF_ARP_IGNORE, | ||
34 | IPV4_DEVCONF_PROMOTE_SECONDARIES, | ||
35 | IPV4_DEVCONF_ARP_ACCEPT, | ||
36 | IPV4_DEVCONF_ARP_NOTIFY, | ||
37 | IPV4_DEVCONF_ACCEPT_LOCAL, | ||
38 | IPV4_DEVCONF_SRC_VMARK, | ||
39 | IPV4_DEVCONF_PROXY_ARP_PVLAN, | ||
40 | __IPV4_DEVCONF_MAX | ||
41 | }; | ||
42 | |||
13 | struct ipv4_devconf { | 43 | struct ipv4_devconf { |
14 | void *sysctl; | 44 | void *sysctl; |
15 | int data[__NET_IPV4_CONF_MAX - 1]; | 45 | int data[__IPV4_DEVCONF_MAX - 1]; |
16 | DECLARE_BITMAP(state, __NET_IPV4_CONF_MAX - 1); | 46 | DECLARE_BITMAP(state, __IPV4_DEVCONF_MAX - 1); |
17 | }; | 47 | }; |
18 | 48 | ||
19 | struct in_device { | 49 | struct in_device { |
@@ -40,7 +70,7 @@ struct in_device { | |||
40 | struct rcu_head rcu_head; | 70 | struct rcu_head rcu_head; |
41 | }; | 71 | }; |
42 | 72 | ||
43 | #define IPV4_DEVCONF(cnf, attr) ((cnf).data[NET_IPV4_CONF_ ## attr - 1]) | 73 | #define IPV4_DEVCONF(cnf, attr) ((cnf).data[IPV4_DEVCONF_ ## attr - 1]) |
44 | #define IPV4_DEVCONF_ALL(net, attr) \ | 74 | #define IPV4_DEVCONF_ALL(net, attr) \ |
45 | IPV4_DEVCONF((*(net)->ipv4.devconf_all), attr) | 75 | IPV4_DEVCONF((*(net)->ipv4.devconf_all), attr) |
46 | 76 | ||
@@ -60,13 +90,13 @@ static inline void ipv4_devconf_set(struct in_device *in_dev, int index, | |||
60 | 90 | ||
61 | static inline void ipv4_devconf_setall(struct in_device *in_dev) | 91 | static inline void ipv4_devconf_setall(struct in_device *in_dev) |
62 | { | 92 | { |
63 | bitmap_fill(in_dev->cnf.state, __NET_IPV4_CONF_MAX - 1); | 93 | bitmap_fill(in_dev->cnf.state, __IPV4_DEVCONF_MAX - 1); |
64 | } | 94 | } |
65 | 95 | ||
66 | #define IN_DEV_CONF_GET(in_dev, attr) \ | 96 | #define IN_DEV_CONF_GET(in_dev, attr) \ |
67 | ipv4_devconf_get((in_dev), NET_IPV4_CONF_ ## attr) | 97 | ipv4_devconf_get((in_dev), IPV4_DEVCONF_ ## attr) |
68 | #define IN_DEV_CONF_SET(in_dev, attr, val) \ | 98 | #define IN_DEV_CONF_SET(in_dev, attr, val) \ |
69 | ipv4_devconf_set((in_dev), NET_IPV4_CONF_ ## attr, (val)) | 99 | ipv4_devconf_set((in_dev), IPV4_DEVCONF_ ## attr, (val)) |
70 | 100 | ||
71 | #define IN_DEV_ANDCONF(in_dev, attr) \ | 101 | #define IN_DEV_ANDCONF(in_dev, attr) \ |
72 | (IPV4_DEVCONF_ALL(dev_net(in_dev->dev), attr) && \ | 102 | (IPV4_DEVCONF_ALL(dev_net(in_dev->dev), attr) && \ |