wok-current view ppp-pam/stuff/ppp-glibc.patch @ rev 25642
Bump linux to 4.19.305, add linux-pae-ipv6
author | Stanislas Leduc <shann@slitaz.org> |
---|---|
date | Wed Jan 17 12:05:22 2024 +0000 (12 months ago) |
parents | |
children |
line source
1 From 98ec18f098e5ef68e3a8cc6954fcaf5a7fb8b7be Mon Sep 17 00:00:00 2001
2 From: pali <7141871+pali@users.noreply.github.com>
3 Date: Mon, 15 Feb 2021 07:54:01 +0100
4 Subject: [PATCH] pppd: Fix compilation with older glibc or kernel headers
5 (#248)
6 MIME-Version: 1.0
7 Content-Type: text/plain; charset=UTF-8
8 Content-Transfer-Encoding: 8bit
10 glibc versions prior to 2.24 do not define SOL_NETLINK and linux kernel
11 versions prior to 4.3 do not define NETLINK_CAP_ACK. So add fallback
12 definitions for these macros into pppd/sys-linux.c file.
14 Also extend description why we call SOL_NETLINK/NETLINK_CAP_ACK option.
16 Signed-off-by: Pali Rohár <pali@kernel.org>
18 [Retrieved from:
19 https://github.com/ppp-project/ppp/commit/98ec18f098e5ef68e3a8cc6954fcaf5a7fb8b7be]
20 Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
21 ---
22 pppd/sys-linux.c | 18 +++++++++++++++++-
23 1 file changed, 17 insertions(+), 1 deletion(-)
25 diff --git a/pppd/sys-linux.c b/pppd/sys-linux.c
26 index 85033d97..50c4f2da 100644
27 --- a/pppd/sys-linux.c
28 +++ b/pppd/sys-linux.c
29 @@ -125,6 +125,14 @@
30 #include <linux/netlink.h>
31 #include <linux/rtnetlink.h>
32 #include <linux/if_addr.h>
33 +/* glibc versions prior to 2.24 do not define SOL_NETLINK */
34 +#ifndef SOL_NETLINK
35 +#define SOL_NETLINK 270
36 +#endif
37 +/* linux kernel versions prior to 4.3 do not define/support NETLINK_CAP_ACK */
38 +#ifndef NETLINK_CAP_ACK
39 +#define NETLINK_CAP_ACK 10
40 +#endif
41 #endif
43 #include "pppd.h"
44 @@ -2843,7 +2851,15 @@ static int append_peer_ipv6_address(unsigned int iface, struct in6_addr *local_a
45 if (fd < 0)
46 return 0;
48 - /* do not ask for error message content */
49 + /*
50 + * Tell kernel to not send to us payload of acknowledgment error message.
51 + * NETLINK_CAP_ACK option is supported since Linux kernel version 4.3 and
52 + * older kernel versions always send full payload in acknowledgment netlink
53 + * message. We ignore payload of this message as we need only error code,
54 + * to check if our set remote peer address request succeeded or failed.
55 + * So ignore return value from the following setsockopt() call as setting
56 + * option NETLINK_CAP_ACK means for us just a kernel hint / optimization.
57 + */
58 one = 1;
59 setsockopt(fd, SOL_NETLINK, NETLINK_CAP_ACK, &one, sizeof(one));