summaryrefslogtreecommitdiffstats
path: root/sys/net/rtsock.c
diff options
context:
space:
mode:
authorbrian <brian@FreeBSD.org>2001-12-19 16:03:27 +0000
committerbrian <brian@FreeBSD.org>2001-12-19 16:03:27 +0000
commit96902e811b5abd11952a379f9d7a7429009007c9 (patch)
tree8e8d5c255bc20d6445398c6d2beb54fc060d8943 /sys/net/rtsock.c
parentba290916ffe5f37275033b2607996798ba2e1a76 (diff)
downloadFreeBSD-src-96902e811b5abd11952a379f9d7a7429009007c9.zip
FreeBSD-src-96902e811b5abd11952a379f9d7a7429009007c9.tar.gz
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
Diffstat (limited to 'sys/net/rtsock.c')
-rw-r--r--sys/net/rtsock.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c
index 84f38d6..2de17fa 100644
--- a/sys/net/rtsock.c
+++ b/sys/net/rtsock.c
@@ -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);
OpenPOWER on IntegriCloud