ports/66905: [patch] add MIB::ifName in results
Russell Jackson
rjackson at cserv62.csub.edu
Wed May 19 21:00:41 UTC 2004
>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 at 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:
More information about the freebsd-ports-bugs
mailing list