Hm, there is one piece of code which is likely to depend on whether
or not you split the interface name into x->if_name & x->if_unit:
./agent/mibgroup/mibII/interfaces.c
1733 #if defined(sunV3) || defined(linux)
1734 /*
1735 * ** 4.2 BSD doesn't have ifaddr
1736 * **
1737 */
1738 int
1739 Interface_Scan_Next(short *Index,
1740 char *Name,
1741 struct ifnet *Retifnet, struct in_ifaddr *dummy)
1742 {
1743 struct ifnet ifnet;
1744 register char *cp;
1745
1746 while (ifnetaddr) {
1747 /*
1748 * Get the "ifnet" structure and extract the device name
1749 */
1750 #ifndef linux
1751 klookup((unsigned long) ifnetaddr, (char *) &ifnet, sizeof
ifnet );
1752 klookup((unsigned long) ifnet.if_name, (char *) saveName,
1753 sizeof saveName);
1754 #else
1755 ifnet = *ifnetaddr;
1756 strncpy(saveName, ifnet.if_name, sizeof(saveName));
1757 #endif
-> 1758 if (strcmp(saveName, "ip") == 0) {
-> 1759 ifnetaddr = ifnet.if_next;
-> 1760 continue;
1761 }
Now, I can read what it does and I do recognize the result (ip6tnl0
simply disappears from SNMP, since it's split into <ip><6tnl0>, and
the other interfaces then get their Index screwed up - "off by one")
but I can't even guess what it's suppose to fix and who needs it.
My 0.01c says "delete", but...
Hopefully that's documented in CVS/RCS.
Gunnar
>From [EMAIL PROTECTED] Tue May 31 11:18:45 2005
>Date: Tue, 31 May 2005 11:18:45 +0200 (MEST)
>From: Gunnar Lindberg <[EMAIL PROTECTED]>
>Message-Id: <[EMAIL PROTECTED]>
>To: [EMAIL PROTECTED]
>Subject: Re: Fwd: Linux 2.6 IPv6 interface "ip6tnl0"
>Cc: [email protected]
>In-Reply-To: <[EMAIL PROTECTED]>
>Ah, I see. if_type_from_name();
>I'm not sure how much one should depend on how that code currently
>is written , but as is - strncmp() - it will work just fine with
>if_unit="" and if_name="eth2:3".
>Otherwise, one could use a slightly more complicated split algorithm:
> o Backwards while ['0'-'9'] or ':' or '.'
> o save tail in if_unit (0:23)
> o save head in if_name (ip6tnl)
>This will do for all my examples (eth2:3, eth3.4, ip6tnl0:23); for
>all examples I can think of (which is likely not to be complete :-).
>Are there more characters that should be considered part of if_unit?
> Gunnar
>>From [EMAIL PROTECTED] Tue May 31 10:46:22 2005
>>Subject: Re: Fwd: Linux 2.6 IPv6 interface "ip6tnl0"
>>From: Dave Shield <[EMAIL PROTECTED]>
>>To: Gunnar Lindberg <[EMAIL PROTECTED]>
>>Cc: [email protected]
>>In-Reply-To: <[EMAIL PROTECTED]>
>>References: <[EMAIL PROTECTED]>
>>Organization: University of Liverpool, Computer Science
>>Message-Id: <[EMAIL PROTECTED]>
>>Date: Tue, 31 May 2005 09:47:33 +0100
>>On Tue, 2005-05-31 at 09:13, Gunnar Lindberg wrote:
>>> I guess you code writers can tell why (if) this is a bad idea, but
>>> my 0.01c is to skip the if_unit stuff completely
>>> The only usage of if_unit I find is strncat() and string_append_int()
>>> and both work well with the above.
>>It's not the use of 'if_unit' that's important here - it's the
>>use of 'if_name'. This is used to attempt to identify the type
>>and speed of the interface (search for 'if_type_from_name')
>>I don't think it matters too much where the interface name
>>is split into "base name" and "unit" - they should be spliced
>>back together before being returned anyway.
>>It's more a question of how this handles identifying the
>>type of interface.
>>Dave
-------------------------------------------------------
This SF.Net email is sponsored by Yahoo.
Introducing Yahoo! Search Developer Network - Create apps using Yahoo!
Search APIs Find out how you can build Yahoo! directly into your own
Applications - visit http://developer.yahoo.net/?fr=offad-ysdn-ostg-q22005
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders