ioctl call for adding physical interface

  • Follow


Hi,

In solaris we add interface using

# ifconfig bge1 plumb

if I want to do it with c prgram using ioctl call . which is the exact
ioctl call for doing bove things..?
also if I use

int num=999;
  ioctl(sockfd,SIOCGIFNUM,&num);
                  printf("%d \n",num);
it is not counting interfaces which are there but not installed..

any help is welcome

Rahul

0
Reply rahul.ruikar (25) 11/30/2005 8:07:44 AM

rahul.ruikar@gmail.com writes:
> In solaris we add interface using
> 
> # ifconfig bge1 plumb
> 
> if I want to do it with c prgram using ioctl call . which is the exact
> ioctl call for doing bove things..?

It's not just one call.  See if_tcp(7P) for details.

You'll need to deal with both styles of DLPI and know when to push
'arp' on a separate stream.

One of the undocumented features here is that ifconfig uses I_PLINK
with /dev/udp to plumb up the interfaces.  If you want to be
compatible with ifconfig, you need to do that.

Another thing you can do is run truss on ifconfig and examine the
output for clues.

(Why do you want to do this?  Is execing 'ifconfig' itself not an
option?)

> also if I use

> int num=999;
>   ioctl(sockfd,SIOCGIFNUM,&num);
>                   printf("%d \n",num);
> it is not counting interfaces which are there but not installed..

Right.  That just tells you how many are plumbed, not how many drivers
are present.  That's because Solaris uses DLPI.

If you need to look for drivers, you'll need to walk the device node
tree (see libdevinfo(3LIB)) and find the network devices.  This won't
give you a complete picture (some network drivers are actually pseudo
devices and DLPI Style 2 can sometimes complicate things), but it's
pretty good.  This is how "ifconfig -a plumb" works.

-- 
James Carlson, KISS Network                    <james.d.carlson@sun.com>
Sun Microsystems / 1 Network Drive         71.232W   Vox +1 781 442 2084
MS UBUR02-212 / Burlington MA 01803-2757   42.496N   Fax +1 781 442 1677
0
Reply James 11/30/2005 3:46:38 PM


1 Replies
148 Views

(page loaded in 0.481 seconds)


Reply: