summaryrefslogtreecommitdiffstats
path: root/sys/netinet/in.c
diff options
context:
space:
mode:
authormpi <mpi@openbsd.org>2014-07-12 14:26:00 +0000
committermpi <mpi@openbsd.org>2014-07-12 14:26:00 +0000
commitcaa91aed3aa51e540acc1295cfef16151062fd3c (patch)
treec21cf5bcddb3a68772aa19ba9261f5ceae7c9d4b /sys/netinet/in.c
parentremove ifdef'd out valleyview/baytrail device lists (diff)
downloadwireguard-openbsd-caa91aed3aa51e540acc1295cfef16151062fd3c.tar.xz
wireguard-openbsd-caa91aed3aa51e540acc1295cfef16151062fd3c.zip
Always create a local route for every configured IPv4 address on the
machine and restore the original behavior of RTM_ADD and RTM_DELETE by always generating one message per locally configured address. This time, make sure the local route is removed during an address change, since at least pppoe(4) do some funky magics with wildcard addresses that might corrupt the routing tree, as found by naddy@ Also do not add a local route if the specified address is 0.0.0.0, to prevent a tree corruption, as found by guenther@. Putting this in now so that it gets tested, claudio@ agrees. Please contact me if you find any route-related regression caused by this change.
Diffstat (limited to 'sys/netinet/in.c')
-rw-r--r--sys/netinet/in.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/sys/netinet/in.c b/sys/netinet/in.c
index 425b408c376..70e1a8d4e67 100644
--- a/sys/netinet/in.c
+++ b/sys/netinet/in.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: in.c,v 1.99 2014/06/26 13:08:25 mpi Exp $ */
+/* $OpenBSD: in.c,v 1.100 2014/07/12 14:26:00 mpi Exp $ */
/* $NetBSD: in.c,v 1.26 1996/02/13 23:41:39 christos Exp $ */
/*
@@ -619,8 +619,10 @@ in_ifinit(struct ifnet *ifp, struct in_ifaddr *ia, struct sockaddr_in *sin,
* Always remove the address from the tree to make sure its
* position gets updated in case the key changes.
*/
- if (!newaddr)
+ if (!newaddr) {
+ rt_ifa_delloop(&ia->ia_ifa);
ifa_del(ifp, &ia->ia_ifa);
+ }
oldaddr = ia->ia_addr;
ia->ia_addr = *sin;
@@ -702,6 +704,7 @@ out:
* carp(4).
*/
ifa_add(ifp, &ia->ia_ifa);
+ rt_ifa_addloop(&ia->ia_ifa);
if (error && newaddr)
in_purgeaddr(&ia->ia_ifa);
@@ -719,7 +722,9 @@ in_purgeaddr(struct ifaddr *ifa)
in_ifscrub(ifp, ia);
+ rt_ifa_delloop(&ia->ia_ifa);
ifa_del(ifp, &ia->ia_ifa);
+
TAILQ_REMOVE(&in_ifaddr, ia, ia_list);
if (ia->ia_allhosts != NULL) {
in_delmulti(ia->ia_allhosts);