|
@@ -549,6 +549,9 @@ static int inet6_netconf_fill_devconf(struct sk_buff *skb, int ifindex,
|
|
|
if (nla_put_s32(skb, NETCONFA_IFINDEX, ifindex) < 0)
|
|
|
goto nla_put_failure;
|
|
|
|
|
|
+ if (!devconf)
|
|
|
+ goto out;
|
|
|
+
|
|
|
if ((all || type == NETCONFA_FORWARDING) &&
|
|
|
nla_put_s32(skb, NETCONFA_FORWARDING, devconf->forwarding) < 0)
|
|
|
goto nla_put_failure;
|
|
@@ -567,6 +570,7 @@ static int inet6_netconf_fill_devconf(struct sk_buff *skb, int ifindex,
|
|
|
devconf->ignore_routes_with_linkdown) < 0)
|
|
|
goto nla_put_failure;
|
|
|
|
|
|
+out:
|
|
|
nlmsg_end(skb, nlh);
|
|
|
return 0;
|
|
|
|
|
@@ -575,8 +579,8 @@ nla_put_failure:
|
|
|
return -EMSGSIZE;
|
|
|
}
|
|
|
|
|
|
-void inet6_netconf_notify_devconf(struct net *net, int type, int ifindex,
|
|
|
- struct ipv6_devconf *devconf)
|
|
|
+void inet6_netconf_notify_devconf(struct net *net, int event, int type,
|
|
|
+ int ifindex, struct ipv6_devconf *devconf)
|
|
|
{
|
|
|
struct sk_buff *skb;
|
|
|
int err = -ENOBUFS;
|
|
@@ -586,7 +590,7 @@ void inet6_netconf_notify_devconf(struct net *net, int type, int ifindex,
|
|
|
goto errout;
|
|
|
|
|
|
err = inet6_netconf_fill_devconf(skb, ifindex, devconf, 0, 0,
|
|
|
- RTM_NEWNETCONF, 0, type);
|
|
|
+ event, 0, type);
|
|
|
if (err < 0) {
|
|
|
/* -EMSGSIZE implies BUG in inet6_netconf_msgsize_devconf() */
|
|
|
WARN_ON(err == -EMSGSIZE);
|
|
@@ -769,7 +773,8 @@ static void dev_forward_change(struct inet6_dev *idev)
|
|
|
else
|
|
|
addrconf_leave_anycast(ifa);
|
|
|
}
|
|
|
- inet6_netconf_notify_devconf(dev_net(dev), NETCONFA_FORWARDING,
|
|
|
+ inet6_netconf_notify_devconf(dev_net(dev), RTM_NEWNETCONF,
|
|
|
+ NETCONFA_FORWARDING,
|
|
|
dev->ifindex, &idev->cnf);
|
|
|
}
|
|
|
|
|
@@ -804,7 +809,8 @@ static int addrconf_fixup_forwarding(struct ctl_table *table, int *p, int newf)
|
|
|
|
|
|
if (p == &net->ipv6.devconf_dflt->forwarding) {
|
|
|
if ((!newf) ^ (!old))
|
|
|
- inet6_netconf_notify_devconf(net, NETCONFA_FORWARDING,
|
|
|
+ inet6_netconf_notify_devconf(net, RTM_NEWNETCONF,
|
|
|
+ NETCONFA_FORWARDING,
|
|
|
NETCONFA_IFINDEX_DEFAULT,
|
|
|
net->ipv6.devconf_dflt);
|
|
|
rtnl_unlock();
|
|
@@ -816,13 +822,15 @@ static int addrconf_fixup_forwarding(struct ctl_table *table, int *p, int newf)
|
|
|
|
|
|
net->ipv6.devconf_dflt->forwarding = newf;
|
|
|
if ((!newf) ^ (!old_dflt))
|
|
|
- inet6_netconf_notify_devconf(net, NETCONFA_FORWARDING,
|
|
|
+ inet6_netconf_notify_devconf(net, RTM_NEWNETCONF,
|
|
|
+ NETCONFA_FORWARDING,
|
|
|
NETCONFA_IFINDEX_DEFAULT,
|
|
|
net->ipv6.devconf_dflt);
|
|
|
|
|
|
addrconf_forward_change(net, newf);
|
|
|
if ((!newf) ^ (!old))
|
|
|
- inet6_netconf_notify_devconf(net, NETCONFA_FORWARDING,
|
|
|
+ inet6_netconf_notify_devconf(net, RTM_NEWNETCONF,
|
|
|
+ NETCONFA_FORWARDING,
|
|
|
NETCONFA_IFINDEX_ALL,
|
|
|
net->ipv6.devconf_all);
|
|
|
} else if ((!newf) ^ (!old))
|
|
@@ -847,6 +855,7 @@ static void addrconf_linkdown_change(struct net *net, __s32 newf)
|
|
|
idev->cnf.ignore_routes_with_linkdown = newf;
|
|
|
if (changed)
|
|
|
inet6_netconf_notify_devconf(dev_net(dev),
|
|
|
+ RTM_NEWNETCONF,
|
|
|
NETCONFA_IGNORE_ROUTES_WITH_LINKDOWN,
|
|
|
dev->ifindex,
|
|
|
&idev->cnf);
|
|
@@ -869,6 +878,7 @@ static int addrconf_fixup_linkdown(struct ctl_table *table, int *p, int newf)
|
|
|
if (p == &net->ipv6.devconf_dflt->ignore_routes_with_linkdown) {
|
|
|
if ((!newf) ^ (!old))
|
|
|
inet6_netconf_notify_devconf(net,
|
|
|
+ RTM_NEWNETCONF,
|
|
|
NETCONFA_IGNORE_ROUTES_WITH_LINKDOWN,
|
|
|
NETCONFA_IFINDEX_DEFAULT,
|
|
|
net->ipv6.devconf_dflt);
|
|
@@ -881,6 +891,7 @@ static int addrconf_fixup_linkdown(struct ctl_table *table, int *p, int newf)
|
|
|
addrconf_linkdown_change(net, newf);
|
|
|
if ((!newf) ^ (!old))
|
|
|
inet6_netconf_notify_devconf(net,
|
|
|
+ RTM_NEWNETCONF,
|
|
|
NETCONFA_IGNORE_ROUTES_WITH_LINKDOWN,
|
|
|
NETCONFA_IFINDEX_ALL,
|
|
|
net->ipv6.devconf_all);
|
|
@@ -5675,17 +5686,20 @@ int addrconf_sysctl_proxy_ndp(struct ctl_table *ctl, int write,
|
|
|
return restart_syscall();
|
|
|
|
|
|
if (valp == &net->ipv6.devconf_dflt->proxy_ndp)
|
|
|
- inet6_netconf_notify_devconf(net, NETCONFA_PROXY_NEIGH,
|
|
|
+ inet6_netconf_notify_devconf(net, RTM_NEWNETCONF,
|
|
|
+ NETCONFA_PROXY_NEIGH,
|
|
|
NETCONFA_IFINDEX_DEFAULT,
|
|
|
net->ipv6.devconf_dflt);
|
|
|
else if (valp == &net->ipv6.devconf_all->proxy_ndp)
|
|
|
- inet6_netconf_notify_devconf(net, NETCONFA_PROXY_NEIGH,
|
|
|
+ inet6_netconf_notify_devconf(net, RTM_NEWNETCONF,
|
|
|
+ NETCONFA_PROXY_NEIGH,
|
|
|
NETCONFA_IFINDEX_ALL,
|
|
|
net->ipv6.devconf_all);
|
|
|
else {
|
|
|
struct inet6_dev *idev = ctl->extra1;
|
|
|
|
|
|
- inet6_netconf_notify_devconf(net, NETCONFA_PROXY_NEIGH,
|
|
|
+ inet6_netconf_notify_devconf(net, RTM_NEWNETCONF,
|
|
|
+ NETCONFA_PROXY_NEIGH,
|
|
|
idev->dev->ifindex,
|
|
|
&idev->cnf);
|
|
|
}
|
|
@@ -6348,7 +6362,8 @@ static int __addrconf_sysctl_register(struct net *net, char *dev_name,
|
|
|
ifindex = NETCONFA_IFINDEX_DEFAULT;
|
|
|
else
|
|
|
ifindex = idev->dev->ifindex;
|
|
|
- inet6_netconf_notify_devconf(net, NETCONFA_ALL, ifindex, p);
|
|
|
+ inet6_netconf_notify_devconf(net, RTM_NEWNETCONF, NETCONFA_ALL,
|
|
|
+ ifindex, p);
|
|
|
return 0;
|
|
|
|
|
|
free:
|
|
@@ -6357,7 +6372,8 @@ out:
|
|
|
return -ENOBUFS;
|
|
|
}
|
|
|
|
|
|
-static void __addrconf_sysctl_unregister(struct ipv6_devconf *p)
|
|
|
+static void __addrconf_sysctl_unregister(struct net *net,
|
|
|
+ struct ipv6_devconf *p, int ifindex)
|
|
|
{
|
|
|
struct ctl_table *table;
|
|
|
|
|
@@ -6368,6 +6384,8 @@ static void __addrconf_sysctl_unregister(struct ipv6_devconf *p)
|
|
|
unregister_net_sysctl_table(p->sysctl_header);
|
|
|
p->sysctl_header = NULL;
|
|
|
kfree(table);
|
|
|
+
|
|
|
+ inet6_netconf_notify_devconf(net, RTM_DELNETCONF, 0, ifindex, NULL);
|
|
|
}
|
|
|
|
|
|
static int addrconf_sysctl_register(struct inet6_dev *idev)
|
|
@@ -6391,7 +6409,8 @@ static int addrconf_sysctl_register(struct inet6_dev *idev)
|
|
|
|
|
|
static void addrconf_sysctl_unregister(struct inet6_dev *idev)
|
|
|
{
|
|
|
- __addrconf_sysctl_unregister(&idev->cnf);
|
|
|
+ __addrconf_sysctl_unregister(dev_net(idev->dev), &idev->cnf,
|
|
|
+ idev->dev->ifindex);
|
|
|
neigh_sysctl_unregister(idev->nd_parms);
|
|
|
}
|
|
|
|
|
@@ -6434,7 +6453,7 @@ static int __net_init addrconf_init_net(struct net *net)
|
|
|
|
|
|
#ifdef CONFIG_SYSCTL
|
|
|
err_reg_dflt:
|
|
|
- __addrconf_sysctl_unregister(all);
|
|
|
+ __addrconf_sysctl_unregister(net, all, NETCONFA_IFINDEX_ALL);
|
|
|
err_reg_all:
|
|
|
kfree(dflt);
|
|
|
#endif
|
|
@@ -6447,8 +6466,10 @@ err_alloc_all:
|
|
|
static void __net_exit addrconf_exit_net(struct net *net)
|
|
|
{
|
|
|
#ifdef CONFIG_SYSCTL
|
|
|
- __addrconf_sysctl_unregister(net->ipv6.devconf_dflt);
|
|
|
- __addrconf_sysctl_unregister(net->ipv6.devconf_all);
|
|
|
+ __addrconf_sysctl_unregister(net, net->ipv6.devconf_dflt,
|
|
|
+ NETCONFA_IFINDEX_DEFAULT);
|
|
|
+ __addrconf_sysctl_unregister(net, net->ipv6.devconf_all,
|
|
|
+ NETCONFA_IFINDEX_ALL);
|
|
|
#endif
|
|
|
kfree(net->ipv6.devconf_dflt);
|
|
|
kfree(net->ipv6.devconf_all);
|