Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 18 May 2001 07:39:10 -0400
From:      Clark Gaylord <cgaylord@vt.edu>
To:        vishwanath pargaonkar <vishubp@yahoo.com>
Cc:        freebsd-net@freebsd.org
Subject:   Re: ifindex
Message-ID:  <20010518073910.A74590@e028121.vtacs.vt.edu>
In-Reply-To: <20010518050655.12153.qmail@web5301.mail.yahoo.com>; from vishubp@yahoo.com on Fri, May 18, 2001 at 06:06:55AM %2B0100
References:  <20010518050655.12153.qmail@web5301.mail.yahoo.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, May 18, 2001 at 06:06:55AM +0100, vishwanath pargaonkar wrote:
> why is ifindex used for an interface.i know it is said
> itz for unique identification of device.Can we not do
> that using interfac name ?what is significance of
> ifindex for an interface. itz just a number associated
> with an interface.

You really haven't given enough context to understand where you
want to use ifName rather than ifIndex, but the use of ifIndex is
partly historical and partly practical.  In the original MIB-II
specification, there was no ifName, just ifDescription.  As a
desciptive label, ifName need not be defined on all pollable devices,
so more general SNMP code can be written using ifIndex (which must
exist).  But also the ordinal ifNumber is natural for indexing
arrays, walking tables, looping over indices (for (i=0;i<maxIndex;i++))
(not all languages have a "forall objects of this class" construct),
and other similar advantages.  As far as how to display to a human,
you are absolutely correct that ifName is more interpretable, but
ifNumber has broader functional applicability.

-- 
Clark K. Gaylord
Blacksburg, Virginia USA
cgaylord@vt.edu

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-net" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010518073910.A74590>