Date: Tue, 5 Nov 2013 17:12:07 GMT From: Hiroshi Yamashita <piro77@gmail.com> To: freebsd-gnats-submit@FreeBSD.org Subject: misc/183687: route add -net 172.20 add wrong host address Message-ID: <201311051712.rA5HC7la095709@oldred.freebsd.org> Resent-Message-ID: <201311051720.rA5HK0s9073735@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 183687
>Category: misc
>Synopsis: route add -net 172.20 add wrong host address
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Tue Nov 05 17:20:00 UTC 2013
>Closed-Date:
>Last-Modified:
>Originator: Hiroshi Yamashita
>Release: 9.2
>Organization:
>Environment:
FreeBSD fsrv1 9.2-RELEASE FreeBSD 9.2-RELEASE #0 r255898: Thu Sep 26 22:50:31 UTC 2013 root@bake.isc.freebsd.org:/usr/obj/usr/src/sys/GENERIC amd64
>Description:
route add -net 172.20 add wrong host address
fsrv1# route add -net 172.20 192.168.1.80
add net 172.20: gateway 192.168.1.80
fsrv1#netstat -rn
Internet:
Destination Gateway Flags Refs Use Netif Expire
172.0.0.20 192.168.1.80 UGS 0 0 em0
another host 8.4-RELEASE
root@pt2# route add -net 172.20 192.168.1.80
add net 172.20: gateway 192.168.1.80
root@pt2# netstat -rn
Routing tables
Internet:
Destination Gateway Flags Refs Use Netif Expire
172.20.0.0/16 192.168.1.80 UGS 0 0 re0
root@pt2# uname -a
FreeBSD pt2 8.4-RELEASE-p2 FreeBSD 8.4-RELEASE-p2 #9: Sun Jul 28 02:00:51 JST 2013 piro@pt2:/
>How-To-Repeat:
always in 9.2-RELEASE
>Fix:
diff --git a/route.c b/route.c
index 3549e1a..21ff963 100644
--- a/route.c
+++ b/route.c
@@ -1244,7 +1244,7 @@ getaddr(int which, char *str, struct hostent **hpp, int nrflags)
*/
switch (which) {
case RTA_DST:
- forcenet++;
+ nrflags |= F_FORCENET;
#if 0
bzero(su, sizeof(*su)); /* for readability */
#endif
@@ -1333,7 +1333,7 @@ getaddr(int which, char *str, struct hostent **hpp, int nrflags)
}
*q = '/';
}
- if ((which != RTA_DST || forcenet == 0) &&
+ if ((which != RTA_DST || !(nrflags & F_FORCENET)) &&
inet_aton(str, &su->sin.sin_addr)) {
val = su->sin.sin_addr.s_addr;
if (which != RTA_DST || forcehost ||
~
>Release-Note:
>Audit-Trail:
>Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201311051712.rA5HC7la095709>
