misc/183687: route add -net 172.20 add wrong host address
Hiroshi Yamashita
piro77 at gmail.com
Tue Nov 5 17:20:00 UTC 2013
>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 at 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 at pt2# route add -net 172.20 192.168.1.80
add net 172.20: gateway 192.168.1.80
root at 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 at pt2# uname -a
FreeBSD pt2 8.4-RELEASE-p2 FreeBSD 8.4-RELEASE-p2 #9: Sun Jul 28 02:00:51 JST 2013 piro at 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:
More information about the freebsd-bugs
mailing list