Bug 66905 - [patch] net-mgmt/sdig: add MIB::ifName in results
Summary: [patch] net-mgmt/sdig: add MIB::ifName in results
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Volker Stolz
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-05-19 22:00 UTC by Russell Jackson
Modified: 2004-05-24 08:32 UTC (History)
0 users

See Also:


Attachments
file.diff (1.14 KB, patch)
2004-05-19 22:00 UTC, Russell Jackson
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Russell Jackson 2004-05-19 22:00:40 UTC
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.
Comment 1 Volker Stolz freebsd_committer freebsd_triage 2004-05-23 12:37:02 UTC
Is this patch maybe reverted or something? There's no such thing as 
files/patch-sdig.c in the repository. Maybe a screw-up from the time 
this port was added? Please start out with a fresh checkout of the port 
from the repository.

Cheers,
   Volker
Comment 2 Volker Stolz freebsd_committer freebsd_triage 2004-05-23 12:38:12 UTC
State Changed
From-To: open->feedback

Problems patching. 


Comment 3 Volker Stolz freebsd_committer freebsd_triage 2004-05-23 12:38:12 UTC
Responsible Changed
From-To: freebsd-ports-bugs->vs

Problems patching.
Comment 4 Volker Stolz freebsd_committer freebsd_triage 2004-05-23 13:04:38 UTC
Is this patch maybe reverted or something? There's no such thing as 
files/patch-sdig.c in the repository. Maybe a screw-up from the time 
this port was added? Please start out with a fresh checkout of the port 
from the repository.

Cheers,
   Volker
Comment 5 Russell Jackson 2004-05-23 22:32:21 UTC
On Sun, May 23, 2004 at 02:04:38PM +0200, Volker Stolz wrote:
> Is this patch maybe reverted or something? There's no such thing as 
> files/patch-sdig.c in the repository. Maybe a screw-up from the time 
> this port was added? Please start out with a fresh checkout of the port 
> from the repository.
> 
> Cheers,
>   Volker

Opps! My bad. It is reverted. Here's the corrected patch. Should have
tested it first.

diff -urN sdig/files/patch-sdig.c sdig.new/files/patch-sdig.c
--- sdig/files/patch-sdig.c	Wed Dec 31 16:00:00 1969
+++ sdig.new/files/patch-sdig.c	Sun May 23 14:16:09 2004
@@ -0,0 +1,42 @@
+--- 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);
+ 	}
+ }

-- 
Russell A. Jackson (rjackson@cserv62.csub.edu)
Comment 6 Volker Stolz freebsd_committer freebsd_triage 2004-05-24 08:32:09 UTC
State Changed
From-To: feedback->closed

Committed, thanks!