* [PATCH] ipv6: add knob to send unsolicited ND on link-layer address change
@ 2012-11-07 2:46 Hannes Frederic Sowa
2012-11-09 13:01 ` Hannes Frederic Sowa
2012-11-13 19:29 ` David Miller
0 siblings, 2 replies; 4+ messages in thread
From: Hannes Frederic Sowa @ 2012-11-07 2:46 UTC (permalink / raw)
To: netdev
This patch introduces a new knob ndisc_notify. If enabled, the kernel
will transmit an unsolicited neighbour advertisement on link-layer address
change to update the neighbour tables of the corresponding hosts more quickly.
This is the equivalent to arp_notify in ipv4 world.
Signed-off-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
---
include/linux/ipv6.h | 1 +
include/uapi/linux/ipv6.h | 1 +
net/ipv6/addrconf.c | 9 +++++++++
net/ipv6/ndisc.c | 7 +++++++
4 files changed, 18 insertions(+)
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index bcba48a..5e11905 100644
--- a/include/linux/ipv6.h
+++ b/include/linux/ipv6.h
@@ -47,6 +47,7 @@ struct ipv6_devconf {
__s32 disable_ipv6;
__s32 accept_dad;
__s32 force_tllao;
+ __s32 ndisc_notify;
void *sysctl;
};
diff --git a/include/uapi/linux/ipv6.h b/include/uapi/linux/ipv6.h
index a6d7d1c..5a2991c 100644
--- a/include/uapi/linux/ipv6.h
+++ b/include/uapi/linux/ipv6.h
@@ -157,6 +157,7 @@ enum {
DEVCONF_DISABLE_IPV6,
DEVCONF_ACCEPT_DAD,
DEVCONF_FORCE_TLLAO,
+ DEVCONF_NDISC_NOTIFY,
DEVCONF_MAX
};
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 0424e4e..e3df4fa 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -3892,6 +3892,7 @@ static inline void ipv6_store_devconf(struct ipv6_devconf *cnf,
array[DEVCONF_DISABLE_IPV6] = cnf->disable_ipv6;
array[DEVCONF_ACCEPT_DAD] = cnf->accept_dad;
array[DEVCONF_FORCE_TLLAO] = cnf->force_tllao;
+ array[DEVCONF_NDISC_NOTIFY] = cnf->ndisc_notify;
}
static inline size_t inet6_ifla6_size(void)
@@ -4560,6 +4561,14 @@ static struct addrconf_sysctl_table
.proc_handler = proc_dointvec
},
{
+ .procname = "ndisc_notify",
+ .data = &ipv6_devconf.ndisc_notify,
+ .maxlen = sizeof(int),
+ .mode = 0644,
+ .proc_handler = proc_dointvec
+
+ },
+ {
/* sentinel */
}
},
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
index ff36194..66d5401 100644
--- a/net/ipv6/ndisc.c
+++ b/net/ipv6/ndisc.c
@@ -1575,11 +1575,18 @@ static int ndisc_netdev_event(struct notifier_block *this, unsigned long event,
{
struct net_device *dev = ptr;
struct net *net = dev_net(dev);
+ struct inet6_dev *idev;
switch (event) {
case NETDEV_CHANGEADDR:
neigh_changeaddr(&nd_tbl, dev);
fib6_run_gc(~0UL, net);
+ idev = in6_dev_get(dev);
+ if (!idev)
+ break;
+ if (idev->cnf.ndisc_notify)
+ ndisc_send_unsol_na(dev);
+ in6_dev_put(idev);
break;
case NETDEV_DOWN:
neigh_ifdown(&nd_tbl, dev);
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] ipv6: add knob to send unsolicited ND on link-layer address change
2012-11-07 2:46 [PATCH] ipv6: add knob to send unsolicited ND on link-layer address change Hannes Frederic Sowa
@ 2012-11-09 13:01 ` Hannes Frederic Sowa
2012-11-09 21:22 ` David Miller
2012-11-13 19:29 ` David Miller
1 sibling, 1 reply; 4+ messages in thread
From: Hannes Frederic Sowa @ 2012-11-09 13:01 UTC (permalink / raw)
To: netdev
On Wed, Nov 07, 2012 at 03:46:20AM +0100, Hannes Frederic Sowa wrote:
> This patch introduces a new knob ndisc_notify. If enabled, the kernel
> will transmit an unsolicited neighbour advertisement on link-layer address
> change to update the neighbour tables of the corresponding hosts more quickly.
>
> This is the equivalent to arp_notify in ipv4 world.
If this eases review, I have a test script to demonstrate the behaviour
(this needs the patch to change the mac address of a running veth, which was
merged into net-next some time ago and does only work correctly if unsolicited
neighbour advertisments are send to all-nodes):
#!/bin/bash
set -ex
set -o pipefail
declare -r NETNS=2337 R=$RANDOM
declare -r ULAM="fd8b:abf9:283d:1::/64" ULAM_ADDR="fd8b:abf9:283d:1::1/64"
declare -r ULAS="fd8b:abf9:283d:2::/64" ULAS_ADDR="fd8b:abf9:283d:2::1/64"
declare -r NS="ip netns exec $NETNS"
declare -r NMACM=00:00:6c:55:56:9e NMACS=00:00:6c:55:56:9e
function enable_forward {
declare -r F="sysctl -w net.ipv6.conf.all.forwarding=1"
$F
$NS $F
}
function fetch_gw {
echo "ip -6 -o a l group $NETNS dev $1 scope link
| awk '{print \$4}'"
}
case $1 in
clean)
ip netns delete $NETNS || true # ignore errors
# seems to be racy here because deconstruction happens in a workqueue
sleep 1
for i in $(ip -o l l group $NETNS|cut -f2 -d:|egrep 'vmeth|dummy'); do
ip l d $i || true
done
;;
'')
declare -r vmeth=vmeth$R vseth=vseth$R
echo 'file net/ipv6/ndisc.c +pflmt' > /sys/kernel/debug/dynamic_debug/control
ip netns add $NETNS
enable_forward
ip link add name $vmeth type veth peer name $vseth
ip link set dev $vmeth group $NETNS up
ip link set dev $vseth netns $NETNS
$NS ip link set dev $vseth group $NETNS up
$NS ip l a name dummy$R up type dummy
$NS ip l set dev dummy$R group $NETNS up
ip a a $ULAM_ADDR dev $vmeth
$NS ip a a $ULAS_ADDR dev dummy$R
declare -r GWS=$(eval $NS $(fetch_gw $vseth))
declare -r GWM=$(eval $(fetch_gw $vmeth))
ip -6 r a $ULAS via ${GWS%/64} dev $vmeth
$NS ip -6 r a $ULAM via ${GWM%/64} dev $vseth
sleep 5
time ping6 -w 100 -c 1 ${ULAS_ADDR%/64}
# perf probes
$0 internal $vmeth
;;
internal)
sleep 5
ip l set dev $2 addr $NMACM
sleep 5
time ping6 -w 100 -c 1 ${ULAS_ADDR%/64}
;;
esac
David, if you intend to merge this patch, could you please remove the empty
line I accidently added in the addrconf_sysctl_table, directly following
.proc_handler? As usual, I noticed it just after sending the patch.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ipv6: add knob to send unsolicited ND on link-layer address change
2012-11-09 13:01 ` Hannes Frederic Sowa
@ 2012-11-09 21:22 ` David Miller
0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2012-11-09 21:22 UTC (permalink / raw)
To: hannes; +Cc: netdev
From: Hannes Frederic Sowa <hannes@stressinduktion.org>
Date: Fri, 9 Nov 2012 14:01:41 +0100
> David, if you intend to merge this patch, could you please remove the empty
> line I accidently added in the addrconf_sysctl_table, directly following
> .proc_handler? As usual, I noticed it just after sending the patch.
I intend to eventually apply this to net-next, and I'll take care
of the empty line when I do so, thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ipv6: add knob to send unsolicited ND on link-layer address change
2012-11-07 2:46 [PATCH] ipv6: add knob to send unsolicited ND on link-layer address change Hannes Frederic Sowa
2012-11-09 13:01 ` Hannes Frederic Sowa
@ 2012-11-13 19:29 ` David Miller
1 sibling, 0 replies; 4+ messages in thread
From: David Miller @ 2012-11-13 19:29 UTC (permalink / raw)
To: hannes; +Cc: netdev
From: Hannes Frederic Sowa <hannes@stressinduktion.org>
Date: Wed, 7 Nov 2012 03:46:20 +0100
> This patch introduces a new knob ndisc_notify. If enabled, the kernel
> will transmit an unsolicited neighbour advertisement on link-layer address
> change to update the neighbour tables of the corresponding hosts more quickly.
>
> This is the equivalent to arp_notify in ipv4 world.
>
> Signed-off-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Applied to net-next, with the empty line removed.
Thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-11-13 19:29 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-07 2:46 [PATCH] ipv6: add knob to send unsolicited ND on link-layer address change Hannes Frederic Sowa
2012-11-09 13:01 ` Hannes Frederic Sowa
2012-11-09 21:22 ` David Miller
2012-11-13 19:29 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).