Solaris: ifconfig programming interface?

I am looking for a programming interface to the Solaris ifconfig (1M) command .

Obviously, Linux has the getifaddrs (3) command , but as far as I can tell, this has not been ported to Solaris .

Without trying to use the code to the link above , is there a way to determine ifconfig (1M) - data of type (network interface, status, etc.) without formatting the system command and parsing the output ?

+3
source share
3 answers

getifaddrs () has recently been integrated into source code for future releases of OpenSolaris and Solaris, but this does not help your code run current versions:

Until then, you will need to use SIOCGLIFCONFioctls, in which you will find many examples from open source, including the link that you posted.

+2
source

I have an implementation here, only IPv4-based SIOCGIFCONF ioctl()and agnostic versions of the IP family, using SIOCGLIFCONF:

http://code.google.com/p/openpgm/source/browse/trunk/openpgm/pgm/getifaddrs.c

Tested with SPARC / Solaris 10 and x86 / OpenSolaris 2008.11 and 2009.06 licenses, LGPL 2.1.

+2
source

ioctl;)

See if (7P) .

0
source

Source: https://habr.com/ru/post/1741498/


All Articles