[ar71xx] update kernel config
[openwrt.git] / toolchain / uClibc / patches / 170-enable-getifaddrs.patch
1 --- a/libc/inet/ifaddrs.c
2 +++ b/libc/inet/ifaddrs.c
3 @@ -38,6 +38,7 @@
4 #include <unistd.h>
5
6 #include "netlinkaccess.h"
7 +#include "ifaddrs.h"
8
9 libc_hidden_proto(socket)
10 libc_hidden_proto(close)
11 @@ -57,7 +58,6 @@ libc_hidden_proto(abort)
12
13
14 #if __ASSUME_NETLINK_SUPPORT
15 -#if 0 /* unused code */
16 /* struct to hold the data for one ifaddrs entry, so we can allocate
17 everything at once. */
18 struct ifaddrs_storage
19 @@ -74,8 +74,6 @@ struct ifaddrs_storage
20 } addr, netmask, broadaddr;
21 char name[IF_NAMESIZE + 1];
22 };
23 -#endif /* unused code */
24 -
25
26 void
27 __netlink_free_handle (struct netlink_handle *h)
28 @@ -323,8 +321,6 @@ __netlink_open (struct netlink_handle *h
29 return 0;
30 }
31
32 -
33 -#if 0 /* unused code */
34 /* We know the number of RTM_NEWLINK entries, so we reserve the first
35 # of entries for this type. All RTM_NEWADDR entries have an index
36 pointer to the RTM_NEWLINK entry. To find the entry, create
37 @@ -562,7 +558,7 @@ getifaddrs (struct ifaddrs **ifap)
38 if ((rta_payload + 1) <= sizeof (ifas[ifa_index].name))
39 {
40 ifas[ifa_index].ifa.ifa_name = ifas[ifa_index].name;
41 - *(char *) __mempcpy (ifas[ifa_index].name, rta_data,
42 + *(char *) mempcpy (ifas[ifa_index].name, rta_data,
43 rta_payload) = '\0';
44 }
45 break;
46 @@ -761,7 +757,7 @@ getifaddrs (struct ifaddrs **ifap)
47 if (rta_payload + 1 <= sizeof (ifas[ifa_index].name))
48 {
49 ifas[ifa_index].ifa.ifa_name = ifas[ifa_index].name;
50 - *(char *) __mempcpy (ifas[ifa_index].name, rta_data,
51 + *(char *) mempcpy (ifas[ifa_index].name, rta_data,
52 rta_payload) = '\0';
53 }
54 else
55 @@ -872,6 +868,4 @@ freeifaddrs (struct ifaddrs *ifa)
56 }
57 #endif
58
59 -#endif /* unused code */
60 -
61 #endif /* __ASSUME_NETLINK_SUPPORT */
62 --- a/libc/inet/netlinkaccess.h
63 +++ b/libc/inet/netlinkaccess.h
64 @@ -61,14 +61,11 @@ struct netlink_handle
65 };
66
67
68 -#if 0 /* unused code */
69 #if __ASSUME_NETLINK_SUPPORT == 0
70 extern int __no_netlink_support attribute_hidden;
71 #else
72 # define __no_netlink_support 0
73 #endif
74 -#endif /* unused code */
75 -
76
77 extern int __netlink_open (struct netlink_handle *h) attribute_hidden;
78 extern void __netlink_close (struct netlink_handle *h) attribute_hidden;
79 --- /dev/null
80 +++ b/include/ifaddrs.h
81 @@ -0,0 +1,74 @@
82 +/* ifaddrs.h -- declarations for getting network interface addresses
83 + Copyright (C) 2002 Free Software Foundation, Inc.
84 + This file is part of the GNU C Library.
85 +
86 + The GNU C Library is free software; you can redistribute it and/or
87 + modify it under the terms of the GNU Lesser General Public
88 + License as published by the Free Software Foundation; either
89 + version 2.1 of the License, or (at your option) any later version.
90 +
91 + The GNU C Library is distributed in the hope that it will be useful,
92 + but WITHOUT ANY WARRANTY; without even the implied warranty of
93 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
94 + Lesser General Public License for more details.
95 +
96 + You should have received a copy of the GNU Lesser General Public
97 + License along with the GNU C Library; if not, write to the Free
98 + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
99 + 02111-1307 USA. */
100 +
101 +#ifndef _IFADDRS_H
102 +#define _IFADDRS_H 1
103 +
104 +#include <features.h>
105 +#include <sys/socket.h>
106 +
107 +__BEGIN_DECLS
108 +
109 +/* The `getifaddrs' function generates a linked list of these structures.
110 + Each element of the list describes one network interface. */
111 +struct ifaddrs
112 +{
113 + struct ifaddrs *ifa_next; /* Pointer to the next structure. */
114 +
115 + char *ifa_name; /* Name of this network interface. */
116 + unsigned int ifa_flags; /* Flags as from SIOCGIFFLAGS ioctl. */
117 +
118 + struct sockaddr *ifa_addr; /* Network address of this interface. */
119 + struct sockaddr *ifa_netmask; /* Netmask of this interface. */
120 + union
121 + {
122 + /* At most one of the following two is valid. If the IFF_BROADCAST
123 + bit is set in `ifa_flags', then `ifa_broadaddr' is valid. If the
124 + IFF_POINTOPOINT bit is set, then `ifa_dstaddr' is valid.
125 + It is never the case that both these bits are set at once. */
126 + struct sockaddr *ifu_broadaddr; /* Broadcast address of this interface. */
127 + struct sockaddr *ifu_dstaddr; /* Point-to-point destination address. */
128 + } ifa_ifu;
129 + /* These very same macros are defined by <net/if.h> for `struct ifaddr'.
130 + So if they are defined already, the existing definitions will be fine. */
131 +# ifndef ifa_broadaddr
132 +# define ifa_broadaddr ifa_ifu.ifu_broadaddr
133 +# endif
134 +# ifndef ifa_dstaddr
135 +# define ifa_dstaddr ifa_ifu.ifu_dstaddr
136 +# endif
137 +
138 + void *ifa_data; /* Address-specific data (may be unused). */
139 +};
140 +
141 +
142 +/* Create a linked list of `struct ifaddrs' structures, one for each
143 + network interface on the host machine. If successful, store the
144 + list in *IFAP and return 0. On errors, return -1 and set `errno'.
145 +
146 + The storage returned in *IFAP is allocated dynamically and can
147 + only be properly freed by passing it to `freeifaddrs'. */
148 +extern int getifaddrs (struct ifaddrs **__ifap) __THROW;
149 +
150 +/* Reclaim the storage allocated by a previous `getifaddrs' call. */
151 +extern void freeifaddrs (struct ifaddrs *__ifa) __THROW;
152 +
153 +__END_DECLS
154 +
155 +#endif /* ifaddrs.h */
This page took 0.046405 seconds and 5 git commands to generate.