>Number:         153731
>Category:       misc
>Synopsis:       ifconfig prints trailing whitespace for interfaces that do not 
>have IFF_BROADCAST (like point to point)
>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:   Thu Jan 06 15:40:05 UTC 2011
>Closed-Date:
>Last-Modified:
>Originator:     Nikolay Denev
>Release:        FreeBSD-8-STABLE
>Organization:
>Environment:
FreeBSD zoo.dev 8.2-PRERELEASE FreeBSD 8.2-PRERELEASE #25: Thu Nov 25 10:58:54 
CET 2010     [email protected]:/usr/obj/usr/src/sys/ZOO  amd64
>Description:
When showing configuration for interfaces that do not have IFF_BROADCAST 
enabled, like if_tun, if_gre, etc.
ifconfig prints a trailing whitespace after the netmask.
>How-To-Repeat:
#ifconfig gre0
gre0: flags=b151<UP,POINTOPOINT,RUNNING,PROMISC,LINK0,LINK1,MULTICAST> metric 0 
mtu 1476
        tunnel inet x.x.x.x --> y.y.y.y
        inet a.a.a.a --> b.b.b.b netmask 0xfffffffc <- Trailing whitespace 
here! :)
#
>Fix:
Apply attached patch.

Patch attached with submission follows:

--- sbin/ifconfig/af_inet.c.orig        2011-01-06 16:14:36.682832713 +0100
+++ sbin/ifconfig/af_inet.c     2011-01-06 16:15:24.041648987 +0100
@@ -79,12 +79,12 @@
        sin = (struct sockaddr_in *)ifa->ifa_netmask;
        if (sin == NULL)
                sin = &null_sin;
-       printf("netmask 0x%lx ", (unsigned long)ntohl(sin->sin_addr.s_addr));
+       printf("netmask 0x%lx", (unsigned long)ntohl(sin->sin_addr.s_addr));
 
        if (ifa->ifa_flags & IFF_BROADCAST) {
                sin = (struct sockaddr_in *)ifa->ifa_broadaddr;
                if (sin != NULL && sin->sin_addr.s_addr != 0)
-                       printf("broadcast %s", inet_ntoa(sin->sin_addr));
+                       printf(" broadcast %s", inet_ntoa(sin->sin_addr));
        }
        putchar('\n');
 }


>Release-Note:
>Audit-Trail:
>Unformatted:
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to "[email protected]"

Reply via email to