Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 10 Sep 2000 16:02:08 -0700
From:      Craig Leres <leres@ee.lbl.gov>
To:        FreeBSD-gnats-submit@freebsd.org
Cc:        leres@ee.lbl.gov (Craig Leres)
Subject:   bin/21177: [PATCH] ifinfo dumps core (plus other fixes)
Message-ID:  <200009102302.e8AN29271497@fun.ee.lbl.gov>

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

>Number:         21177
>Category:       bin
>Synopsis:       [PATCH] ifinfo dumps core (plus other fixes)
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sun Sep 10 16:10:01 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator:     Craig Leres
>Release:        FreeBSD 4.1-RELEASE i386
>Organization:
Lawrence Berkeley National Laboratory
>Environment:
>Description:

Ifinfo fails to compile; if you ifdef out the obsolete if_data
struct references and your kerenl has gif(4) interfaces, it dumps
core. It's also missing a few interface descriptions.

>How-To-Repeat:

fun 1182 % ifinfo
[...]
Interface gif0:
	flags: ffff8010
	promiscuous listeners: 0
	send queue length: 0
	send queue max length: 50
	send queue drops: 0
Segmentation fault (core dumped)

>Fix:

Appended is a context diff to tools/tools/ifinfo/ifinfo.c

===================================================================
RCS file: RCS/ifinfo.c,v
retrieving revision 1.1
diff -c -r1.1 ifinfo.c
*** ifinfo.c	2000/09/10 22:44:21	1.1
--- ifinfo.c	2000/09/10 22:51:52
***************
*** 160,168 ****
--- 160,170 ----
  	printf("\tinput queue drops: %lu\n", ifmd->ifmd_data.ifi_iqdrops);
  	printf("\tpackets for unknown protocol: %lu\n", 
  	       ifmd->ifmd_data.ifi_noproto);
+ #ifdef notdef
  	printf("\treceive timing: %lu usec\n", ifmd->ifmd_data.ifi_recvtiming);
  	printf("\ttransmit timing: %lu usec\n", 
  	       ifmd->ifmd_data.ifi_xmittiming);
+ #endif
  }
  
  static const char *const if_types[] = {
***************
*** 220,226 ****
  	"SONETVT",
  	"SMDS InterCarrier Interface",
  	"Proprietary virtual interface",
! 	"Proprietary multiplexing"
  };
  #define	NIFTYPES ((sizeof if_types)/(sizeof if_types[0]))
  
--- 222,231 ----
  	"SONETVT",
  	"SMDS InterCarrier Interface",
  	"Proprietary virtual interface",
! 	"Proprietary multiplexing",
! 	"Generic tunnel interface",
! 	"IPv6-to-IPv4 TCP relay capturing interface",
! 	"6to4 tunnel interface"
  };
  #define	NIFTYPES ((sizeof if_types)/(sizeof if_types[0]))
  
***************
*** 229,235 ****
  {
  	static char buf[256];
  
! 	if (type <= 0 || type > NIFTYPES) {
  		sprintf(buf, "unknown type %d", type);
  		return buf;
  	}
--- 234,240 ----
  {
  	static char buf[256];
  
! 	if (type <= 0 || type >= NIFTYPES) {
  		sprintf(buf, "unknown type %d", type);
  		return buf;
  	}

>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?200009102302.e8AN29271497>