Only call rt_getifa() if we've either been passed a gateway or
if we've been given an RTA_IFP or changed RTA_IFA sockaddr. This fixes the following bug: >/dev/tun100 >/dev/tun101 ifconfig tun100 1.2.3.4 5.6.7.8 ifconfig tun101 1.2.3.4 6.7.8.9 route change 6.7.8.9 -ifa 1.2.3.4 -iface -mtu 500 which erroneously changed tun101's host route to have an ifp of tun100 (rt_getifa() sets the ifp after calling ifa_ifwithnet(1.2.3.4)) This incarnation submitted by: ru
This commit is contained in:
parent
3659654b64
commit
ff609dde13
@ -424,8 +424,14 @@ route_output(m, so)
|
||||
/* new gateway could require new ifaddr, ifp;
|
||||
flags may also be different; ifp may be specified
|
||||
by ll sockaddr when protocol address is ambiguous */
|
||||
if ((error = rt_getifa(&info)) != 0)
|
||||
senderr(error);
|
||||
#define equal(a1, a2) (bcmp((caddr_t)(a1), (caddr_t)(a2), (a1)->sa_len) == 0)
|
||||
if ((rt->rt_flags & RTF_GATEWAY && gate != NULL) ||
|
||||
ifpaddr != NULL ||
|
||||
(ifaaddr != NULL &&
|
||||
!equal(ifaaddr, rt->rt_ifa->ifa_addr))) {
|
||||
if ((error = rt_getifa(&info)) != 0)
|
||||
senderr(error);
|
||||
}
|
||||
if (gate != NULL &&
|
||||
(error = rt_setgate(rt, rt_key(rt), gate)) != 0)
|
||||
senderr(error);
|
||||
|
Loading…
Reference in New Issue
Block a user