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

Reply via email to