Date: Wed, 13 Feb 2008 21:52:02 GMT From: Mike Tancsa <mike@sentex.net> To: freebsd-gnats-submit@FreeBSD.org Subject: ports/120625: Bug in ifstat for AMD64 Message-ID: <200802132152.m1DLq2fY083035@www.freebsd.org> Resent-Message-ID: <200802132200.m1DM03nw002211@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>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@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:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200802132152.m1DLq2fY083035>