ports/120625: Bug in ifstat for AMD64

Mike Tancsa mike at sentex.net
Wed Feb 13 22:00:04 UTC 2008


>Number:         120625
>Category:       ports
>Synopsis:       Bug in ifstat for AMD64
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Feb 13 22:00:03 UTC 2008
>Closed-Date:
>Last-Modified:
>Originator:     Mike Tancsa
>Release:        RELENG_7 AMD64
>Organization:
Sentex
>Environment:
FreeBSD ns8.recycle.net 7.0-PRERELEASE FreeBSD 7.0-PRERELEASE #3: Wed Feb 13 11:51:23 EST 2008     mdtancsa at ns8.recycle.net:/usr/obj/usr/src/sys/db  amd64
>Description:
A type error in ifstat prevents it from working on amd64
According to the thread in 

http://lists.freebsd.org/pipermail/freebsd-stable/2008-February/040478.html

The type to the fourth argument to sysctl is wrong
(int) and should be size_t.
>How-To-Repeat:
on a releng_7 box that is AMD64 make and install /usr/ports/net/ifstat and run it


[ns8]# ifstat  -b
ifstat: no interfaces to monitor!
[ns8]#

With the patch, all works as expected.
>Fix:
--- drivers.c.orig	2003-11-21 19:27:51.000000000 -0600
+++ drivers.c	2008-02-13 12:25:14.000000000 -0600
@@ -593,7 +593,8 @@
   int ifcount[] = {
     CTL_NET, PF_LINK, NETLINK_GENERIC, IFMIB_SYSTEM, IFMIB_IFCOUNT
   };
-  int count, size;
+  int count;
+  size_t size;
   
   size = sizeof(count);
   if (sysctl(ifcount, sizeof(ifcount) / sizeof(int), &count, &size, NULL, 0) < 0) {
@@ -607,7 +608,7 @@
   int ifinfo[] = {
     CTL_NET, PF_LINK, NETLINK_GENERIC, IFMIB_IFDATA, index, IFDATA_GENERAL
   };
-  int size = sizeof(*ifmd);
+  size_t size = sizeof(*ifmd);
 
   if (sysctl(ifinfo, sizeof(ifinfo) / sizeof(int), ifmd, &size, NULL, 0) < 0)
     return 0;

>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list