aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/devinet.c
diff options
context:
space:
mode:
authorEric Dumazet <dada1@cosmosbay.com>2008-01-06 02:08:49 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 18:00:40 -0500
commit2a75de0c1de2dde9ef41aeb45a21048681421b8a (patch)
treef4af1e1cc93781087088a3f93077df2ff159023b /net/ipv4/devinet.c
parent6e32814bc89e7103e2b75b841155faf51f60a8f1 (diff)
[NETNS]: Should build with CONFIG_SYSCTL=n
Previous NETNS patches broke CONFIG_SYSCTL=n case Signed-off-by: Eric Dumazet <dada1@cosmosbay.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/devinet.c')
-rw-r--r--net/ipv4/devinet.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index 44cb252d2f61..03db15b10309 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -1542,7 +1542,6 @@ static void devinet_sysctl_unregister(struct in_device *idev)
1542 __devinet_sysctl_unregister(&idev->cnf); 1542 __devinet_sysctl_unregister(&idev->cnf);
1543 neigh_sysctl_unregister(idev->arp_parms); 1543 neigh_sysctl_unregister(idev->arp_parms);
1544} 1544}
1545#endif
1546 1545
1547static struct ctl_table ctl_forward_entry[] = { 1546static struct ctl_table ctl_forward_entry[] = {
1548 { 1547 {
@@ -1565,18 +1564,20 @@ static __net_initdata struct ctl_path net_ipv4_path[] = {
1565 { .procname = "ipv4", .ctl_name = NET_IPV4, }, 1564 { .procname = "ipv4", .ctl_name = NET_IPV4, },
1566 { }, 1565 { },
1567}; 1566};
1567#endif
1568 1568
1569static __net_init int devinet_init_net(struct net *net) 1569static __net_init int devinet_init_net(struct net *net)
1570{ 1570{
1571 int err; 1571 int err;
1572 struct ctl_table *tbl;
1573 struct ipv4_devconf *all, *dflt; 1572 struct ipv4_devconf *all, *dflt;
1573#ifdef CONFIG_SYSCTL
1574 struct ctl_table *tbl = ctl_forward_entry;
1574 struct ctl_table_header *forw_hdr; 1575 struct ctl_table_header *forw_hdr;
1576#endif
1575 1577
1576 err = -ENOMEM; 1578 err = -ENOMEM;
1577 all = &ipv4_devconf; 1579 all = &ipv4_devconf;
1578 dflt = &ipv4_devconf_dflt; 1580 dflt = &ipv4_devconf_dflt;
1579 tbl = ctl_forward_entry;
1580 1581
1581 if (net != &init_net) { 1582 if (net != &init_net) {
1582 all = kmemdup(all, sizeof(ipv4_devconf), GFP_KERNEL); 1583 all = kmemdup(all, sizeof(ipv4_devconf), GFP_KERNEL);
@@ -1587,6 +1588,7 @@ static __net_init int devinet_init_net(struct net *net)
1587 if (dflt == NULL) 1588 if (dflt == NULL)
1588 goto err_alloc_dflt; 1589 goto err_alloc_dflt;
1589 1590
1591#ifdef CONFIG_SYSCTL
1590 tbl = kmemdup(tbl, sizeof(ctl_forward_entry), GFP_KERNEL); 1592 tbl = kmemdup(tbl, sizeof(ctl_forward_entry), GFP_KERNEL);
1591 if (tbl == NULL) 1593 if (tbl == NULL)
1592 goto err_alloc_ctl; 1594 goto err_alloc_ctl;
@@ -1594,6 +1596,7 @@ static __net_init int devinet_init_net(struct net *net)
1594 tbl[0].data = &all->data[NET_IPV4_CONF_FORWARDING - 1]; 1596 tbl[0].data = &all->data[NET_IPV4_CONF_FORWARDING - 1];
1595 tbl[0].extra1 = all; 1597 tbl[0].extra1 = all;
1596 tbl[0].extra2 = net; 1598 tbl[0].extra2 = net;
1599#endif
1597 } 1600 }
1598 1601
1599#ifdef CONFIG_SYSCTL 1602#ifdef CONFIG_SYSCTL
@@ -1611,9 +1614,9 @@ static __net_init int devinet_init_net(struct net *net)
1611 forw_hdr = register_net_sysctl_table(net, net_ipv4_path, tbl); 1614 forw_hdr = register_net_sysctl_table(net, net_ipv4_path, tbl);
1612 if (forw_hdr == NULL) 1615 if (forw_hdr == NULL)
1613 goto err_reg_ctl; 1616 goto err_reg_ctl;
1617 net->ipv4.forw_hdr = forw_hdr;
1614#endif 1618#endif
1615 1619
1616 net->ipv4.forw_hdr = forw_hdr;
1617 net->ipv4.devconf_all = all; 1620 net->ipv4.devconf_all = all;
1618 net->ipv4.devconf_dflt = dflt; 1621 net->ipv4.devconf_dflt = dflt;
1619 return 0; 1622 return 0;
@@ -1626,8 +1629,8 @@ err_reg_dflt:
1626err_reg_all: 1629err_reg_all:
1627 if (tbl != ctl_forward_entry) 1630 if (tbl != ctl_forward_entry)
1628 kfree(tbl); 1631 kfree(tbl);
1629#endif
1630err_alloc_ctl: 1632err_alloc_ctl:
1633#endif
1631 if (dflt != &ipv4_devconf_dflt) 1634 if (dflt != &ipv4_devconf_dflt)
1632 kfree(dflt); 1635 kfree(dflt);
1633err_alloc_dflt: 1636err_alloc_dflt:
@@ -1639,15 +1642,15 @@ err_alloc_all:
1639 1642
1640static __net_exit void devinet_exit_net(struct net *net) 1643static __net_exit void devinet_exit_net(struct net *net)
1641{ 1644{
1645#ifdef CONFIG_SYSCTL
1642 struct ctl_table *tbl; 1646 struct ctl_table *tbl;
1643 1647
1644 tbl = net->ipv4.forw_hdr->ctl_table_arg; 1648 tbl = net->ipv4.forw_hdr->ctl_table_arg;
1645#ifdef CONFIG_SYSCTL
1646 unregister_net_sysctl_table(net->ipv4.forw_hdr); 1649 unregister_net_sysctl_table(net->ipv4.forw_hdr);
1647 __devinet_sysctl_unregister(net->ipv4.devconf_dflt); 1650 __devinet_sysctl_unregister(net->ipv4.devconf_dflt);
1648 __devinet_sysctl_unregister(net->ipv4.devconf_all); 1651 __devinet_sysctl_unregister(net->ipv4.devconf_all);
1649#endif
1650 kfree(tbl); 1652 kfree(tbl);
1653#endif
1651 kfree(net->ipv4.devconf_dflt); 1654 kfree(net->ipv4.devconf_dflt);
1652 kfree(net->ipv4.devconf_all); 1655 kfree(net->ipv4.devconf_all);
1653} 1656}