diff options
author | Martin Pieuchot <mpi@cvs.openbsd.org> | 2014-07-12 14:26:01 +0000 |
---|---|---|
committer | Martin Pieuchot <mpi@cvs.openbsd.org> | 2014-07-12 14:26:01 +0000 |
commit | 26321ee6af31acfcd058299c15e1d591171e1786 (patch) | |
tree | 27307b45a2ba39ff0a3aea5de8587f7d33e8944d /sys/netinet | |
parent | 334b89696c122accf39063742c232228fde7cb92 (diff) |
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')
-rw-r--r-- | sys/netinet/if_ether.c | 8 | ||||
-rw-r--r-- | sys/netinet/in.c | 9 |
2 files changed, 12 insertions, 5 deletions
diff --git a/sys/netinet/if_ether.c b/sys/netinet/if_ether.c index 0edf1a9c6de..b3c7b813469 100644 --- a/sys/netinet/if_ether.c +++ b/sys/netinet/if_ether.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ether.c,v 1.129 2014/06/16 19:47:21 mpi Exp $ */ +/* $OpenBSD: if_ether.c,v 1.130 2014/07/12 14:26:00 mpi Exp $ */ /* $NetBSD: if_ether.c,v 1.31 1996/05/11 12:59:58 mycroft Exp $ */ /* @@ -174,7 +174,8 @@ arp_rtrequest(int req, struct rtentry *rt) if ((rt->rt_flags & RTF_HOST) == 0 && rt_mask(rt) && satosin(rt_mask(rt))->sin_addr.s_addr != 0xffffffff) rt->rt_flags |= RTF_CLONING; - if (rt->rt_flags & RTF_CLONING) { + if (rt->rt_flags & RTF_CLONING || + ((rt->rt_flags & RTF_LLINFO) && !la)) { /* * Case 1: This route should come from a route to iface. */ @@ -189,7 +190,8 @@ arp_rtrequest(int req, struct rtentry *rt) * from it do not need their expiration time set. */ rt->rt_expire = time_second; - break; + if ((rt->rt_flags & RTF_CLONING) != 0) + break; } /* Announce a new entry if requested. */ if (rt->rt_flags & RTF_ANNOUNCE) 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); |