Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 78390
b: refs/heads/master
c: 51602b2
h: refs/heads/master
v: v3
  • Loading branch information
Pavel Emelyanov authored and David S. Miller committed Jan 28, 2008
1 parent 76052e8 commit 8dbfe23
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 31 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: 01ecfe9ba63aa0f23bbdb15371916ba4d5382330
refs/heads/master: 51602b2a5e849babd94311e555bf1ba58151b8d4
59 changes: 29 additions & 30 deletions trunk/net/ipv4/devinet.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,14 @@ 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 *idev);
static void devinet_sysctl_unregister(struct ipv4_devconf *p);
static void devinet_sysctl_unregister(struct in_device *idev);
#else
static inline void devinet_sysctl_register(struct in_device *idev)
{
}
static inline void devinet_sysctl_unregister(struct in_device *idev)
{
}
#endif

/* Locks all the inet devices. */
Expand Down Expand Up @@ -163,17 +170,10 @@ static struct in_device *inetdev_init(struct net_device *dev)
goto out_kfree;
/* Reference in_dev->dev */
dev_hold(dev);
#ifdef CONFIG_SYSCTL
neigh_sysctl_register(dev, in_dev->arp_parms, NET_IPV4,
NET_IPV4_NEIGH, "ipv4", NULL, NULL);
#endif

/* Account for reference dev->ip_ptr (below) */
in_dev_hold(in_dev);

#ifdef CONFIG_SYSCTL
devinet_sysctl_register(in_dev);
#endif
ip_mc_init_dev(in_dev);
if (dev->flags & IFF_UP)
ip_mc_up(in_dev);
Expand Down Expand Up @@ -212,15 +212,9 @@ static void inetdev_destroy(struct in_device *in_dev)
inet_free_ifa(ifa);
}

#ifdef CONFIG_SYSCTL
devinet_sysctl_unregister(&in_dev->cnf);
#endif

dev->ip_ptr = NULL;

#ifdef CONFIG_SYSCTL
neigh_sysctl_unregister(in_dev->arp_parms);
#endif
devinet_sysctl_unregister(in_dev);
neigh_parms_release(&arp_tbl, in_dev->arp_parms);
arp_ifdown(dev);

Expand Down Expand Up @@ -1113,13 +1107,8 @@ static int inetdev_event(struct notifier_block *this, unsigned long event,
*/
inetdev_changename(dev, in_dev);

#ifdef CONFIG_SYSCTL
devinet_sysctl_unregister(&in_dev->cnf);
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_unregister(in_dev);
devinet_sysctl_register(in_dev);
#endif
break;
}
out:
Expand Down Expand Up @@ -1518,21 +1507,31 @@ static void __devinet_sysctl_register(char *dev_name, int ctl_name,
return;
}

static void __devinet_sysctl_unregister(struct ipv4_devconf *cnf)
{
struct devinet_sysctl_table *t = cnf->sysctl;

if (t == NULL)
return;

cnf->sysctl = NULL;
unregister_sysctl_table(t->sysctl_header);
kfree(t->dev_name);
kfree(t);
}

static void devinet_sysctl_register(struct in_device *idev)
{
return __devinet_sysctl_register(idev->dev->name, idev->dev->ifindex,
neigh_sysctl_register(idev->dev, idev->arp_parms, NET_IPV4,
NET_IPV4_NEIGH, "ipv4", NULL, NULL);
__devinet_sysctl_register(idev->dev->name, idev->dev->ifindex,
&idev->cnf);
}

static void devinet_sysctl_unregister(struct ipv4_devconf *p)
static void devinet_sysctl_unregister(struct in_device *idev)
{
if (p->sysctl) {
struct devinet_sysctl_table *t = p->sysctl;
p->sysctl = NULL;
unregister_sysctl_table(t->sysctl_header);
kfree(t->dev_name);
kfree(t);
}
__devinet_sysctl_unregister(&idev->cnf);
neigh_sysctl_unregister(idev->arp_parms);
}
#endif

Expand Down

0 comments on commit 8dbfe23

Please sign in to comment.