summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/glibc/glibc-2.10.1/glibc-check_pf.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-core/glibc/glibc-2.10.1/glibc-check_pf.patch')
-rw-r--r--meta/recipes-core/glibc/glibc-2.10.1/glibc-check_pf.patch345
1 files changed, 0 insertions, 345 deletions
diff --git a/meta/recipes-core/glibc/glibc-2.10.1/glibc-check_pf.patch b/meta/recipes-core/glibc/glibc-2.10.1/glibc-check_pf.patch
deleted file mode 100644
index a0e55bfaec..0000000000
--- a/meta/recipes-core/glibc/glibc-2.10.1/glibc-check_pf.patch
+++ /dev/null
@@ -1,345 +0,0 @@
1From libc-ports-return-550-listarch-libc-ports=sources dot redhat dot com at sourceware dot org Tue Oct 31 17:37:21 2006
2Return-Path: <libc-ports-return-550-listarch-libc-ports=sources dot redhat dot com at sourceware dot org>
3Delivered-To: listarch-libc-ports at sources dot redhat dot com
4Received: (qmail 17273 invoked by alias); 31 Oct 2006 17:37:20 -0000
5Received: (qmail 17262 invoked by uid 22791); 31 Oct 2006 17:37:19 -0000
6X-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00,TW_CP
7X-Spam-Check-By: sourceware.org
8Received: from nevyn.them.org (HELO nevyn.them.org) (66.93.172.17) by sourceware.org (qpsmtpd/0.31.1) with ESMTP; Tue, 31 Oct 2006 17:37:11 +0000
9Received: from drow by nevyn.them.org with local (Exim 4.54) id 1GexXw-0007Dj-30; Tue, 31 Oct 2006 12:37:08 -0500
10Date: Tue, 31 Oct 2006 12:37:08 -0500
11From: Daniel Jacobowitz <drow at false dot org>
12To: Mike Frysinger <vapier at gentoo dot org>
13Cc: libc-ports at sourceware dot org, Philip Balister <philip dot balister at gmail dot com>
14Subject: Re: Problem with glibc-2.5 on ARM
15Message-ID: <20061031173708.GJ20468@nevyn.them.org>
16References: <499146270610241149ibe030e0nd9d6b177a95b346e@mail.gmail.com> <499146270610241254u7cadf63ej2edf05cedbc5266f@mail.gmail.com> <20061024195837.GA20181@nevyn.them.org> <200610291954.27022.vapier@gentoo.org>
17MIME-Version: 1.0
18Content-Type: text/plain; charset=us-ascii
19Content-Disposition: inline
20In-Reply-To: <200610291954 dot 27022 dot vapier at gentoo dot org>
21User-Agent: Mutt/1.5.13 (2006-08-11)
22X-IsSubscribed: yes
23Mailing-List: contact libc-ports-help at sourceware dot org; run by ezmlm
24Precedence: bulk
25List-Subscribe: <mailto:libc-ports-subscribe at sourceware dot org>
26List-Post: <mailto:libc-ports at sourceware dot org>
27List-Help: <mailto:libc-ports-help at sourceware dot org>, <http://sourceware dot org/lists dot html#faqs>
28Sender: libc-ports-owner at sourceware dot org
29Delivered-To: mailing list libc-ports at sourceware dot org
30
31On Sun, Oct 29, 2006 at 07:54:25PM -0500, Mike Frysinger wrote:
32> On Tuesday 24 October 2006 15:58, Daniel Jacobowitz wrote:
33> > ARM is going to need a slightly different version of that file, I
34> > guess.
35>
36> would declaring req with attribute packed not help ?
37> -mike
38
39Nope. "struct rtgenmsg" would still have size 4.
40
41Philip, are you still at all interested in this for the old ABI?
42I don't have time to test this patch right now, but I think it
43will work.
44
45--
46Daniel Jacobowitz
47CodeSourcery
48
492006-10-31 Daniel Jacobowitz <dan@codesourcery.com>
50
51 * sysdeps/unix/sysv/linux/arm/check_pf.c: New file.
52 * sysdeps/unix/sysv/linux/arm/eabi/check_pf.c: New file.
53
54Upstream-Status: Inappropriate [not used]
55
56Index: sysdeps/unix/sysv/linux/arm/check_pf.c
57===================================================================
58RCS file: sysdeps/unix/sysv/linux/arm/check_pf.c
59diff -N sysdeps/unix/sysv/linux/arm/check_pf.c
60--- /dev/null 1 Jan 1970 00:00:00 -0000
61+++ sysdeps/unix/sysv/linux/arm/check_pf.c 31 Oct 2006 17:29:58 -0000
62@@ -0,0 +1,274 @@
63+/* Determine protocol families for which interfaces exist. ARM Linux version.
64+ Copyright (C) 2003, 2006 Free Software Foundation, Inc.
65+ This file is part of the GNU C Library.
66+
67+ The GNU C Library is free software; you can redistribute it and/or
68+ modify it under the terms of the GNU Lesser General Public
69+ License as published by the Free Software Foundation; either
70+ version 2.1 of the License, or (at your option) any later version.
71+
72+ The GNU C Library is distributed in the hope that it will be useful,
73+ but WITHOUT ANY WARRANTY; without even the implied warranty of
74+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
75+ Lesser General Public License for more details.
76+
77+ You should have received a copy of the GNU Lesser General Public
78+ License along with the GNU C Library; if not, write to the Free
79+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
80+ 02111-1307 USA. */
81+
82+#include <assert.h>
83+#include <errno.h>
84+#include <ifaddrs.h>
85+#include <netdb.h>
86+#include <stddef.h>
87+#include <string.h>
88+#include <time.h>
89+#include <unistd.h>
90+#include <sys/socket.h>
91+
92+#include <asm/types.h>
93+#include <linux/netlink.h>
94+#include <linux/rtnetlink.h>
95+
96+#include <not-cancel.h>
97+#include <kernel-features.h>
98+
99+
100+#ifndef IFA_F_TEMPORARY
101+# define IFA_F_TEMPORARY IFA_F_SECONDARY
102+#endif
103+#ifndef IFA_F_HOMEADDRESS
104+# define IFA_F_HOMEADDRESS 0
105+#endif
106+
107+
108+static int
109+make_request (int fd, pid_t pid, bool *seen_ipv4, bool *seen_ipv6,
110+ struct in6addrinfo **in6ai, size_t *in6ailen)
111+{
112+ struct req
113+ {
114+ struct nlmsghdr nlh;
115+ struct rtgenmsg g;
116+ } req;
117+ struct sockaddr_nl nladdr;
118+
119+ /* struct rtgenmsg consists of a single byte but the ARM ABI rounds
120+ it up to a word. Clear the padding explicitly here. */
121+ assert (sizeof (req.g) == 4);
122+ memset (&req.g, '\0', sizeof (req.g));
123+
124+ req.nlh.nlmsg_len = sizeof (req);
125+ req.nlh.nlmsg_type = RTM_GETADDR;
126+ req.nlh.nlmsg_flags = NLM_F_ROOT | NLM_F_MATCH | NLM_F_REQUEST;
127+ req.nlh.nlmsg_pid = 0;
128+ req.nlh.nlmsg_seq = time (NULL);
129+ req.g.rtgen_family = AF_UNSPEC;
130+
131+ memset (&nladdr, '\0', sizeof (nladdr));
132+ nladdr.nl_family = AF_NETLINK;
133+
134+ if (TEMP_FAILURE_RETRY (__sendto (fd, (void *) &req, sizeof (req), 0,
135+ (struct sockaddr *) &nladdr,
136+ sizeof (nladdr))) < 0)
137+ return -1;
138+
139+ *seen_ipv4 = false;
140+ *seen_ipv6 = false;
141+
142+ bool done = false;
143+ char buf[4096];
144+ struct iovec iov = { buf, sizeof (buf) };
145+ struct in6ailist
146+ {
147+ struct in6addrinfo info;
148+ struct in6ailist *next;
149+ } *in6ailist = NULL;
150+ size_t in6ailistlen = 0;
151+
152+ do
153+ {
154+ struct msghdr msg =
155+ {
156+ (void *) &nladdr, sizeof (nladdr),
157+ &iov, 1,
158+ NULL, 0,
159+ 0
160+ };
161+
162+ ssize_t read_len = TEMP_FAILURE_RETRY (__recvmsg (fd, &msg, 0));
163+ if (read_len < 0)
164+ return -1;
165+
166+ if (msg.msg_flags & MSG_TRUNC)
167+ return -1;
168+
169+ struct nlmsghdr *nlmh;
170+ for (nlmh = (struct nlmsghdr *) buf;
171+ NLMSG_OK (nlmh, (size_t) read_len);
172+ nlmh = (struct nlmsghdr *) NLMSG_NEXT (nlmh, read_len))
173+ {
174+ if (nladdr.nl_pid != 0 || (pid_t) nlmh->nlmsg_pid != pid
175+ || nlmh->nlmsg_seq != req.nlh.nlmsg_seq)
176+ continue;
177+
178+ if (nlmh->nlmsg_type == RTM_NEWADDR)
179+ {
180+ struct ifaddrmsg *ifam = (struct ifaddrmsg *) NLMSG_DATA (nlmh);
181+
182+ switch (ifam->ifa_family)
183+ {
184+ case AF_INET:
185+ *seen_ipv4 = true;
186+ break;
187+ case AF_INET6:
188+ *seen_ipv6 = true;
189+
190+ if (ifam->ifa_flags & (IFA_F_DEPRECATED
191+ | IFA_F_TEMPORARY
192+ | IFA_F_HOMEADDRESS))
193+ {
194+ struct rtattr *rta = IFA_RTA (ifam);
195+ size_t len = (nlmh->nlmsg_len
196+ - NLMSG_LENGTH (sizeof (*ifam)));
197+ void *local = NULL;
198+ void *address = NULL;
199+ while (RTA_OK (rta, len))
200+ {
201+ switch (rta->rta_type)
202+ {
203+ case IFA_LOCAL:
204+ local = RTA_DATA (rta);
205+ break;
206+
207+ case IFA_ADDRESS:
208+ address = RTA_DATA (rta);
209+ break;
210+ }
211+
212+ rta = RTA_NEXT (rta, len);
213+ }
214+
215+ struct in6ailist *newp = alloca (sizeof (*newp));
216+ newp->info.flags = (((ifam->ifa_flags & IFA_F_DEPRECATED)
217+ ? in6ai_deprecated : 0)
218+ | ((ifam->ifa_flags
219+ & IFA_F_TEMPORARY)
220+ ? in6ai_temporary : 0)
221+ | ((ifam->ifa_flags
222+ & IFA_F_HOMEADDRESS)
223+ ? in6ai_homeaddress : 0));
224+ memcpy (newp->info.addr, address ?: local,
225+ sizeof (newp->info.addr));
226+ newp->next = in6ailist;
227+ in6ailist = newp;
228+ ++in6ailistlen;
229+ }
230+ break;
231+ default:
232+ /* Ignore. */
233+ break;
234+ }
235+ }
236+ else if (nlmh->nlmsg_type == NLMSG_DONE)
237+ /* We found the end, leave the loop. */
238+ done = true;
239+ }
240+ }
241+ while (! done);
242+
243+ close_not_cancel_no_status (fd);
244+
245+ if (in6ailist != NULL)
246+ {
247+ *in6ai = malloc (in6ailistlen * sizeof (**in6ai));
248+ if (*in6ai == NULL)
249+ return -1;
250+
251+ *in6ailen = in6ailistlen;
252+
253+ do
254+ {
255+ (*in6ai)[--in6ailistlen] = in6ailist->info;
256+ in6ailist = in6ailist->next;
257+ }
258+ while (in6ailist != NULL);
259+ }
260+
261+ return 0;
262+}
263+
264+
265+/* We don't know if we have NETLINK support compiled in in our
266+ Kernel. */
267+#if __ASSUME_NETLINK_SUPPORT == 0
268+/* Define in ifaddrs.h. */
269+extern int __no_netlink_support attribute_hidden;
270+#else
271+# define __no_netlink_support 0
272+#endif
273+
274+
275+void
276+attribute_hidden
277+__check_pf (bool *seen_ipv4, bool *seen_ipv6,
278+ struct in6addrinfo **in6ai, size_t *in6ailen)
279+{
280+ *in6ai = NULL;
281+ *in6ailen = 0;
282+
283+ if (! __no_netlink_support)
284+ {
285+ int fd = __socket (PF_NETLINK, SOCK_RAW, NETLINK_ROUTE);
286+
287+ struct sockaddr_nl nladdr;
288+ memset (&nladdr, '\0', sizeof (nladdr));
289+ nladdr.nl_family = AF_NETLINK;
290+
291+ socklen_t addr_len = sizeof (nladdr);
292+
293+ if (fd >= 0
294+ && __bind (fd, (struct sockaddr *) &nladdr, sizeof (nladdr)) == 0
295+ && __getsockname (fd, (struct sockaddr *) &nladdr, &addr_len) == 0
296+ && make_request (fd, nladdr.nl_pid, seen_ipv4, seen_ipv6,
297+ in6ai, in6ailen) == 0)
298+ /* It worked. */
299+ return;
300+
301+ if (fd >= 0)
302+ __close (fd);
303+
304+#if __ASSUME_NETLINK_SUPPORT == 0
305+ /* Remember that there is no netlink support. */
306+ __no_netlink_support = 1;
307+#else
308+ /* We cannot determine what interfaces are available. Be
309+ pessimistic. */
310+ *seen_ipv4 = true;
311+ *seen_ipv6 = true;
312+#endif
313+ }
314+
315+#if __ASSUME_NETLINK_SUPPORT == 0
316+ /* No netlink. Get the interface list via getifaddrs. */
317+ struct ifaddrs *ifa = NULL;
318+ if (getifaddrs (&ifa) != 0)
319+ {
320+ /* We cannot determine what interfaces are available. Be
321+ pessimistic. */
322+ *seen_ipv4 = true;
323+ *seen_ipv6 = true;
324+ return;
325+ }
326+
327+ struct ifaddrs *runp;
328+ for (runp = ifa; runp != NULL; runp = runp->ifa_next)
329+ if (runp->ifa_addr->sa_family == PF_INET)
330+ *seen_ipv4 = true;
331+ else if (runp->ifa_addr->sa_family == PF_INET6)
332+ *seen_ipv6 = true;
333+
334+ (void) freeifaddrs (ifa);
335+#endif
336+}
337Index: sysdeps/unix/sysv/linux/arm/eabi/check_pf.c
338===================================================================
339RCS file: sysdeps/unix/sysv/linux/arm/eabi/check_pf.c
340diff -N sysdeps/unix/sysv/linux/arm/eabi/check_pf.c
341--- /dev/null 1 Jan 1970 00:00:00 -0000
342+++ sysdeps/unix/sysv/linux/arm/eabi/check_pf.c 31 Oct 2006 17:29:58 -0000
343@@ -0,0 +1 @@
344+#include <sysdeps/unix/sysv/linux/check_pf.c>
345