aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/devinet.c
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2009-11-05 16:32:03 -0500
committerEric W. Biederman <ebiederm@xmission.com>2009-11-12 05:05:06 -0500
commitf8572d8f2a2ba75408b97dc24ef47c83671795d7 (patch)
tree052506a457939fea00d138d3a982d778df34e14c /net/ipv4/devinet.c
parent86b1bc68e2f4244e4ea5db5458df9d19259fbb30 (diff)
sysctl net: Remove unused binary sysctl code
Now that sys_sysctl is a compatiblity wrapper around /proc/sys all sysctl strategy routines, and all ctl_name and strategy entries in the sysctl tables are unused, and can be revmoed. In addition neigh_sysctl_register has been modified to no longer take a strategy argument and it's callers have been modified not to pass one. Cc: "David Miller" <davem@davemloft.net> Cc: Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org> Cc: netdev@vger.kernel.org Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Diffstat (limited to 'net/ipv4/devinet.c')
-rw-r--r--net/ipv4/devinet.c111
1 files changed, 17 insertions, 94 deletions
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index 5df2f6a0b0f0..e049da8311b5 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -1293,58 +1293,6 @@ static int devinet_conf_proc(ctl_table *ctl, int write,
1293 return ret; 1293 return ret;
1294} 1294}
1295 1295
1296static int devinet_conf_sysctl(ctl_table *table,
1297 void __user *oldval, size_t __user *oldlenp,
1298 void __user *newval, size_t newlen)
1299{
1300 struct ipv4_devconf *cnf;
1301 struct net *net;
1302 int *valp = table->data;
1303 int new;
1304 int i;
1305
1306 if (!newval || !newlen)
1307 return 0;
1308
1309 if (newlen != sizeof(int))
1310 return -EINVAL;
1311
1312 if (get_user(new, (int __user *)newval))
1313 return -EFAULT;
1314
1315 if (new == *valp)
1316 return 0;
1317
1318 if (oldval && oldlenp) {
1319 size_t len;
1320
1321 if (get_user(len, oldlenp))
1322 return -EFAULT;
1323
1324 if (len) {
1325 if (len > table->maxlen)
1326 len = table->maxlen;
1327 if (copy_to_user(oldval, valp, len))
1328 return -EFAULT;
1329 if (put_user(len, oldlenp))
1330 return -EFAULT;
1331 }
1332 }
1333
1334 *valp = new;
1335
1336 cnf = table->extra1;
1337 net = table->extra2;
1338 i = (int *)table->data - cnf->data;
1339
1340 set_bit(i, cnf->state);
1341
1342 if (cnf == net->ipv4.devconf_dflt)
1343 devinet_copy_dflt_conf(net, i);
1344
1345 return 1;
1346}
1347
1348static int devinet_sysctl_forward(ctl_table *ctl, int write, 1296static int devinet_sysctl_forward(ctl_table *ctl, int write,
1349 void __user *buffer, 1297 void __user *buffer,
1350 size_t *lenp, loff_t *ppos) 1298 size_t *lenp, loff_t *ppos)
@@ -1390,47 +1338,28 @@ int ipv4_doint_and_flush(ctl_table *ctl, int write,
1390 return ret; 1338 return ret;
1391} 1339}
1392 1340
1393int ipv4_doint_and_flush_strategy(ctl_table *table, 1341#define DEVINET_SYSCTL_ENTRY(attr, name, mval, proc) \
1394 void __user *oldval, size_t __user *oldlenp,
1395 void __user *newval, size_t newlen)
1396{
1397 int ret = devinet_conf_sysctl(table, oldval, oldlenp, newval, newlen);
1398 struct net *net = table->extra2;
1399
1400 if (ret == 1)
1401 rt_cache_flush(net, 0);
1402
1403 return ret;
1404}
1405
1406
1407#define DEVINET_SYSCTL_ENTRY(attr, name, mval, proc, sysctl) \
1408 { \ 1342 { \
1409 .ctl_name = NET_IPV4_CONF_ ## attr, \
1410 .procname = name, \ 1343 .procname = name, \
1411 .data = ipv4_devconf.data + \ 1344 .data = ipv4_devconf.data + \
1412 NET_IPV4_CONF_ ## attr - 1, \ 1345 NET_IPV4_CONF_ ## attr - 1, \
1413 .maxlen = sizeof(int), \ 1346 .maxlen = sizeof(int), \
1414 .mode = mval, \ 1347 .mode = mval, \
1415 .proc_handler = proc, \ 1348 .proc_handler = proc, \
1416 .strategy = sysctl, \
1417 .extra1 = &ipv4_devconf, \ 1349 .extra1 = &ipv4_devconf, \
1418 } 1350 }
1419 1351
1420#define DEVINET_SYSCTL_RW_ENTRY(attr, name) \ 1352#define DEVINET_SYSCTL_RW_ENTRY(attr, name) \
1421 DEVINET_SYSCTL_ENTRY(attr, name, 0644, devinet_conf_proc, \ 1353 DEVINET_SYSCTL_ENTRY(attr, name, 0644, devinet_conf_proc)
1422 devinet_conf_sysctl)
1423 1354
1424#define DEVINET_SYSCTL_RO_ENTRY(attr, name) \ 1355#define DEVINET_SYSCTL_RO_ENTRY(attr, name) \
1425 DEVINET_SYSCTL_ENTRY(attr, name, 0444, devinet_conf_proc, \ 1356 DEVINET_SYSCTL_ENTRY(attr, name, 0444, devinet_conf_proc)
1426 devinet_conf_sysctl)
1427 1357
1428#define DEVINET_SYSCTL_COMPLEX_ENTRY(attr, name, proc, sysctl) \ 1358#define DEVINET_SYSCTL_COMPLEX_ENTRY(attr, name, proc) \
1429 DEVINET_SYSCTL_ENTRY(attr, name, 0644, proc, sysctl) 1359 DEVINET_SYSCTL_ENTRY(attr, name, 0644, proc)
1430 1360
1431#define DEVINET_SYSCTL_FLUSHING_ENTRY(attr, name) \ 1361#define DEVINET_SYSCTL_FLUSHING_ENTRY(attr, name) \
1432 DEVINET_SYSCTL_COMPLEX_ENTRY(attr, name, ipv4_doint_and_flush, \ 1362 DEVINET_SYSCTL_COMPLEX_ENTRY(attr, name, ipv4_doint_and_flush)
1433 ipv4_doint_and_flush_strategy)
1434 1363
1435static struct devinet_sysctl_table { 1364static struct devinet_sysctl_table {
1436 struct ctl_table_header *sysctl_header; 1365 struct ctl_table_header *sysctl_header;
@@ -1439,8 +1368,7 @@ static struct devinet_sysctl_table {
1439} devinet_sysctl = { 1368} devinet_sysctl = {
1440 .devinet_vars = { 1369 .devinet_vars = {
1441 DEVINET_SYSCTL_COMPLEX_ENTRY(FORWARDING, "forwarding", 1370 DEVINET_SYSCTL_COMPLEX_ENTRY(FORWARDING, "forwarding",
1442 devinet_sysctl_forward, 1371 devinet_sysctl_forward),
1443 devinet_conf_sysctl),
1444 DEVINET_SYSCTL_RO_ENTRY(MC_FORWARDING, "mc_forwarding"), 1372 DEVINET_SYSCTL_RO_ENTRY(MC_FORWARDING, "mc_forwarding"),
1445 1373
1446 DEVINET_SYSCTL_RW_ENTRY(ACCEPT_REDIRECTS, "accept_redirects"), 1374 DEVINET_SYSCTL_RW_ENTRY(ACCEPT_REDIRECTS, "accept_redirects"),
@@ -1471,7 +1399,7 @@ static struct devinet_sysctl_table {
1471}; 1399};
1472 1400
1473static int __devinet_sysctl_register(struct net *net, char *dev_name, 1401static int __devinet_sysctl_register(struct net *net, char *dev_name,
1474 int ctl_name, struct ipv4_devconf *p) 1402 struct ipv4_devconf *p)
1475{ 1403{
1476 int i; 1404 int i;
1477 struct devinet_sysctl_table *t; 1405 struct devinet_sysctl_table *t;
@@ -1479,9 +1407,9 @@ static int __devinet_sysctl_register(struct net *net, char *dev_name,
1479#define DEVINET_CTL_PATH_DEV 3 1407#define DEVINET_CTL_PATH_DEV 3
1480 1408
1481 struct ctl_path devinet_ctl_path[] = { 1409 struct ctl_path devinet_ctl_path[] = {
1482 { .procname = "net", .ctl_name = CTL_NET, }, 1410 { .procname = "net", },
1483 { .procname = "ipv4", .ctl_name = NET_IPV4, }, 1411 { .procname = "ipv4", },
1484 { .procname = "conf", .ctl_name = NET_IPV4_CONF, }, 1412 { .procname = "conf", },
1485 { /* to be set */ }, 1413 { /* to be set */ },
1486 { }, 1414 { },
1487 }; 1415 };
@@ -1506,7 +1434,6 @@ static int __devinet_sysctl_register(struct net *net, char *dev_name,
1506 goto free; 1434 goto free;
1507 1435
1508 devinet_ctl_path[DEVINET_CTL_PATH_DEV].procname = t->dev_name; 1436 devinet_ctl_path[DEVINET_CTL_PATH_DEV].procname = t->dev_name;
1509 devinet_ctl_path[DEVINET_CTL_PATH_DEV].ctl_name = ctl_name;
1510 1437
1511 t->sysctl_header = register_net_sysctl_table(net, devinet_ctl_path, 1438 t->sysctl_header = register_net_sysctl_table(net, devinet_ctl_path,
1512 t->devinet_vars); 1439 t->devinet_vars);
@@ -1540,9 +1467,9 @@ static void __devinet_sysctl_unregister(struct ipv4_devconf *cnf)
1540static void devinet_sysctl_register(struct in_device *idev) 1467static void devinet_sysctl_register(struct in_device *idev)
1541{ 1468{
1542 neigh_sysctl_register(idev->dev, idev->arp_parms, NET_IPV4, 1469 neigh_sysctl_register(idev->dev, idev->arp_parms, NET_IPV4,
1543 NET_IPV4_NEIGH, "ipv4", NULL, NULL); 1470 NET_IPV4_NEIGH, "ipv4", NULL);
1544 __devinet_sysctl_register(dev_net(idev->dev), idev->dev->name, 1471 __devinet_sysctl_register(dev_net(idev->dev), idev->dev->name,
1545 idev->dev->ifindex, &idev->cnf); 1472 &idev->cnf);
1546} 1473}
1547 1474
1548static void devinet_sysctl_unregister(struct in_device *idev) 1475static void devinet_sysctl_unregister(struct in_device *idev)
@@ -1553,14 +1480,12 @@ static void devinet_sysctl_unregister(struct in_device *idev)
1553 1480
1554static struct ctl_table ctl_forward_entry[] = { 1481static struct ctl_table ctl_forward_entry[] = {
1555 { 1482 {
1556 .ctl_name = NET_IPV4_FORWARD,
1557 .procname = "ip_forward", 1483 .procname = "ip_forward",
1558 .data = &ipv4_devconf.data[ 1484 .data = &ipv4_devconf.data[
1559 NET_IPV4_CONF_FORWARDING - 1], 1485 NET_IPV4_CONF_FORWARDING - 1],
1560 .maxlen = sizeof(int), 1486 .maxlen = sizeof(int),
1561 .mode = 0644, 1487 .mode = 0644,
1562 .proc_handler = devinet_sysctl_forward, 1488 .proc_handler = devinet_sysctl_forward,
1563 .strategy = devinet_conf_sysctl,
1564 .extra1 = &ipv4_devconf, 1489 .extra1 = &ipv4_devconf,
1565 .extra2 = &init_net, 1490 .extra2 = &init_net,
1566 }, 1491 },
@@ -1568,8 +1493,8 @@ static struct ctl_table ctl_forward_entry[] = {
1568}; 1493};
1569 1494
1570static __net_initdata struct ctl_path net_ipv4_path[] = { 1495static __net_initdata struct ctl_path net_ipv4_path[] = {
1571 { .procname = "net", .ctl_name = CTL_NET, }, 1496 { .procname = "net", },
1572 { .procname = "ipv4", .ctl_name = NET_IPV4, }, 1497 { .procname = "ipv4", },
1573 { }, 1498 { },
1574}; 1499};
1575#endif 1500#endif
@@ -1608,13 +1533,11 @@ static __net_init int devinet_init_net(struct net *net)
1608 } 1533 }
1609 1534
1610#ifdef CONFIG_SYSCTL 1535#ifdef CONFIG_SYSCTL
1611 err = __devinet_sysctl_register(net, "all", 1536 err = __devinet_sysctl_register(net, "all", all);
1612 NET_PROTO_CONF_ALL, all);
1613 if (err < 0) 1537 if (err < 0)
1614 goto err_reg_all; 1538 goto err_reg_all;
1615 1539
1616 err = __devinet_sysctl_register(net, "default", 1540 err = __devinet_sysctl_register(net, "default", dflt);
1617 NET_PROTO_CONF_DEFAULT, dflt);
1618 if (err < 0) 1541 if (err < 0)
1619 goto err_reg_dflt; 1542 goto err_reg_dflt;
1620 1543