Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 78258
b: refs/heads/master
c: 66f27a5
h: refs/heads/master
v: v3
  • Loading branch information
Pavel Emelyanov authored and David S. Miller committed Jan 28, 2008
1 parent 2a4e3e1 commit 92ee1be
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 19 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: edae58ead57319b0bcf16e48a32365145c7bf0b7
refs/heads/master: 66f27a52037c89183e83689b0531412577be0101
34 changes: 16 additions & 18 deletions trunk/net/ipv4/devinet.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,7 @@ static BLOCKING_NOTIFIER_HEAD(inetaddr_chain);
static void inet_del_ifa(struct in_device *in_dev, struct in_ifaddr **ifap,
int destroy);
#ifdef CONFIG_SYSCTL
static void devinet_sysctl_register(struct in_device *in_dev,
struct ipv4_devconf *p);
static void devinet_sysctl_register(struct in_device *idev);
static void devinet_sysctl_unregister(struct ipv4_devconf *p);
#endif

Expand Down Expand Up @@ -173,7 +172,7 @@ static struct in_device *inetdev_init(struct net_device *dev)
in_dev_hold(in_dev);

#ifdef CONFIG_SYSCTL
devinet_sysctl_register(in_dev, &in_dev->cnf);
devinet_sysctl_register(in_dev);
#endif
ip_mc_init_dev(in_dev);
if (dev->flags & IFF_UP)
Expand Down Expand Up @@ -1119,7 +1118,7 @@ static int inetdev_event(struct notifier_block *this, unsigned long event,
neigh_sysctl_unregister(in_dev->arp_parms);
neigh_sysctl_register(dev, in_dev->arp_parms, NET_IPV4,
NET_IPV4_NEIGH, "ipv4", NULL, NULL);
devinet_sysctl_register(in_dev, &in_dev->cnf);
devinet_sysctl_register(in_dev);
#endif
break;
}
Expand Down Expand Up @@ -1501,13 +1500,11 @@ static struct devinet_sysctl_table {
},
};

static void devinet_sysctl_register(struct in_device *in_dev,
struct ipv4_devconf *p)
static void __devinet_sysctl_register(char *dev_name, int ctl_name,
struct ipv4_devconf *p)
{
int i;
struct net_device *dev = in_dev ? in_dev->dev : NULL;
struct devinet_sysctl_table *t;
char *dev_name = NULL;

t = kmemdup(&devinet_sysctl, sizeof(*t), GFP_KERNEL);
if (!t)
Expand All @@ -1518,13 +1515,7 @@ static void devinet_sysctl_register(struct in_device *in_dev,
t->devinet_vars[i].extra1 = p;
}

if (dev) {
dev_name = dev->name;
t->devinet_dev[0].ctl_name = dev->ifindex;
} else {
dev_name = "default";
t->devinet_dev[0].ctl_name = NET_PROTO_CONF_DEFAULT;
}
t->devinet_dev[0].ctl_name = ctl_name;

/*
* Make a copy of dev_name, because '.procname' is regarded as const
Expand Down Expand Up @@ -1556,6 +1547,12 @@ static void devinet_sysctl_register(struct in_device *in_dev,
return;
}

static void devinet_sysctl_register(struct in_device *idev)
{
return __devinet_sysctl_register(idev->dev->name, idev->dev->ifindex,
&idev->cnf);
}

static void devinet_sysctl_unregister(struct ipv4_devconf *p)
{
if (p->sysctl) {
Expand All @@ -1577,9 +1574,10 @@ void __init devinet_init(void)
rtnl_register(PF_INET, RTM_DELADDR, inet_rtm_deladdr, NULL);
rtnl_register(PF_INET, RTM_GETADDR, NULL, inet_dump_ifaddr);
#ifdef CONFIG_SYSCTL
devinet_sysctl.sysctl_header =
register_sysctl_table(devinet_sysctl.devinet_root_dir);
devinet_sysctl_register(NULL, &ipv4_devconf_dflt);
__devinet_sysctl_register("all", NET_PROTO_CONF_ALL,
&ipv4_devconf);
__devinet_sysctl_register("default", NET_PROTO_CONF_DEFAULT,
&ipv4_devconf_dflt);
#endif
}

Expand Down

0 comments on commit 92ee1be

Please sign in to comment.