1 .\" $KAME: getifaddrs.3,v 1.4 2000/05/17 14:13:14 itojun Exp $
2 .\" BSDI getifaddrs.3,v 2.5 2000/02/23 14:51:59 dab Exp
4 .\" Copyright (c) 1995, 1999
5 .\" Berkeley Software Design, Inc. All rights reserved.
7 .\" Redistribution and use in source and binary forms, with or without
8 .\" modification, are permitted provided that the following conditions
10 .\" 1. Redistributions of source code must retain the above copyright
11 .\" notice, this list of conditions and the following disclaimer.
13 .\" THIS SOFTWARE IS PROVIDED BY Berkeley Software Design, Inc. ``AS IS'' AND
14 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16 .\" ARE DISCLAIMED. IN NO EVENT SHALL Berkeley Software Design, Inc. BE LIABLE
17 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 .\" $FreeBSD: src/lib/libc/net/getifaddrs.3,v 1.10 2005/02/09 18:03:13 ru Exp $
32 .Nd get interface addresses
40 .Fn getifaddrs "struct ifaddrs **ifap"
42 .Fn freeifaddrs "struct ifaddrs *ifp"
46 function stores a reference to a linked list of the network interfaces
47 on the local machine in the memory referenced by
51 structures, as defined in the include file
55 structure contains at least the following entries:
57 struct ifaddrs *ifa_next; /* Pointer to next struct */
58 char *ifa_name; /* Interface name */
59 u_int ifa_flags; /* Interface flags */
60 struct sockaddr *ifa_addr; /* Interface address */
61 struct sockaddr *ifa_netmask; /* Interface netmask */
62 struct sockaddr *ifa_dstaddr; /* P2P interface destination */
63 void *ifa_data; /* Address specific data */
68 field contains a pointer to the next structure on the list.
71 in last structure on the list.
75 field contains the interface name.
79 field contains the interface flags, as set by
85 field references either the address of the interface or the link level
86 address of the interface, if one exists, otherwise it is NULL.
91 field should be consulted to determine the format of the
97 field references the netmask associated with
99 if one is set, otherwise it is NULL.
103 field references the destination address on a P2P interface,
104 if one exists, otherwise it is NULL.
109 which should only be referenced for non-P2P interfaces,
110 references the broadcast address associated with
112 if one exists, otherwise it is NULL.
113 It is really just another name for
118 field references address family specific data.
121 addresses it contains a pointer to the
123 (as defined in include file
125 which contains various interface attributes and statistics.
126 For all other address families, it contains a pointer to the
128 (as defined in include file
130 which contains per-address interface statistics.
134 is dynamically allocated and should be freed using
136 when no longer needed.
144 for any of the errors specified for the library routines
159 implementation first appeared in BSDi