aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/devinet.c
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2010-02-13 22:25:51 -0500
committerDavid S. Miller <davem@davemloft.net>2010-02-16 18:55:17 -0500
commit02291680ffba92e5b5865bc0c5e7d1f3056b80ec (patch)
treefde485582de465b211cc907710a23ef8ca84408e /net/ipv4/devinet.c
parent9e3f8063a72a946f2ba29068b34190436573dffe (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 'net/ipv4/devinet.c')
-rw-r--r--net/ipv4/devinet.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index cd71a3908391..b1eddee9bf94 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -64,20 +64,20 @@
64 64
65static struct ipv4_devconf ipv4_devconf = { 65static struct ipv4_devconf ipv4_devconf = {
66 .data = { 66 .data = {
67 [NET_IPV4_CONF_ACCEPT_REDIRECTS - 1] = 1, 67 [IPV4_DEVCONF_ACCEPT_REDIRECTS - 1] = 1,
68 [NET_IPV4_CONF_SEND_REDIRECTS - 1] = 1, 68 [IPV4_DEVCONF_SEND_REDIRECTS - 1] = 1,
69 [NET_IPV4_CONF_SECURE_REDIRECTS - 1] = 1, 69 [IPV4_DEVCONF_SECURE_REDIRECTS - 1] = 1,
70 [NET_IPV4_CONF_SHARED_MEDIA - 1] = 1, 70 [IPV4_DEVCONF_SHARED_MEDIA - 1] = 1,
71 }, 71 },
72}; 72};
73 73
74static struct ipv4_devconf ipv4_devconf_dflt = { 74static struct ipv4_devconf ipv4_devconf_dflt = {
75 .data = { 75 .data = {
76 [NET_IPV4_CONF_ACCEPT_REDIRECTS - 1] = 1, 76 [IPV4_DEVCONF_ACCEPT_REDIRECTS - 1] = 1,
77 [NET_IPV4_CONF_SEND_REDIRECTS - 1] = 1, 77 [IPV4_DEVCONF_SEND_REDIRECTS - 1] = 1,
78 [NET_IPV4_CONF_SECURE_REDIRECTS - 1] = 1, 78 [IPV4_DEVCONF_SECURE_REDIRECTS - 1] = 1,
79 [NET_IPV4_CONF_SHARED_MEDIA - 1] = 1, 79 [IPV4_DEVCONF_SHARED_MEDIA - 1] = 1,
80 [NET_IPV4_CONF_ACCEPT_SOURCE_ROUTE - 1] = 1, 80 [IPV4_DEVCONF_ACCEPT_SOURCE_ROUTE - 1] = 1,
81 }, 81 },
82}; 82};
83 83
@@ -1360,7 +1360,7 @@ int ipv4_doint_and_flush(ctl_table *ctl, int write,
1360 { \ 1360 { \
1361 .procname = name, \ 1361 .procname = name, \
1362 .data = ipv4_devconf.data + \ 1362 .data = ipv4_devconf.data + \
1363 NET_IPV4_CONF_ ## attr - 1, \ 1363 IPV4_DEVCONF_ ## attr - 1, \
1364 .maxlen = sizeof(int), \ 1364 .maxlen = sizeof(int), \
1365 .mode = mval, \ 1365 .mode = mval, \
1366 .proc_handler = proc, \ 1366 .proc_handler = proc, \
@@ -1381,7 +1381,7 @@ int ipv4_doint_and_flush(ctl_table *ctl, int write,
1381 1381
1382static struct devinet_sysctl_table { 1382static struct devinet_sysctl_table {
1383 struct ctl_table_header *sysctl_header; 1383 struct ctl_table_header *sysctl_header;
1384 struct ctl_table devinet_vars[__NET_IPV4_CONF_MAX]; 1384 struct ctl_table devinet_vars[__IPV4_DEVCONF_MAX];
1385 char *dev_name; 1385 char *dev_name;
1386} devinet_sysctl = { 1386} devinet_sysctl = {
1387 .devinet_vars = { 1387 .devinet_vars = {
@@ -1503,7 +1503,7 @@ static struct ctl_table ctl_forward_entry[] = {
1503 { 1503 {
1504 .procname = "ip_forward", 1504 .procname = "ip_forward",
1505 .data = &ipv4_devconf.data[ 1505 .data = &ipv4_devconf.data[
1506 NET_IPV4_CONF_FORWARDING - 1], 1506 IPV4_DEVCONF_FORWARDING - 1],
1507 .maxlen = sizeof(int), 1507 .maxlen = sizeof(int),
1508 .mode = 0644, 1508 .mode = 0644,
1509 .proc_handler = devinet_sysctl_forward, 1509 .proc_handler = devinet_sysctl_forward,
@@ -1547,7 +1547,7 @@ static __net_init int devinet_init_net(struct net *net)
1547 if (tbl == NULL) 1547 if (tbl == NULL)
1548 goto err_alloc_ctl; 1548 goto err_alloc_ctl;
1549 1549
1550 tbl[0].data = &all->data[NET_IPV4_CONF_FORWARDING - 1]; 1550 tbl[0].data = &all->data[IPV4_DEVCONF_FORWARDING - 1];
1551 tbl[0].extra1 = all; 1551 tbl[0].extra1 = all;
1552 tbl[0].extra2 = net; 1552 tbl[0].extra2 = net;
1553#endif 1553#endif