summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorAlexander Kanavin <alexander.kanavin@linux.intel.com>2017-02-22 16:51:16 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-03-01 23:27:09 +0000
commita4b618930ac398c054edcc89c14bde3211ba7cb5 (patch)
tree03ec5689657430034ae82d0103e5b577d7ea2a46 /meta
parent22c56bd9827c5e0e022e95916852065dc9ecf37c (diff)
downloadpoky-a4b618930ac398c054edcc89c14bde3211ba7cb5.tar.gz
libnl: update to 3.2.29
Dropped patches are all backports. (From OE-Core rev: 57ff86881cb8e303c6a177b0ec8e8930dfb3b0a3) Signed-off-by: Alexander Kanavin <alexander.kanavin@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/recipes-support/libnl/libnl/0001-lib-add-utility-function-nl_strerror_l.patch146
-rw-r--r--meta/recipes-support/libnl/libnl/0002-lib-switch-to-using-strerror_l-instead-of-strerror_r.patch403
-rw-r--r--meta/recipes-support/libnl/libnl/0003-src-switch-to-using-strerror_l-instead-of-strerror_r.patch82
-rw-r--r--meta/recipes-support/libnl/libnl_3.2.29.bb (renamed from meta/recipes-support/libnl/libnl_3.2.28.bb)7
4 files changed, 2 insertions, 636 deletions
diff --git a/meta/recipes-support/libnl/libnl/0001-lib-add-utility-function-nl_strerror_l.patch b/meta/recipes-support/libnl/libnl/0001-lib-add-utility-function-nl_strerror_l.patch
deleted file mode 100644
index b734028c73..0000000000
--- a/meta/recipes-support/libnl/libnl/0001-lib-add-utility-function-nl_strerror_l.patch
+++ /dev/null
@@ -1,146 +0,0 @@
1From 683f27fbb68ca2028a7b3468f17164d484df2759 Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Andr=C3=A9=20Draszik?= <adraszik@tycoint.com>
3Date: Thu, 25 Aug 2016 13:14:59 +0100
4Subject: [PATCH 1/3] lib: add utility function nl_strerror_l()
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9libnl currently uses strerror_r() throughout, but this is
10problematic because there is a non-standard GNU version
11implemented in glibc, and the standard POSIX version, which
12differ in signature. When using glibc, one can choose
13between the two versions using feature test macros
14_GNU_SOURCE and _POSIX_C_SOURCE.
15
16Given libnl is built using the former, we always get the
17glibc special version, and all code so far has been written
18for that non-standard version.
19
20Other C libraries like musl on the other hand only try
21to be posix compliant, and only ever provide the posix
22version of strerror_r(), which has a different signature.
23
24The alternative is to use strerror_l() rather than
25strerror_r() http://austingroupbugs.net/view.php?id=655
26- this will avoid the non-confirming versions issue
27- strerror_l() is now recommended by POSIX to replace
28 strerror_r() usage
29
30So rather than changing all uses of strerror_r() to be in
31line with posix, we are going to switch to the recommended
32interface strerror_l().
33
34Since strerror_l() is slightly more difficuly to use, we
35add a little (private) wrapper that we can use from all
36current callsites of strerror_r().
37
38Signed-off-by: André Draszik <adraszik@tycoint.com>
39Reviewed-by: Stephane Ayotte <sayotte@tycoint.com>
40Signed-off-by: Thomas Haller <thaller@redhat.com>
41---
42Upstream-Status: Backport https://github.com/thom311/libnl/commit/683f27fbb68ca2028a7b3468f17164d484df2759
43 include/Makefile.am | 1 +
44 include/netlink-private/utils.h | 17 +++++++++++++++++
45 lib/utils.c | 24 ++++++++++++++++++++++++
46 libnl-3.sym | 5 +++++
47 4 files changed, 47 insertions(+)
48 create mode 100644 include/netlink-private/utils.h
49
50diff --git a/include/Makefile.am b/include/Makefile.am
51index 804e984..f8b977a 100644
52--- a/include/Makefile.am
53+++ b/include/Makefile.am
54@@ -166,6 +166,7 @@ noinst_HEADERS = \
55 netlink-private/socket.h \
56 netlink-private/tc.h \
57 netlink-private/types.h \
58+ netlink-private/utils.h \
59 netlink-private/cache-api.h \
60 netlink-private/object-api.h \
61 netlink-private/route/link/api.h \
62diff --git a/include/netlink-private/utils.h b/include/netlink-private/utils.h
63new file mode 100644
64index 0000000..77aadb3
65--- /dev/null
66+++ b/include/netlink-private/utils.h
67@@ -0,0 +1,17 @@
68+/*
69+ * netlink-private/utils.h Local Utility Functions
70+ *
71+ * This library is free software; you can redistribute it and/or
72+ * modify it under the terms of the GNU Lesser General Public
73+ * License as published by the Free Software Foundation version 2.1
74+ * of the License.
75+ *
76+ * Copyright (c) 2003-2012 Thomas Graf <tgraf@suug.ch>
77+ */
78+
79+#ifndef NETLINK_UTILS_PRIV_H_
80+#define NETLINK_UTILS_PRIV_H_
81+
82+extern const char * nl_strerror_l(int err);
83+
84+#endif
85diff --git a/lib/utils.c b/lib/utils.c
86index 61c3d95..c1c1b72 100644
87--- a/lib/utils.c
88+++ b/lib/utils.c
89@@ -25,10 +25,12 @@
90 */
91
92 #include <netlink-private/netlink.h>
93+#include <netlink-private/utils.h>
94 #include <netlink/netlink.h>
95 #include <netlink/utils.h>
96 #include <linux/socket.h>
97 #include <stdlib.h> /* exit() */
98+#include <locale.h>
99
100 /**
101 * Global variable indicating the desired level of debugging output.
102@@ -118,6 +120,28 @@ int __nl_read_num_str_file(const char *path, int (*cb)(long, const char *))
103
104 return 0;
105 }
106+
107+const char *nl_strerror_l(int err)
108+{
109+ int errno_save = errno;
110+ locale_t loc = newlocale(LC_MESSAGES_MASK, "", (locale_t)0);
111+ const char *buf;
112+
113+ if (loc == (locale_t)0) {
114+ if (errno == ENOENT)
115+ loc = newlocale(LC_MESSAGES_MASK,
116+ "POSIX", (locale_t)0);
117+ }
118+ if (loc != (locale_t)0) {
119+ buf = strerror_l(err, loc);
120+ freelocale(loc);
121+ } else {
122+ buf = "newlocale() failed";
123+ }
124+
125+ errno = errno_save;
126+ return buf;
127+}
128 /** @endcond */
129
130 /**
131diff --git a/libnl-3.sym b/libnl-3.sym
132index 4e09bdd..9119e66 100644
133--- a/libnl-3.sym
134+++ b/libnl-3.sym
135@@ -351,3 +351,8 @@ libnl_3_2_28 {
136 global:
137 nl_object_diff64;
138 } libnl_3_2_27;
139+
140+libnl_3_2_29 {
141+global:
142+ nl_strerror_l;
143+} libnl_3_2_28;
144--
1452.9.3
146
diff --git a/meta/recipes-support/libnl/libnl/0002-lib-switch-to-using-strerror_l-instead-of-strerror_r.patch b/meta/recipes-support/libnl/libnl/0002-lib-switch-to-using-strerror_l-instead-of-strerror_r.patch
deleted file mode 100644
index 6347ec0b91..0000000000
--- a/meta/recipes-support/libnl/libnl/0002-lib-switch-to-using-strerror_l-instead-of-strerror_r.patch
+++ /dev/null
@@ -1,403 +0,0 @@
1From c1948ec29b8dcdc58d2d92700c325abdeab111a6 Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Andr=C3=A9=20Draszik?= <adraszik@tycoint.com>
3Date: Thu, 25 Aug 2016 13:15:00 +0100
4Subject: [PATCH 2/3] lib: switch to using strerror_l() instead of strerror_r()
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9glibc provides two versions of strerror_r(), which
10can be chosen between using feature test macros
11_GNU_SOURCE and _POSIX_C_SOURCE. libnl is built using
12the former, hence we get the glibc special version,
13and all code so far has been written for this.
14
15Other C libraries like musl on the other hand only try
16to be posix compliant, and only ever provide the posix
17version of strerror_r(), which has a different signature.
18
19Uses in libnl hence generally cause printf() of an *int*
20with a *string format* specifier for that reason.
21
22Additionally, strerror_r() has been deprecated:
23 http://austingroupbugs.net/view.php?id=655
24
25Switch to using strerror_l() (via our wrapper just
26introduced).
27
28Signed-off-by: André Draszik <adraszik@tycoint.com>
29Reviewed-by: Stephane Ayotte <sayotte@tycoint.com>
30Signed-off-by: Thomas Haller <thaller@redhat.com>
31---
32Upstream-Status: Backport https://github.com/thom311/libnl/commit/c1948ec29b8dcdc58d2d92700c325abdeab111a6
33 lib/cache_mngr.c | 5 ++---
34 lib/fib_lookup/lookup.c | 3 ++-
35 lib/handlers.c | 4 ++--
36 lib/msg.c | 4 ++--
37 lib/nl.c | 26 +++++++++-----------------
38 lib/route/route_obj.c | 3 ++-
39 lib/socket.c | 33 +++++++++++----------------------
40 7 files changed, 30 insertions(+), 48 deletions(-)
41
42diff --git a/lib/cache_mngr.c b/lib/cache_mngr.c
43index b9eb345..1f23eb1 100644
44--- a/lib/cache_mngr.c
45+++ b/lib/cache_mngr.c
46@@ -33,6 +33,7 @@
47 */
48
49 #include <netlink-private/netlink.h>
50+#include <netlink-private/utils.h>
51 #include <netlink/netlink.h>
52 #include <netlink/cache.h>
53 #include <netlink/utils.h>
54@@ -392,10 +393,8 @@ int nl_cache_mngr_poll(struct nl_cache_mngr *mngr, int timeout)
55 ret = poll(&fds, 1, timeout);
56 NL_DBG(3, "Cache manager %p, poll() returned %d\n", mngr, ret);
57 if (ret < 0) {
58- char buf[64];
59-
60 NL_DBG(4, "nl_cache_mngr_poll(%p): poll() failed with %d (%s)\n",
61- mngr, errno, strerror_r(errno, buf, sizeof(buf)));
62+ mngr, errno, nl_strerror_l(errno));
63 return -nl_syserr2nlerr(errno);
64 }
65
66diff --git a/lib/fib_lookup/lookup.c b/lib/fib_lookup/lookup.c
67index 43b6126..efc862b 100644
68--- a/lib/fib_lookup/lookup.c
69+++ b/lib/fib_lookup/lookup.c
70@@ -17,6 +17,7 @@
71 */
72
73 #include <netlink-private/netlink.h>
74+#include <netlink-private/utils.h>
75 #include <netlink/netlink.h>
76 #include <netlink/attr.h>
77 #include <netlink/utils.h>
78@@ -133,7 +134,7 @@ static void result_dump_line(struct nl_object *obj, struct nl_dump_params *p)
79 nl_rtntype2str(res->fr_type, buf, sizeof(buf)));
80 nl_dump(p, "scope %s error %s (%d)\n",
81 rtnl_scope2str(res->fr_scope, buf, sizeof(buf)),
82- strerror_r(-res->fr_error, buf, sizeof(buf)), res->fr_error);
83+ nl_strerror_l(-res->fr_error), res->fr_error);
84 }
85
86 static void result_dump_details(struct nl_object *obj, struct nl_dump_params *p)
87diff --git a/lib/handlers.c b/lib/handlers.c
88index 97a0d9c..4a48b99 100644
89--- a/lib/handlers.c
90+++ b/lib/handlers.c
91@@ -26,6 +26,7 @@
92 */
93
94 #include <netlink-private/netlink.h>
95+#include <netlink-private/utils.h>
96 #include <netlink/netlink.h>
97 #include <netlink/utils.h>
98 #include <netlink/msg.h>
99@@ -79,10 +80,9 @@ static int nl_error_handler_verbose(struct sockaddr_nl *who,
100 struct nlmsgerr *e, void *arg)
101 {
102 FILE *ofd = arg ? arg : stderr;
103- char buf[256];
104
105 fprintf(ofd, "-- Error received: %s\n-- Original message: ",
106- strerror_r(-e->error, buf, sizeof(buf)));
107+ nl_strerror_l(-e->error));
108 print_header_content(ofd, &e->msg);
109 fprintf(ofd, "\n");
110
111diff --git a/lib/msg.c b/lib/msg.c
112index e8a7e99..9af3f3a 100644
113--- a/lib/msg.c
114+++ b/lib/msg.c
115@@ -27,6 +27,7 @@
116 */
117
118 #include <netlink-private/netlink.h>
119+#include <netlink-private/utils.h>
120 #include <netlink/netlink.h>
121 #include <netlink/utils.h>
122 #include <netlink/cache.h>
123@@ -913,11 +914,10 @@ static void dump_error_msg(struct nl_msg *msg, FILE *ofd)
124 fprintf(ofd, " [ERRORMSG] %zu octets\n", sizeof(*err));
125
126 if (nlmsg_len(hdr) >= sizeof(*err)) {
127- char buf[256];
128 struct nl_msg *errmsg;
129
130 fprintf(ofd, " .error = %d \"%s\"\n", err->error,
131- strerror_r(-err->error, buf, sizeof(buf)));
132+ nl_strerror_l(-err->error));
133 fprintf(ofd, " [ORIGINAL MESSAGE] %zu octets\n", sizeof(*hdr));
134
135 errmsg = nlmsg_inherit(&err->msg);
136diff --git a/lib/nl.c b/lib/nl.c
137index 123f657..a45c3ea 100644
138--- a/lib/nl.c
139+++ b/lib/nl.c
140@@ -27,6 +27,7 @@
141
142 #include <netlink-private/netlink.h>
143 #include <netlink-private/socket.h>
144+#include <netlink-private/utils.h>
145 #include <netlink/netlink.h>
146 #include <netlink/utils.h>
147 #include <netlink/handlers.h>
148@@ -105,7 +106,6 @@ int nl_connect(struct nl_sock *sk, int protocol)
149 int errsv;
150 socklen_t addrlen;
151 struct sockaddr_nl local = { 0 };
152- char buf[64];
153 int try_bind = 1;
154
155 #ifdef SOCK_CLOEXEC
156@@ -119,7 +119,7 @@ int nl_connect(struct nl_sock *sk, int protocol)
157 if (sk->s_fd < 0) {
158 errsv = errno;
159 NL_DBG(4, "nl_connect(%p): socket() failed with %d (%s)\n", sk, errsv,
160- strerror_r(errsv, buf, sizeof(buf)));
161+ nl_strerror_l(errsv));
162 err = -nl_syserr2nlerr(errsv);
163 goto errout;
164 }
165@@ -158,7 +158,7 @@ int nl_connect(struct nl_sock *sk, int protocol)
166 _nl_socket_used_ports_set(used_ports, port);
167 } else {
168 NL_DBG(4, "nl_connect(%p): bind() for port %u failed with %d (%s)\n",
169- sk, (unsigned) port, errsv, strerror_r(errsv, buf, sizeof(buf)));
170+ sk, (unsigned) port, errsv, nl_strerror_l(errsv));
171 _nl_socket_used_ports_release_all(used_ports);
172 err = -nl_syserr2nlerr(errsv);
173 goto errout;
174@@ -172,7 +172,7 @@ int nl_connect(struct nl_sock *sk, int protocol)
175 if (err != 0) {
176 errsv = errno;
177 NL_DBG(4, "nl_connect(%p): bind() failed with %d (%s)\n",
178- sk, errsv, strerror_r(errsv, buf, sizeof(buf)));
179+ sk, errsv, nl_strerror_l(errsv));
180 err = -nl_syserr2nlerr(errsv);
181 goto errout;
182 }
183@@ -183,7 +183,7 @@ int nl_connect(struct nl_sock *sk, int protocol)
184 &addrlen);
185 if (err < 0) {
186 NL_DBG(4, "nl_connect(%p): getsockname() failed with %d (%s)\n",
187- sk, errno, strerror_r(errno, buf, sizeof(buf)));
188+ sk, errno, nl_strerror_l(errno));
189 err = -nl_syserr2nlerr(errno);
190 goto errout;
191 }
192@@ -280,10 +280,8 @@ int nl_sendto(struct nl_sock *sk, void *buf, size_t size)
193 ret = sendto(sk->s_fd, buf, size, 0, (struct sockaddr *)
194 &sk->s_peer, sizeof(sk->s_peer));
195 if (ret < 0) {
196- char errbuf[64];
197-
198 NL_DBG(4, "nl_sendto(%p): sendto() failed with %d (%s)\n",
199- sk, errno, strerror_r(errno, errbuf, sizeof(errbuf)));
200+ sk, errno, nl_strerror_l(errno));
201 return -nl_syserr2nlerr(errno);
202 }
203
204@@ -343,10 +341,8 @@ int nl_sendmsg(struct nl_sock *sk, struct nl_msg *msg, struct msghdr *hdr)
205
206 ret = sendmsg(sk->s_fd, hdr, 0);
207 if (ret < 0) {
208- char errbuf[64];
209-
210 NL_DBG(4, "nl_sendmsg(%p): sendmsg() failed with %d (%s)\n",
211- sk, errno, strerror_r(errno, errbuf, sizeof(errbuf)));
212+ sk, errno, nl_strerror_l(errno));
213 return -nl_syserr2nlerr(errno);
214 }
215
216@@ -706,15 +702,13 @@ retry:
217 goto abort;
218 }
219 if (n < 0) {
220- char errbuf[64];
221-
222 if (errno == EINTR) {
223 NL_DBG(3, "recvmsg() returned EINTR, retrying\n");
224 goto retry;
225 }
226
227 NL_DBG(4, "nl_sendmsg(%p): nl_recv() failed with %d (%s)\n",
228- sk, errno, strerror_r(errno, errbuf, sizeof(errbuf)));
229+ sk, errno, nl_strerror_l(errno));
230 retval = -nl_syserr2nlerr(errno);
231 goto abort;
232 }
233@@ -980,10 +974,8 @@ continue_reading:
234 goto out;
235 }
236 } else if (e->error) {
237- char buf[64];
238-
239 NL_DBG(4, "recvmsgs(%p): RTNETLINK responded with %d (%s)\n",
240- sk, -e->error, strerror_r(-e->error, buf, sizeof(buf)));
241+ sk, -e->error, nl_strerror_l(-e->error));
242
243 /* Error message reported back from kernel. */
244 if (cb->cb_err) {
245diff --git a/lib/route/route_obj.c b/lib/route/route_obj.c
246index 7347ed2..21b67b1 100644
247--- a/lib/route/route_obj.c
248+++ b/lib/route/route_obj.c
249@@ -31,6 +31,7 @@
250 */
251
252 #include <netlink-private/netlink.h>
253+#include <netlink-private/utils.h>
254 #include <netlink/netlink.h>
255 #include <netlink/cache.h>
256 #include <netlink/utils.h>
257@@ -259,7 +260,7 @@ static void route_dump_details(struct nl_object *a, struct nl_dump_params *p)
258 if ((r->ce_mask & ROUTE_ATTR_CACHEINFO) && r->rt_cacheinfo.rtci_error) {
259 nl_dump_line(p, " cacheinfo error %d (%s)\n",
260 r->rt_cacheinfo.rtci_error,
261- strerror_r(-r->rt_cacheinfo.rtci_error, buf, sizeof(buf)));
262+ nl_strerror_l(-r->rt_cacheinfo.rtci_error));
263 }
264
265 if (r->ce_mask & ROUTE_ATTR_METRICS) {
266diff --git a/lib/socket.c b/lib/socket.c
267index 97b2f69..55153b4 100644
268--- a/lib/socket.c
269+++ b/lib/socket.c
270@@ -33,6 +33,7 @@
271
272 #include <netlink-private/netlink.h>
273 #include <netlink-private/socket.h>
274+#include <netlink-private/utils.h>
275 #include <netlink/netlink.h>
276 #include <netlink/utils.h>
277 #include <netlink/handlers.h>
278@@ -449,11 +450,9 @@ int nl_socket_add_memberships(struct nl_sock *sk, int group, ...)
279 err = setsockopt(sk->s_fd, SOL_NETLINK, NETLINK_ADD_MEMBERSHIP,
280 &group, sizeof(group));
281 if (err < 0) {
282- char buf[64];
283-
284 va_end(ap);
285 NL_DBG(4, "nl_socket_add_memberships(%p): setsockopt() failed with %d (%s)\n",
286- sk, errno, strerror_r(errno, buf, sizeof(buf)));
287+ sk, errno, nl_strerror_l(errno));
288 return -nl_syserr2nlerr(errno);
289 }
290
291@@ -501,11 +500,9 @@ int nl_socket_drop_memberships(struct nl_sock *sk, int group, ...)
292 err = setsockopt(sk->s_fd, SOL_NETLINK, NETLINK_DROP_MEMBERSHIP,
293 &group, sizeof(group));
294 if (err < 0) {
295- char buf[64];
296-
297 va_end(ap);
298 NL_DBG(4, "nl_socket_drop_memberships(%p): setsockopt() failed with %d (%s)\n",
299- sk, errno, strerror_r(errno, buf, sizeof(buf)));
300+ sk, errno, nl_strerror_l(errno));
301 return -nl_syserr2nlerr(errno);
302 }
303
304@@ -619,7 +616,6 @@ int nl_socket_set_fd(struct nl_sock *sk, int protocol, int fd)
305 {
306 int err = 0;
307 socklen_t addrlen;
308- char buf[64];
309 struct sockaddr_nl local = { 0 };
310 int so_type = -1, so_protocol = -1;
311
312@@ -633,7 +629,7 @@ int nl_socket_set_fd(struct nl_sock *sk, int protocol, int fd)
313 &addrlen);
314 if (err < 0) {
315 NL_DBG(4, "nl_socket_set_fd(%p,%d): getsockname() failed with %d (%s)\n",
316- sk, fd, errno, strerror_r(errno, buf, sizeof(buf)));
317+ sk, fd, errno, nl_strerror_l(errno));
318 return -nl_syserr2nlerr(errno);
319 }
320 if (addrlen != sizeof(local))
321@@ -648,7 +644,7 @@ int nl_socket_set_fd(struct nl_sock *sk, int protocol, int fd)
322 err = getsockopt(fd, SOL_SOCKET, SO_TYPE, &so_type, &addrlen);
323 if (err < 0) {
324 NL_DBG(4, "nl_socket_set_fd(%p,%d): getsockopt() for SO_TYPE failed with %d (%s)\n",
325- sk, fd, errno, strerror_r(errno, buf, sizeof(buf)));
326+ sk, fd, errno, nl_strerror_l(errno));
327 return -nl_syserr2nlerr(errno);
328 }
329 if (addrlen != sizeof(so_type))
330@@ -666,7 +662,7 @@ int nl_socket_set_fd(struct nl_sock *sk, int protocol, int fd)
331 if (errno == ENOPROTOOPT)
332 goto no_so_protocol;
333 NL_DBG(4, "nl_socket_set_fd(%p,%d): getsockopt() for SO_PROTOCOL failed with %d (%s)\n",
334- sk, fd, errno, strerror_r(errno, buf, sizeof(buf)));
335+ sk, fd, errno, nl_strerror_l(errno));
336 return -nl_syserr2nlerr(errno);
337 }
338 if (addrlen != sizeof(so_protocol))
339@@ -709,10 +705,8 @@ int nl_socket_set_nonblocking(const struct nl_sock *sk)
340 return -NLE_BAD_SOCK;
341
342 if (fcntl(sk->s_fd, F_SETFL, O_NONBLOCK) < 0) {
343- char buf[64];
344-
345 NL_DBG(4, "nl_socket_set_nonblocking(%p): fcntl() failed with %d (%s)\n",
346- sk, errno, strerror_r(errno, buf, sizeof(buf)));
347+ sk, errno, nl_strerror_l(errno));
348 return -nl_syserr2nlerr(errno);
349 }
350
351@@ -813,7 +807,6 @@ int nl_socket_modify_err_cb(struct nl_sock *sk, enum nl_cb_kind kind,
352 int nl_socket_set_buffer_size(struct nl_sock *sk, int rxbuf, int txbuf)
353 {
354 int err;
355- char buf[64];
356
357 if (rxbuf <= 0)
358 rxbuf = 32768;
359@@ -828,7 +821,7 @@ int nl_socket_set_buffer_size(struct nl_sock *sk, int rxbuf, int txbuf)
360 &txbuf, sizeof(txbuf));
361 if (err < 0) {
362 NL_DBG(4, "nl_socket_set_buffer_size(%p): setsockopt() failed with %d (%s)\n",
363- sk, errno, strerror_r(errno, buf, sizeof(buf)));
364+ sk, errno, nl_strerror_l(errno));
365 return -nl_syserr2nlerr(errno);
366 }
367
368@@ -836,7 +829,7 @@ int nl_socket_set_buffer_size(struct nl_sock *sk, int rxbuf, int txbuf)
369 &rxbuf, sizeof(rxbuf));
370 if (err < 0) {
371 NL_DBG(4, "nl_socket_set_buffer_size(%p): setsockopt() failed with %d (%s)\n",
372- sk, errno, strerror_r(errno, buf, sizeof(buf)));
373+ sk, errno, nl_strerror_l(errno));
374 return -nl_syserr2nlerr(errno);
375 }
376
377@@ -890,10 +883,8 @@ int nl_socket_set_passcred(struct nl_sock *sk, int state)
378 err = setsockopt(sk->s_fd, SOL_SOCKET, SO_PASSCRED,
379 &state, sizeof(state));
380 if (err < 0) {
381- char buf[64];
382-
383 NL_DBG(4, "nl_socket_set_passcred(%p): setsockopt() failed with %d (%s)\n",
384- sk, errno, strerror_r(errno, buf, sizeof(buf)));
385+ sk, errno, nl_strerror_l(errno));
386 return -nl_syserr2nlerr(errno);
387 }
388
389@@ -922,10 +913,8 @@ int nl_socket_recv_pktinfo(struct nl_sock *sk, int state)
390 err = setsockopt(sk->s_fd, SOL_NETLINK, NETLINK_PKTINFO,
391 &state, sizeof(state));
392 if (err < 0) {
393- char buf[64];
394-
395 NL_DBG(4, "nl_socket_recv_pktinfo(%p): setsockopt() failed with %d (%s)\n",
396- sk, errno, strerror_r(errno, buf, sizeof(buf)));
397+ sk, errno, nl_strerror_l(errno));
398 return -nl_syserr2nlerr(errno);
399 }
400
401--
4022.9.3
403
diff --git a/meta/recipes-support/libnl/libnl/0003-src-switch-to-using-strerror_l-instead-of-strerror_r.patch b/meta/recipes-support/libnl/libnl/0003-src-switch-to-using-strerror_l-instead-of-strerror_r.patch
deleted file mode 100644
index a0f5a78092..0000000000
--- a/meta/recipes-support/libnl/libnl/0003-src-switch-to-using-strerror_l-instead-of-strerror_r.patch
+++ /dev/null
@@ -1,82 +0,0 @@
1From 6c2d111177e91184073c44f83d4a6182aaba06d7 Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Andr=C3=A9=20Draszik?= <adraszik@tycoint.com>
3Date: Thu, 25 Aug 2016 13:15:01 +0100
4Subject: [PATCH 3/3] src: switch to using strerror_l() instead of strerror_r()
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9glibc provides two versions of strerror_r(), which
10can be chosen between using feature test macros
11_GNU_SOURCE and _POSIX_C_SOURCE. libnl is built using
12the former, hence we get the glibc special version,
13and all code so far has been written for this.
14
15Other C libraries like musl on the other hand only try
16to be posix compliant, and only ever provide the posix
17version of strerror_r(), which has a different signature.
18
19Uses in libnl hence generally cause printf() of an *int*
20with a *string format* specifier for that reason.
21
22Additionally, strerror_r() has been deprecated:
23 http://austingroupbugs.net/view.php?id=655
24
25Switch to using strerror_l().
26
27Signed-off-by: André Draszik <adraszik@tycoint.com>
28Reviewed-by: Stephane Ayotte <sayotte@tycoint.com>
29Signed-off-by: Thomas Haller <thaller@redhat.com>
30---
31Upstream-Status: Backport https://github.com/thom311/libnl/commit/6c2d111177e91184073c44f83d4a6182aaba06d7
32 src/lib/utils.c | 20 +++++++++++++++++---
33 1 file changed, 17 insertions(+), 3 deletions(-)
34
35diff --git a/src/lib/utils.c b/src/lib/utils.c
36index 467aaed..5878f27 100644
37--- a/src/lib/utils.c
38+++ b/src/lib/utils.c
39@@ -22,6 +22,7 @@
40 */
41
42 #include <netlink/cli/utils.h>
43+#include <locale.h>
44
45 /**
46 * Parse a text based 32 bit unsigned integer argument
47@@ -70,7 +71,6 @@ void nl_cli_print_version(void)
48 void nl_cli_fatal(int err, const char *fmt, ...)
49 {
50 va_list ap;
51- char buf[256];
52
53 fprintf(stderr, "Error: ");
54
55@@ -79,8 +79,22 @@ void nl_cli_fatal(int err, const char *fmt, ...)
56 vfprintf(stderr, fmt, ap);
57 va_end(ap);
58 fprintf(stderr, "\n");
59- } else
60- fprintf(stderr, "%s\n", strerror_r(err, buf, sizeof(buf)));
61+ } else {
62+ char *buf;
63+ locale_t loc = newlocale(LC_MESSAGES_MASK, "", (locale_t)0);
64+ if (loc == (locale_t)0) {
65+ if (errno == ENOENT)
66+ loc = newlocale(LC_MESSAGES_MASK,
67+ "POSIX", (locale_t)0);
68+ if (loc == (locale_t)0)
69+ buf = "newlocale() failed";
70+ }
71+ if (loc != (locale_t)0)
72+ buf = strerror_l(err, loc);
73+ fprintf(stderr, "%s\n", buf);
74+ if (loc != (locale_t)0)
75+ freelocale(loc);
76+ }
77
78 exit(abs(err));
79 }
80--
812.9.3
82
diff --git a/meta/recipes-support/libnl/libnl_3.2.28.bb b/meta/recipes-support/libnl/libnl_3.2.29.bb
index 04e2d18f79..7d4839ba50 100644
--- a/meta/recipes-support/libnl/libnl_3.2.28.bb
+++ b/meta/recipes-support/libnl/libnl_3.2.29.bb
@@ -12,14 +12,11 @@ DEPENDS = "flex-native bison-native"
12SRC_URI = "https://github.com/thom311/${BPN}/releases/download/${BPN}${@d.getVar('PV').replace('.','_')}/${BP}.tar.gz \ 12SRC_URI = "https://github.com/thom311/${BPN}/releases/download/${BPN}${@d.getVar('PV').replace('.','_')}/${BP}.tar.gz \
13 file://fix-pktloc_syntax_h-race.patch \ 13 file://fix-pktloc_syntax_h-race.patch \
14 file://fix-pc-file.patch \ 14 file://fix-pc-file.patch \
15 file://0001-lib-add-utility-function-nl_strerror_l.patch \
16 file://0002-lib-switch-to-using-strerror_l-instead-of-strerror_r.patch \
17 file://0003-src-switch-to-using-strerror_l-instead-of-strerror_r.patch \
18" 15"
19UPSTREAM_CHECK_URI = "https://github.com/thom311/${BPN}/releases" 16UPSTREAM_CHECK_URI = "https://github.com/thom311/${BPN}/releases"
20 17
21SRC_URI[md5sum] = "bab12db1eb94a42129f712a44be91a67" 18SRC_URI[md5sum] = "a8ba62a5c4f883f4e493a46d1f3733fe"
22SRC_URI[sha256sum] = "cd608992c656e8f6e3ab6c1391b162a5a51c49336b9219f7f390e61fc5437c41" 19SRC_URI[sha256sum] = "0beb593dc6abfffa18a5c787b27884979c1b7e7f1fd468c801e3cc938a685922"
23 20
24inherit autotools pkgconfig 21inherit autotools pkgconfig
25 22