[prev in list] [next in list] [prev in thread] [next in thread]
List: ethereal-dev
Subject: Re: [ethereal-dev] SNMP dissector
From: Jochen Friedrich <jochen () nwe ! de>
Date: 2000-04-21 14:52:57
[Download RAW message or body]
Hi Guy,
> It currently appears to display the OID 1.3.6.1.2.1 as ":iso" in the
> decode of a GET-NEXT request asking for that object, rather than as,
> say, ".iso.org.dod.internet.mgmt.mib-2", as a version using the UCD SNMP
> library does.
>
> Is there any way to fix that?
The appended patch should fix that one. Additionally, you might have to
add the appended smi.conf to /usr/etc (if you use the RPM) or
/usr/local/etc.
> In addition, are there a significant number of systems that might have
> libsmi 0.1 installed? If so, we should either
>
> 1) make it compile with libsmi 0.1 or 0.2, depending on which is
> installed
I wouldn't mess with 0.1 anymore. I'm not sure if many people did already
install libsmi, at all.
> (Unfortunately, that could still leave problems with binary
> distributions, i.e. if binary distributions are built with one
> particular version, the user won't simply be able to download, install,
> and use them - and, from the mail I see on ethereal-dev and
> ethereal-users, there are people who apparently just want to download
> binaries and have them work; we pretty much see only the cases where
> they don't get what they want, and there may be lots of people who've
> downloaded binary images and had them work, in which case I'd like them
> to continue to be able to do so.)
There is a binary for Red-Hat at
ftp://wacko.gxsnmp.org/pub/RPMS/i386/libsmi-0.2-2.i386.rpm
Some additional MIBs (from Cisco) can be downloaded from
http://www.gxsnmp.org/ciscomib-0.0.1-1.noarch.rpm
However, loading all possible MIBs into ethereal will take some time. But
it's the same with UCD...
Cheers,
Jochen
["packet-snmp.c.diff" (TEXT/PLAIN)]
*** packet-snmp.c.old Fri Apr 21 12:10:26 2000
--- packet-snmp.c Fri Apr 21 13:11:11 2000
***************
*** 729,740 ****
dissect_data(pd, offset, fd, tree);
}
! static void
! format_oid(gchar *buf, subid_t *oid, guint oid_length)
{
! int i;
! int len;
!
len = sprintf(buf, "%lu", (unsigned long)oid[0]);
buf += len;
for (i = 1; i < oid_length;i++) {
--- 729,766 ----
dissect_data(pd, offset, fd, tree);
}
! void
! format_oid_name(subid_t *oid, guint oid_length, char **name, guint name_length,
! SmiNode *node)
{
! SmiNode *child;
! int len, i;
! char *buf;
!
! if (node) {
! if (node->oidlen > 1) {
! child = smiGetParentNode(node);
! name_length += strlen(node->name) +1;
! format_oid_name(oid, oid_length, name, name_length,
! child);
! strcat (*name, ".");
! strcat (*name, node->name);
! return;
! }
! *name = g_malloc(name_length);
! buf = *name;
! len = sprintf(buf, "%lu", (unsigned long)oid[0]);
! buf += len;
! for (i = 1; i < oid_length;i++) {
! len = sprintf(buf, ".%lu", (unsigned long)oid[i]);
! buf += len;
! }
! strcat(*name, " (");
! strcat (*name, node->name);
! return;
! }
! *name = g_malloc(name_length);
! buf = *name;
len = sprintf(buf, "%lu", (unsigned long)oid[0]);
buf += len;
for (i = 1; i < oid_length;i++) {
***************
*** 743,748 ****
--- 769,794 ----
}
}
+ gchar *
+ format_oid(subid_t *oid, guint oid_length, SmiNode* node)
+ {
+ char *result;
+ int len, i;
+ char *buf;
+
+ result = NULL;
+ format_oid_name(oid, oid_length, &result, oid_length * 11 + 5, node);
+ if (node) {
+ buf = result + strlen(result);
+ for (i = node->oidlen; i < oid_length;i++) {
+ len = sprintf(buf, ".%lu", (unsigned long)oid[i]);
+ buf += len;
+ }
+ strcat(result, ")");
+ }
+ return result;
+ }
+
static gchar*
format_var(gushort vb_type, guint8 *vb_octet_string, guint vb_length,
SmiNode *node)
***************
*** 918,926 ****
gchar *vb_display_string;
SmiNode *oid_node;
! SmiModule *oid_module;
! gchar oid_string[MAX_STRING_LEN]; /* TBC */
! gchar vb_oid_string[MAX_STRING_LEN]; /* TBC */
/* parse the type of the object */
start = asn1->pointer;
--- 964,970 ----
gchar *vb_display_string;
SmiNode *oid_node;
! gchar *oid_string;
/* parse the type of the object */
start = asn1->pointer;
***************
*** 988,1005 ****
return ret;
length = asn1->pointer - start;
if (snmp_tree) {
- format_oid(oid_string, vb_oid, vb_oid_length);
oid_node = smiGetNodeByOID(vb_oid_length,
(SmiSubid *)vb_oid);
! if (oid_node) {
! oid_module = smiGetNodeModule(oid_node);
! sprintf(vb_oid_string, " (%s:%s)",
! oid_module->name, oid_node->name);
! } else
! strcpy(vb_oid_string, "");
proto_tree_add_text(snmp_tree, offset, length,
! "Value: %s: %s%s", vb_type_name, oid_string,
! vb_oid_string);
}
g_free(vb_oid);
break;
--- 1032,1044 ----
return ret;
length = asn1->pointer - start;
if (snmp_tree) {
oid_node = smiGetNodeByOID(vb_oid_length,
(SmiSubid *)vb_oid);
! oid_string = format_oid(vb_oid, vb_oid_length,
! oid_node);
proto_tree_add_text(snmp_tree, offset, length,
! "Value: %s: %s", vb_type_name, oid_string);
! g_free(oid_string);
}
g_free(vb_oid);
break;
***************
*** 1065,1071 ****
guint timestamp;
guint timestamp_length;
! gchar oid_string[MAX_STRING_LEN]; /* TBC */
guint variable_bindings_length;
--- 1104,1110 ----
guint timestamp;
guint timestamp_length;
! gchar *oid_string;
guint variable_bindings_length;
***************
*** 1073,1085 ****
guint variable_length;
subid_t *variable_oid;
guint variable_oid_length;
- gchar vb_oid_string[MAX_STRING_LEN]; /* TBC */
int ret;
guint cls, con, tag;
SmiNode *node;
- SmiModule *module;
pdu_type_string = val_to_str(pdu_type, pdu_types,
"Unknown PDU type %#x");
--- 1112,1122 ----
***************
*** 1169,1177 ****
return;
}
if (tree) {
! format_oid(oid_string, enterprise, enterprise_length);
proto_tree_add_text(tree, offset, length,
"Enterprise: %s", oid_string);
}
g_free(enterprise);
offset += length;
--- 1206,1218 ----
return;
}
if (tree) {
! node = smiGetNodeByOID(enterprise_length,
! (SmiSubid *)enterprise);
! oid_string = format_oid(enterprise, enterprise_length,
! node);
proto_tree_add_text(tree, offset, length,
"Enterprise: %s", oid_string);
+ g_free(oid_string);
}
g_free(enterprise);
offset += length;
***************
*** 1310,1326 ****
node = smiGetNodeByOID(variable_oid_length,
(SmiSubid *)variable_oid);
if (tree) {
! format_oid(oid_string, variable_oid,
! variable_oid_length);
! if (node) {
! module = smiGetNodeModule(node);
! sprintf(vb_oid_string, " (%s:%s)",
! module->name, node->name);
! } else
! strcpy(vb_oid_string, "");
proto_tree_add_text(tree, offset, sequence_length,
! "Object identifier %d: %s%s", vb_index,
! oid_string, vb_oid_string);
}
offset += sequence_length;
variable_bindings_length -= sequence_length;
--- 1351,1361 ----
node = smiGetNodeByOID(variable_oid_length,
(SmiSubid *)variable_oid);
if (tree) {
! oid_string = format_oid(variable_oid,
! variable_oid_length, node);
proto_tree_add_text(tree, offset, sequence_length,
! "Object identifier %d: %s", vb_index, oid_string);
! g_free(oid_string);
}
offset += sequence_length;
variable_bindings_length -= sequence_length;
***************
*** 1604,1616 ****
subid_t *regid;
guint regid_length;
! gchar oid_string[MAX_STRING_LEN]; /* TBC */
proto_tree *smux_tree = NULL;
proto_item *item = NULL;
int ret;
guint cls, con;
if (check_col(fd, COL_PROTOCOL))
col_add_str(fd, COL_PROTOCOL, proto_name);
--- 1639,1653 ----
subid_t *regid;
guint regid_length;
! gchar *oid_string;
proto_tree *smux_tree = NULL;
proto_item *item = NULL;
int ret;
guint cls, con;
+ SmiNode *node;
+
if (check_col(fd, COL_PROTOCOL))
col_add_str(fd, COL_PROTOCOL, proto_name);
***************
*** 1664,1672 ****
return;
}
if (tree) {
! format_oid(oid_string, regid, regid_length);
proto_tree_add_text(smux_tree, offset, length,
"Registration: %s", oid_string);
}
g_free(regid);
offset += length;
--- 1701,1712 ----
return;
}
if (tree) {
! node = smiGetNodeByOID(regid_length,
! (SmiSubid *)regid);
! oid_string = format_oid(regid, regid_length, node);
proto_tree_add_text(smux_tree, offset, length,
"Registration: %s", oid_string);
+ g_free(oid_string);
}
g_free(regid);
offset += length;
***************
*** 1745,1753 ****
return;
}
if (tree) {
! format_oid(oid_string, regid, regid_length);
proto_tree_add_text(smux_tree, offset, length,
"Registration: %s", oid_string);
}
g_free(regid);
offset += length;
--- 1785,1796 ----
return;
}
if (tree) {
! node = smiGetNodeByOID(regid_length,
! (SmiSubid *)regid);
! oid_string = format_oid(regid, regid_length, node);
proto_tree_add_text(smux_tree, offset, length,
"Registration: %s", oid_string);
+ g_free(oid_string);
}
g_free(regid);
offset += length;
["smi.conf" (TEXT/PLAIN)]
path /usr/share/mibs/cisco
load ACCOUNTING-CONTROL-MIB
load ADSL-LINE-MIB
load ADSL-TC-MIB
load AGENTX-MIB
load APPC-MIB
load APPLETALK-MIB
load APPLICATION-MIB
load APPN-DLUR-MIB
load APPN-MIB
load APPN-TRAP-MIB
load ATM-ACCOUNTING-INFORMATION-MIB
load ATM-MIB
load ATM-TC-MIB
load BGP4-MIB
load BRIDGE-MIB
load CHARACTER-MIB
load CLNS-MIB
load DECNET-PHIV-MIB
load DIAL-CONTROL-MIB
load DIRECTORY-SERVER-MIB
load DISMAN-SCHEDULE-MIB
load DISMAN-SCRIPT-MIB
load DLSW-MIB
load DNS-RESOLVER-MIB
load DNS-SERVER-MIB
load DOCS-CABLE-DEVICE-MIB
load DOCS-IF-MIB
load DOT12-IF-MIB
load DOT12-RPTR-MIB
load DS0-MIB
load DS0BUNDLE-MIB
load DS1-MIB
load DS3-MIB
load DSA-MIB
load EBN-MIB
load ENTITY-MIB
load ETHER-CHIPSET-MIB
load EtherLike-MIB
load FDDI-SMT73-MIB
load FLOW-METER-MIB
load FRAME-RELAY-DTE-MIB
load FRNETSERV-MIB
load HOST-RESOURCES-MIB
load HPR-IP-MIB
load HPR-MIB
load IF-MIB
load INTEGRATED-SERVICES-GUARANTEED-MIB
load INTEGRATED-SERVICES-MIB
load IP-FORWARD-MIB
load IP-MIB
load IPATM-IPMC-MIB
load IPOA-MIB
load IPV6-ICMP-MIB
load IPV6-MIB
load IPV6-TC
load IPV6-TCP-MIB
load IPV6-UDP-MIB
load ISDN-MIB
load Job-Monitoring-MIB
load MAU-MIB
load MIOX25-MIB
load MIP-MIB
load MTA-MIB
load Modem-MIB
load NETWORK-SERVICES-MIB
load NHRP-MIB
load OSPF-MIB
load OSPF-TRAP-MIB
load P-BRIDGE-MIB
load PARALLEL-MIB
load PPP-BRIDGE-NCP-MIB
load PPP-IP-NCP-MIB
load PPP-LCP-MIB
load PPP-SEC-MIB
load PerfHist-TC-MIB
load Printer-MIB
load Q-BRIDGE-MIB
load RADIUS-ACC-CLIENT-MIB
load RADIUS-ACC-SERVER-MIB
load RADIUS-AUTH-CLIENT-MIB
load RADIUS-AUTH-SERVER-MIB
load RDBMS-MIB
load RFC-1212
load RFC-1213
load RFC-1215
load RFC1155-SMI
load RFC1158-MIB
load RFC1213-MIB
load RFC1269-MIB
load RFC1271-MIB
load RFC1285-MIB
load RFC1316-MIB
load RFC1381-MIB
load RFC1382-MIB
load RFC1414-MIB
load RIPv2-MIB
load RMON-MIB
load RMON2-MIB
load RS-232-MIB
load RSVP-MIB
load SIP-MIB
load SMON-MIB
load SNA-NAU-MIB
load SNA-SDLC-MIB
load SNMP-FRAMEWORK-MIB
load SNMP-MPD-MIB
load SNMP-NOTIFICATION-MIB
load SNMP-PROXY-MIB
load SNMP-REPEATER-MIB
load SNMP-TARGET-MIB
load SNMP-USER-BASED-SM-MIB
load SNMP-VIEW-BASED-ACM-MIB
load SNMPv2-CONF
load SNMPv2-MIB
load SNMPv2-SMI
load SNMPv2-TC
load SNMPv2-TM
load SNMPv2-USEC-MIB
load SONET-MIB
load SOURCE-ROUTING-MIB
load SYSAPPL-MIB
load TCP-MIB
load TCPIPX-MIB
load TN3270E-MIB
load TN3270E-RT-MIB
load TOKEN-RING-RMON-MIB
load TOKENRING-MIB
load TOKENRING-STATION-SR-MIB
load TUNNEL-MIB
load UDP-MIB
load UPS-MIB
load WWW-MIB
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic