get/set ifconfig details

Lowell Gilbert freebsd-questions-local at be-well.ilk.org
Tue Apr 10 19:23:15 UTC 2007


bsenthil <bsenthil at adventnet.com> writes:

> Is there any 'C' method API to get/ set ip address of the interface card.
> Is there any 'C' method API to get ifconfig details of the interface card.
> Is there any 'C' method API to set ifconfig details of the interface card.
>
> I try to get through "sysctl()" ... Is there any c sample code to get
> ifconfig details ....

How about the source code for ifconfig?  [/usr/src/sbin/ifconfig]
It's not simple, because it does a lot of things, but it is the best
example of "ifconfig" type information.

Note that it deals with an IP interface abstraction, not with an
interface card directly.  There can be more (or less) than one address
on an interface.  You need to understand a little better what you are
actually after.


More information about the freebsd-questions mailing list