Re: get/set ifconfig entries through by programmatically

2007-06-01 Thread John E Hein
bsenthil wrote at 01:46 +0530 on Jun  2, 2007:
 > Is it possible to get/set  ifconfig entries through by programmatically. 
 > If yes, please send me the code snippet ...
 > 
 > I am trying to get/set ipaddress by executing the command "ifconfig" .

- use SIOCAIFADDR ioctl; man netintro(4)
- see source code in /usr/src/sbin/ifconfig
- the hacky approach using system(3): system("ifconfig fxp0 1.2.3.4/24");

[cross-post to [EMAIL PROTECTED] removed]
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: get/set ifconfig entries through by programmatically

2007-06-01 Thread M. Warner Losh
In message: <[EMAIL PROTECTED]>
bsenthil <[EMAIL PROTECTED]> writes:
: Is it possible to get/set  ifconfig entries through by programmatically. 
: If yes, please send me the code snippet ...
: 
: I am trying to get/set ipaddress by executing the command "ifconfig" .

To get the addresses, use the ifconfig-in-a-box interface
getifaddrs(3).  To set the address, you'll need to use the functions
described in networking(4), specifically the SIOCAIFADDR and
SIOCDIFADDR ioctls.

Warner
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


get/set ifconfig entries through by programmatically

2007-06-01 Thread bsenthil
Is it possible to get/set  ifconfig entries through by programmatically. 
If yes, please send me the code snippet ...


I am trying to get/set ipaddress by executing the command "ifconfig" .
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"