getifaddrs man page on SmartOS

Man page or keyword search:  
man Server   16655 pages
apropos Keyword Search (all sections)
Output format
SmartOS logo
[printable version]

GETIFADDRS(3SOCKET)					   GETIFADDRS(3SOCKET)

NAME
       getifaddrs, freeifaddrs - get interface addresses

SYNOPSIS
       cc [ flag ... ] file ... -lsocket -lnsl [ library ... ]
       #include <sys/types.h>
       #include <sys/socket.h>
       #include <ifaddrs.h>

       int getifaddrs(struct ifaddrs **ifap);

       void freeifaddrs(struct ifaddrs *ifp);

DESCRIPTION
       The  getifaddrs() function is used to obtain the list of network inter‐
       faces on the local machine.  A reference to a linked  list  of  ifaddrs
       structures,  as	defined in <ifaddrs.h>, is stored in the memory refer‐
       enced by ifap.  Each structure in the list describes one network inter‐
       face address, and is of the form:

	 struct ifaddrs {
	     struct ifaddrs	 *ifa_next;
	     char		 *ifa_name;
	     uint64_t		 ifa_flags;
	     struct sockaddr	 *ifa_addr;
	     struct sockaddr	 *ifa_netmask;
	     union {
		 struct sockaddr *ifu_broadaddr;
		 struct sockaddr *ifu_dstaddr;
	     } ifa_ifu;
	     void		 *ifa_data;
	 };
	 #define ifa_broadaddr	 ifa_ifu.ifu_broadaddr
	 #define ifa_dstaddr	 ifa_ifu.ifu_dstaddr

       The  list  is traversed by following the ifa_next pointer.  This member
       is NULL on the last structure in the list.

       The ifa_name member contains the interface name.

       The ifa_flags member contains the interface flags.

       The ifa_addr member references the address of the interface.   Use  the
       sa_family  member  of  this  structure  to  determine the format of the
       address, as described in socket.h(3HEAD).

       The ifa_netmask member references the netmask associated with ifa_addr,
       or NULL if one is not set.

       If  the	IFF_BROADCAST  bit  is set in ifa_flags, then ifa_broadaddr is
       valid, or NULL if not present.  If the IFF_POINTOPOINT bit is set, then
       ifa_dstaddr  is	valid,	or  NULL  if not present.  These two flags are
       mutually exclusive; see if_tcp(7P) for more information.

       The ifa_data member is presently unused.

       The memory used by getifaddrs() to back the list is  dynamically	 allo‐
       cated.  It should be freed using freeifaddrs().

RETURN VALUES
       If  successful,	getifaddrs() returns the value 0; otherwise it returns
       −1 and sets errno to indicate the error.

ERRORS
       The getifaddrs() function may fail and set errno for any of the	errors
       specified  for the library routines ioctl(2), socket(3SOCKET), and mal‐
       loc(3C).

ATTRIBUTES
       ┌────────────────────┬─────────────────┐
       │  ATTRIBUTE TYPE    │ ATTRIBUTE VALUE │
       ├────────────────────┼─────────────────┤
       │Interface Stability │ Committed	      │
       ├────────────────────┼─────────────────┤
       │MT-Level	    │ MT-Safe	      │
       └────────────────────┴─────────────────┘

SEE ALSO
       ipadm(1M),   ifconfig(1M),   ioctl(2),	malloc(3C),   socket(3SOCKET),
       socket.h(3HEAD), if_tcp(7P), attributes(5)

NOTES
       On  an  illumos	system,	 this  function lists only interfaces with the
       IFF_UP flag set; see if_tcp(7P) and ifconfig(1M) for more information.

BUGS
       At present, this function only lists addresses  from  the  AF_INET  and
       AF_INET6 families.  Other families, such as AF_LINK, are not included.

				 Apr 18, 2013		   GETIFADDRS(3SOCKET)
[top]

List of man pages available for SmartOS

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net