Update of /cvsroot/sdig/sdig
In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv15651
Modified Files:
Tag: STABLE
sdig.c
Log Message:
Print out the interface index along with the internal port number
Index: sdig.c
===================================================================
RCS file: /cvsroot/sdig/sdig/Attic/sdig.c,v
retrieving revision 1.3
retrieving revision 1.3.4.1
diff -C2 -d -r1.3 -r1.3.4.1
*** sdig.c 11 Apr 2005 08:57:08 -0000 1.3
--- sdig.c 8 Sep 2006 18:20:16 -0000 1.3.4.1
***************
*** 428,453 ****
{
char query[256], *ifdescr, *ifname;
! long ifnum;
! /* first get the switch's ifnum for the port */
snprintf(query, sizeof(query), "SNMPv2-SMI::mib-2.17.1.4.1.2.%ld", port);
! ifnum = snmpget_int(sw->ip, sw->pw, query);
! if (ifnum == -1)
return;
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);
--- 428,455 ----
{
char query[256], *ifdescr, *ifname;
! long ifidx;
! /* first get the switch's ifidx for the port */
snprintf(query, sizeof(query), "SNMPv2-SMI::mib-2.17.1.4.1.2.%ld", port);
! ifidx = snmpget_int(sw->ip, sw->pw, query);
! if (ifidx == -1)
return;
+ else
+ printf("/%d", ifidx);
snprintf(query, sizeof(query), "IF-MIB::ifName.%ld",
! ifidx);
ifname = snmpget_str(sw->ip, sw->pw, query);
if (!ifname) {
! snprintf(query, sizeof(query), "IF-MIB::ifAlias.%ld", ifidx);
snmpget_str(sw->ip, sw->pw, query);
}
snprintf(query, sizeof(query), "IF-MIB::ifDescr.%ld",
! ifidx);
ifdescr = snmpget_str(sw->ip, sw->pw, query);
|