Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 20 Sep 2002 12:03:39 -0700 (PDT)
From:      pavel@networkphysics.com
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   bin/43139: /sbin/route -host option doesn't always suffice
Message-ID:  <200209201903.g8KJ3di37362@gt500.fractal.networkphysics.com>

next in thread | raw e-mail | index | archive | help

>Number:         43139
>Category:       bin
>Synopsis:       /sbin/route -host option doesn't always suffice
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Sep 20 12:10:02 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Tom Pavel
>Release:        FreeBSD 4.2-RELEASE i386
>Organization:
Network Physics
>Environment:

	This bug is present even in 4.7 and -current, from what I read
	in the sources.

>Description:

	The /sbin/route command tries to be clever about guessing
	whether arguments are hosts or nets.  It uses Class A/B/C
	prefixes as heuristics for this.  Much of this is for
	backwards compatibility.

	Nowadays, CIDR addressing is widespread.  With local netmasks
	that are more than 8 bits, it is quite possible to end up with
	addresses that fail the heuristics.  Therefore, the route
	command provides -net and -host options to force the decision.
	Unfortunately, the -host option does not succeed in the case
	of an address like A.B.C.0, where A is in the Class C space.

>How-To-Repeat:

	transam2[269] # route -n get -host 203.2.3.0
	route: writing to routing socket: No such process

>Fix:

Index: route.c
===================================================================
RCS file: /u1/Repo/FreeBSD/sbin/route/route.c,v
retrieving revision 1.5.4.1
diff -u -r1.5.4.1 route.c
--- route.c     2002/08/08 20:06:33     1.5.4.1
+++ route.c     2002/09/20 18:45:57
@@ -1002,7 +1002,7 @@
        if ((which != RTA_DST || forcenet == 0) &&
            (val = inet_addr(s)) != INADDR_NONE) {
                su->sin.sin_addr.s_addr = val;
-               if (which != RTA_DST ||
+               if (which != RTA_DST || forcehost ||
                    inet_lnaof(su->sin.sin_addr) != INADDR_ANY)
                        return (1);
                else {
>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200209201903.g8KJ3di37362>