Here we go. Two "diff -c" below. They fix:
1) 'if (strcmp(saveName, "ip") == 0)'
Now put back into the original "#ifdef sunV3" (and only that).
2) The whole notion of (ifnet *)->if_unit is removed.
The entire interface name is now in (ifnet *)->if_name.
As a side effect this makes 1) rather useless.
To make changes visible they're within "#ifdef OLD_if_unit" (in fact
the entire "#ifdef OLD_if_unit" change just removes code).
Gunnar Lindberg
*** ./agent/mibgroup/mibII/interfaces.h.ORIG Fri Nov 5 22:08:11 2004
--- ./agent/mibgroup/mibII/interfaces.h Fri Jun 10 08:13:39 2005
***************
*** 75,81 ****
--- 75,85 ----
struct ifnet {
char *if_name; /* name, e.g. ``en'' or ``lo'' */
+ #ifdef OLD_if_unit
+ /* if_unit no longer in use */
+ /* entire name into if_name */
char *if_unit; /* sub-unit for lower level driver */
+ #endif /* OLD_if_unit */
short if_mtu; /* maximum transmission unit */
short if_flags; /* up/down, broadcast, etc. */
int if_metric; /* routing metric (external only) */
*** ./agent/mibgroup/mibII/interfaces.c.ORIG Mon Jan 3 16:51:32 2005
--- ./agent/mibgroup/mibII/interfaces.c Fri Jun 10 08:30:35 2005
***************
*** 1443,1449 ****
--- 1443,1451 ----
struct ifnet *old = ifnetaddr_list;
ifnetaddr_list = ifnetaddr_list->if_next;
free(old->if_name);
+ #ifdef OLD_if_unit
free(old->if_unit);
+ #endif /* OLD_if_unit */
free(old);
}
***************
*** 1574,1583 ****
--- 1576,1588 ----
* set name and interface# :
*/
nnew->if_name = (char *) strdup(ifname);
+ #ifdef OLD_if_unit
+ /* this fails for e.g. "ip6tnl0" */
for (ptr = nnew->if_name; *ptr && (*ptr < '0' || *ptr > '9');
ptr++);
nnew->if_unit = strdup(*ptr ? ptr : "");
*ptr = 0;
+ #endif /* OLD_if_unit */
strncpy(ifrq.ifr_name, ifname, sizeof(ifrq.ifr_name));
ifrq.ifr_name[ sizeof(ifrq.ifr_name)-1 ] = 0;
***************
*** 1755,1775 ****
--- 1760,1794 ----
ifnet = *ifnetaddr;
strncpy(saveName, ifnet.if_name, sizeof(saveName));
#endif
+ #ifndef linux
+ /*
+ * This code has been around at least since cmu-snmp-linux 3.5
+ * but than only for "#ifdef sunV3" (pre-linux time :-).
+ * It's been discussed on the <net-snmp-coders> list but noone
+ * can really tell what was intended for. We decided to keep
+ * it just in case, although "#ifndef linux" and understanding
+ * that later changes will make it non-operational anyway
+ * (no ifnet.if_unit, the entire interface name goes into
+ * ifnet.if_name)
+ */
if (strcmp(saveName, "ip") == 0) {
ifnetaddr = ifnet.if_next;
continue;
}
+ #endif /* !linux */
saveName[sizeof(saveName) - 1] = '\0';
cp = (char *) strchr(saveName, '\0');
+ #ifdef OLD_if_unit
#ifdef linux
strncat(cp, ifnet.if_unit, sizeof(saveName)-strlen(saveName)-1);
saveName[sizeof(saveName) - 1] = '\0';
#else
string_append_int(cp, ifnet.if_unit);
#endif
+ #endif /* OLD_if_unit */
if (1 || strcmp(saveName, "lo0") != 0) { /* XXX */
if (Index)
***************
*** 1879,1885 ****
--- 1898,1906 ----
saveName[sizeof(saveName) - 1] = '\0';
cp = strchr(saveName, '\0');
+ #ifdef OLD_if_unit
string_append_int(cp, ifnet.if_unit);
+ #endif /* OLD_if_unit */
#endif
if (1 || strcmp(saveName, "lo0") != 0) { /* XXX */
/*
-------------------------------------------------------
This SF.Net email is sponsored by: NEC IT Guy Games. How far can you shotput
a projector? How fast can you ride your desk chair down the office luge track?
If you want to score the big prize, get to know the little guy.
Play to win an NEC 61" plasma display: http://www.necitguy.com/?r
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders