Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 3 Jul 2000 11:48:42 +0200 (CEST)
From:      domi@saargate.de
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   bin/19663: gifconfig does not display physical IPv4 addresses
Message-ID:  <200007030948.LAA75500@dominik.saargate.de>

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

>Number:         19663
>Category:       bin
>Synopsis:       gifconfig does not display physical IPv4 addresses
>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:   Mon Jul 03 03:00:01 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator:     Dominik Brettnacher
>Release:        FreeBSD 4.0-STABLE i386
>Organization:
>Environment:

FreeBSD dominik.saargate.de 4.0-STABLE FreeBSD 4.0-STABLE #4: Sun Jun 11 10:12:26 CEST 2000     domi@dominik.saargate.de:/usr/src/sys/compile/DOMINIK  i386

>Description:

	gifconfig(8) does not properly display the physical addresses of
	the tunnel device if they are IPv4 ones (I did not test with IPv6).
	Instead, is displays nothing :)

>How-To-Repeat:

	Just try gifconfig -a or gifconfig <interface>:

	domi@dominik(512):~ $ gifconfig gif0
	gif0: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 1280
		inet 212.88.130.241 --> 212.88.130.240 netmask 0xffffff00 
		physical address  --> 

>Fix:


diff -urN /usr/src/usr.sbin/gifconfig/gifconfig.c gifconfig/gifconfig.c
--- /usr/src/usr.sbin/gifconfig/gifconfig.c	Sun Apr 16 14:47:12 2000
+++ gifconfig/gifconfig.c	Mon Jul  3 11:34:38 2000
@@ -542,11 +542,18 @@
 	psrcaddr[0] = pdstaddr[0] = '\0';
 
 #ifdef INET6
-	srccmd = SIOCGIFPSRCADDR_IN6;
-	dstcmd = SIOCGIFPDSTADDR_IN6;
 	ifrp = (struct ifreq *)&in6_ifr;
+	if (ifrp->ifr_addr.sa_family == AF_INET6) {
+		srccmd = SIOCGIFPSRCADDR_IN6;
+		dstcmd = SIOCGIFPDSTADDR_IN6;
+	}
+	else {
+		srccmd = SIOCGIFPSRCADDR;
+		dstcmd = SIOCGIFPDSTADDR;
+	}
+
 #else /* INET6 */
-	ifrp = ifr;
+	ifrp = (struct ifreq *)&ifr;
 	srccmd = SIOCGIFPSRCADDR;
 	dstcmd = SIOCGIFPDSTADDR;
 #endif /* INET6 */

>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?200007030948.LAA75500>