[comp.unix.ultrix] Finding ethernet interface

hascall@cs.iastate.edu (John Hascall) (05/26/90)

  Pardon me if this question has been recently asked or is a RTFMer, but...

  how do you find the name of the ethernet interface under Ultrix
  (DECstations if that makes a diff)?  I mean *I* know it is "se0",
  but how does a program find out this info?

  Many Thanks,
  John Hascall  /  hascall@atanasoff.cs.iastate.edu  /  gvjph@isuvax.bitnet

mogul@wrl.dec.com (Jeffrey Mogul) (05/30/90)

In article <1723@dino.cs.iastate.edu> hascall@cs.iastate.edu (John Hascall) writes:
>  how do you find the name of the ethernet interface under Ultrix
>  (DECstations if that makes a diff)?  I mean *I* know it is "se0",
>  but how does a program find out this info?

I can't tell exactly what you're asking, so I'll answer several
questions.

(1) If you want to know what interfaces are on your system,
type "netstat -i".

(2) If you want to do this from inside a program, you could try
to figure out how to use the SIOCGIFCONF ioctl.  If you only
have one network interface on your workstation (the common case)
and you ignored the "lo0" entry, this should suffice.

(3) If you have multiple interfaces and you are trying to figure
out the name of the interface associated with a particular socket,
this is pretty tough.  I suspect you would have to start poking
through kernel data structures in /dev/kmem, and I'm sure that
Digital doesn't support this (which is not to say that it can't
be done).

(4) If you are using the packet filter facility in Ultrix 4.0,
you can use the EIOCIFNAME ioctl to get the name of the interface
associated with a packet filter file descriptor.

Most programs don't care what the interface name is.  Some utility
programs allow you to say what interface you are interested in manipulating
(e.g., ifconfig) but this is easier because most of the various SIOCxxx
ioctls expect to be given an interface name by the application.

-Jeff