bug-inetutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: thinking about siocgifconf and friends


From: Marcus Brinkmann
Subject: Re: thinking about siocgifconf and friends
Date: Sat, 13 Jan 2001 19:01:31 +0100
User-agent: Mutt/1.1.4i

On Sat, Jan 13, 2001 at 03:56:08AM +0100, Marcus Brinkmann wrote:
> > > Systems which don't have SIOCGIFINDEX will get either get a dummy index 
> > > number
> > > assigned by libinetutils wrapper, but applications should not display this
> > > to the user if their life span is short. It is only guaranteed to be
> > > constant for the time the task runs, of course.
> > 
> > - I vaguely remember that SIOCGIFCONF only work with Ethernet network
> > meaning if you have PPP, DHCP, the "ppp0" will not show or something
> > can not recall.  But I not certain, it was something I read on the web.
> 
> At least the Linux IP stack reports all devices that are up.

"UP" is not correct. I am not sure which it reports, but for example a dummy
interface without inet address is not included.

> For interfaces
> that are down, those are never reported (also not with the system ifconfig).
> if_nameindex in glibc uses SIOCGIFCONF on linux, so there is no difference
> in the result. I don't know if there are obscure kernel interfaces to get
> more interfaces, but I rather don't want to find out :)

Well, for Linux there exists /proc/net/dev, which lists all interfaces I
think. I have cooked up a scheme where you can eventually extend and
override parts of ifconfig. For example, system specific ${var}
substitutions will be put there. I think I will move some if_nameindex
wrapper in this layer, so code can override the default native if_nameindex
or SIOCGIFCONF based implementation with code that really returns all
interfaces, but is highly system specific (as parsing procfs provided data).

In this system specific file, a default output conversion can be specified,
so ifconfig compiled on linux will look like netkits ifconfig, compiled on
solaris, it will look like solaris ifconfig etc by default. Also, every
system can specify an input conversion that can be used alternatively to the
GNU option parsing. This is possible because all ifconfigs I've seen don't
use options very much, but more like "dummy addr 127.0.0.1" etc style. So
after processing with getopt, I simply pass whatever is left on the command
line to some system specific input parser.

Or maybe do something flexible like the output format:
--command-line-format '${interface} ${addr?}{${addr}${dstaddr?}{${dstaddr}}'
and a hook for system specific ${var} patterns. But I am not convinced this
is very useful.

Thanks,
Marcus

-- 
`Rhubarb is no Egyptian god.' Debian http://www.debian.org address@hidden
Marcus Brinkmann              GNU    http://www.gnu.org    address@hidden
address@hidden
http://www.marcus-brinkmann.de



reply via email to

[Prev in Thread] Current Thread [Next in Thread]