This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Re: getifaddrs
- To: "Ronald F. Guilmette" <rfg at monkeys dot com>
- Subject: Re: getifaddrs
- From: "H . J . Lu" <hjl at lucon dot org>
- Date: Mon, 18 Jun 2001 13:29:17 -0700
- Cc: GNU C Library <libc-alpha at sourceware dot cygnus dot com>
- References: <92955.992888383@monkeys.com>
I don't think any glibc supports it. But it seems that someone is
working on it for ipv6:
http://www.linux-ipv6.org/
http://oss.sgi.com/projects/netdev/mail/netdev/msg00431.html
http://www2.linux-ipv6.org/ml/usagi-users/msg00416.html
H.J.
---
On Mon, Jun 18, 2001 at 11:19:43AM -0700, Ron Guilmette wrote:
>
> Can you tell me if the following function from FreeBSD is available in
> Linix libc, and if so, which version of Linux libc it first appeared in?
>
>
> ===========================================================================
> GETIFADDRS(3) FreeBSD Library Functions Manual GETIFADDRS(3)
>
> NNAAMMEE
> ggeettiiffaaddddrrss - get interface addresses
>
> SSYYNNOOPPSSIISS
> ##iinncclluuddee <<ssyyss//ttyyppeess..hh>>
> ##iinncclluuddee <<ssyyss//ssoocckkeett..hh>>
> ##iinncclluuddee <<iiffaaddddrrss..hh>>
>
> _i_n_t
> ggeettiiffaaddddrrss(_s_t_r_u_c_t _i_f_a_d_d_r_s _*_*_i_f_a_p)
>
> _v_o_i_d
> ffrreeeeiiffaaddddrrss(_s_t_r_u_c_t _i_f_a_d_d_r_s _*_i_f_p)
>
> DDEESSCCRRIIPPTTIIOONN
> The ggeettiiffaaddddrrss() function stores a reference to a linked list of the net-
> work interfaces on the local machine in the memory referenced by _i_f_a_p.
> The list consists of iiffaaddddrrss structures, as defined in the include file
> <_i_f_a_d_d_r_s_._h>. The iiffaaddddrrss structure contains at least the following en-
> tries:
>
> struct ifaddrs *ifa_next; /* Pointer to next struct */
> char *ifa_name; /* Interface name */
> u_int ifa_flags; /* Interface flags */
> struct sockaddr *ifa_addr; /* Interface address */
> struct sockaddr *ifa_netmask; /* Interface netmask */
> struct sockaddr *ifa_broadaddr; /* Interface broadcast address */
> struct sockaddr *ifa_dstaddr; /* P2P interface destination */
> void *ifa_data; /* Address specific data */
>
> The ifa_next field contains a pointer to the next structure on the list.
> This field is NULL in last structure on the list.
>
> The ifa_name field contains the interface name.
>
> The ifa_flags field contains the interface flags, as set by ifconfig(8)
> utility.
>
> The ifa_addr field references either the address of the interface or the
> link level address of the interface, if one exists, otherwise it is NULL.
> (The sa_family field of the ifa_addr field should be consulted to deter-
> mine the format of the ifa_addr address.)
>
> The ifa_netmask field references the netmask associated with ifa_addr, if
> one is set, otherwise it is NULL.
>
> The ifa_broadaddr field, which should only be referenced for non-P2P in-
> terfaces, references the broadcast address associated with ifa_addr, if
> one exists, otherwise it is NULL.
>
> The ifa_dstaddr field references the destination address on a P2P inter-
> face, if one exists, otherwise it is NULL.
>
> The ifa_data field references address family specific data. For AF_LINK
> addresses it contains a pointer to the _s_t_r_u_c_t _i_f___d_a_t_a (as defined in
> include file <_n_e_t_/_i_f_._h>) which contains various interface attributes and
> statistics. For all other address families, it contains a pointer to the
> _s_t_r_u_c_t _i_f_a___d_a_t_a (as defined in include file <_n_e_t_/_i_f_._h>) which contains
> per-address interface statistics.
>
> The data returned by ggeettiiffaaddddrrss() is dynamically allocated and should be
> freed using ffrreeeeiiffaaddddrrss() when no longer needed.
>
> RREETTUURRNN VVAALLUUEESS
> Upon successful completion, a value of 0 is returned. Otherwise, a value
> of -1 is returned and _e_r_r_n_o is set to indicate the error.
>
> EERRRROORRSS
> The ggeettiiffaaddddrrss() may fail and set _e_r_r_n_o for any of the errors specified
> for the library routines ioctl(2), socket(2), malloc(3) or sysctl(3).
>
> BBUUGGSS
> If both <_n_e_t_/_i_f_._h> and <_i_f_a_d_d_r_s_._h> are being included, <_n_e_t_/_i_f_._h> _m_u_s_t be
> included before <_i_f_a_d_d_r_s_._h>.
>
> SSEEEE AALLSSOO
> ioctl(2), socket(2), sysctl(3), networking(4), ifconfig(8)
>
> HHIISSTTOORRYY
> The ggeettiiffaaddddrrss implementation first appeared in BSDI BSD/OS.
>
> June 18, 2001 2