diff options
author | 2016-09-08 09:02:42 +0000 | |
---|---|---|
committer | 2016-09-08 09:02:42 +0000 | |
commit | 1d71e6f24e4b1a121f281a3e7a394cdce245b76c (patch) | |
tree | 757ca032379be713546f5bd975faa576eaec2aac | |
parent | Source Joachim Nilsson: (diff) | |
download | wireguard-openbsd-1d71e6f24e4b1a121f281a3e7a394cdce245b76c.tar.xz wireguard-openbsd-1d71e6f24e4b1a121f281a3e7a394cdce245b76c.zip |
If the same address is offered via NA, update the existing ``ifa''
instead of creating a new one.
Having two addresses mean that the old, deprecated one, would be
selected instead of the new one. The issue could be triggered by
reducing the pltime/vltime values sent by a router advertisement
daemon.
Problem reported and fix tested by Jens Sauer on bugs@
-rw-r--r-- | sys/netinet6/nd6_rtr.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/sys/netinet6/nd6_rtr.c b/sys/netinet6/nd6_rtr.c index ec9b0e56916..a7529c9ce2c 100644 --- a/sys/netinet6/nd6_rtr.c +++ b/sys/netinet6/nd6_rtr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nd6_rtr.c,v 1.144 2016/09/02 11:51:07 florian Exp $ */ +/* $OpenBSD: nd6_rtr.c,v 1.145 2016/09/08 09:02:42 mpi Exp $ */ /* $KAME: nd6_rtr.c,v 1.97 2001/02/07 11:09:13 itojun Exp $ */ /* @@ -1972,9 +1972,11 @@ in6_ifadd(struct nd_prefix *pr, int privacy) ifra.ifra_flags |= IN6_IFF_AUTOCONF|IN6_IFF_TENTATIVE; - /* allocate ifaddr structure, link into chain, etc. */ + /* If this address already exists, update it. */ + ia6 = in6ifa_ifpwithaddr(ifp, &ifra.ifra_addr.sin6_addr); + s = splsoftnet(); - error = in6_update_ifa(ifp, &ifra, NULL); + error = in6_update_ifa(ifp, &ifra, ia6); splx(s); if (error != 0) { |