Date: Wed, 19 May 2004 13:51:33 -0700 (PDT) From: Russell Jackson <rjackson@cserv62.csub.edu> To: FreeBSD-gnats-submit@FreeBSD.org Subject: ports/66905: [patch] add MIB::ifName in results Message-ID: <200405192051.i4JKpXNR048265@cserv62.csub.edu> Resent-Message-ID: <200405192100.i4JL0eR1080758@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 66905 >Category: ports >Synopsis: [patch] add MIB::ifName in results >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Wed May 19 14:00:40 PDT 2004 >Closed-Date: >Last-Modified: >Originator: Russell Jackson >Release: FreeBSD 4.9-STABLE i386 >Organization: >Environment: System: FreeBSD cserv62.csub.edu 4.9-STABLE FreeBSD 4.9-STABLE #0: Mon Dec 15 16:35:36 PST 2003 rjackson@cserv62.csub.edu:/usr/obj/usr/src/sys/CSERV62 i386 >Description: Some switches do not contain useful data in the MIB::ifDescr field. This patch will allow sdig to report MIB::ifName or MIB::ifAlias in addition to MIB::ifDescr. >How-To-Repeat: >Fix: diff -urN sdig.new/files/patch-sdig.c sdig/files/patch-sdig.c --- sdig.new/files/patch-sdig.c Wed May 19 13:19:06 2004 +++ sdig/files/patch-sdig.c Wed Dec 31 16:00:00 1969 @@ -1,42 +0,0 @@ ---- sdig.c.orig Mon Mar 24 13:08:00 2003 -+++ sdig.c Wed May 19 13:17:43 2004 -@@ -426,7 +426,7 @@ - - static void do_ifdescr(stype *sw, long port) - { -- char query[256], *ifdescr; -+ char query[256], *ifdescr, *ifname; - long ifnum; - - /* first get the switch's ifnum for the port */ -@@ -437,13 +437,28 @@ - if (ifnum == -1) - return; - -- snprintf(query, sizeof(query), "interfaces.ifTable.ifEntry.ifDescr.%ld", -+ snprintf(query, sizeof(query), "IF-MIB::ifName.%ld", -+ ifnum); -+ -+ ifname = snmpget_str(sw->ip, sw->pw, query); -+ -+ if (!ifname) { -+ snprintf(query, sizeof(query), "IF-MIB::ifAlias.%ld", ifnum); -+ snmpget_str(sw->ip, sw->pw, query); -+ } -+ -+ snprintf(query, sizeof(query), "IF-MIB::ifDescr.%ld", - ifnum); - - ifdescr = snmpget_str(sw->ip, sw->pw, query); - -+ if (ifname) { -+ printf(" (%s)", ifname); -+ free(ifname); -+ } -+ - if (ifdescr) { -- printf(" (%s)", ifdescr); -+ printf(" [%s]", ifdescr); - free(ifdescr); - } - } >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200405192051.i4JKpXNR048265>