summaryrefslogtreecommitdiffstats
path: root/meta/recipes-connectivity/connman
diff options
context:
space:
mode:
authorMartin Jansa <Martin.Jansa@gmail.com>2023-05-28 06:31:22 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2023-05-29 13:42:00 +0100
commit2e44751098ceac559b6ecc6585541606617e8cab (patch)
treebd83cbb5c567bd639210aad73a5af4f308bc75c5 /meta/recipes-connectivity/connman
parent9e3a0a060f4b0695d9cf25766ac457f5f08a86cb (diff)
downloadpoky-2e44751098ceac559b6ecc6585541606617e8cab.tar.gz
connman: backport a fix for build with pppd-2.5.0
* pppd was upgraded in: https://git.openembedded.org/openembedded-core/commit/?id=5512bf4dfd299b8d5d474d9f26c2146b3e53514a * connman fails to build with pptp or l2tp PACKAGECONFIG is enabled (From OE-Core rev: 0688b307c82c8cc454633ff92e4bc06987a7ac77) Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-connectivity/connman')
-rw-r--r--meta/recipes-connectivity/connman/connman/0001-vpn-Adding-support-for-latest-pppd-2.5.0-release.patch274
-rw-r--r--meta/recipes-connectivity/connman/connman_1.41.bb1
2 files changed, 275 insertions, 0 deletions
diff --git a/meta/recipes-connectivity/connman/connman/0001-vpn-Adding-support-for-latest-pppd-2.5.0-release.patch b/meta/recipes-connectivity/connman/connman/0001-vpn-Adding-support-for-latest-pppd-2.5.0-release.patch
new file mode 100644
index 0000000000..83343fdda5
--- /dev/null
+++ b/meta/recipes-connectivity/connman/connman/0001-vpn-Adding-support-for-latest-pppd-2.5.0-release.patch
@@ -0,0 +1,274 @@
1From 5f373f373f5baccc282dce257b7b16c8bb4a82c4 Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Eivind=20N=C3=A6ss?= <eivnaes@yahoo.com>
3Date: Sat, 25 Mar 2023 20:51:52 +0000
4Subject: [PATCH] vpn: Adding support for latest pppd 2.5.0 release
5
6The API has gone through a significant overhaul, and this change fixes any compile issues.
71) Fixes to configure.ac itself
82) Cleanup in pppd plugin itself
9
10Adding a libppp-compat.h file to mask for any differences in the version.
11
12Upstream-Status: Backport [https://git.kernel.org/pub/scm/network/connman/connman.git/commit/?id=a48864a2e5d2a725dfc6eef567108bc13b43857f]
13Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
14---
15 configure.ac | 42 ++++++++-----
16 scripts/libppp-compat.h | 127 ++++++++++++++++++++++++++++++++++++++++
17 scripts/libppp-plugin.c | 15 +++--
18 3 files changed, 161 insertions(+), 23 deletions(-)
19 create mode 100644 scripts/libppp-compat.h
20
21diff --git a/configure.ac b/configure.ac
22index a573cef..f34bb38 100644
23--- a/configure.ac
24+++ b/configure.ac
25@@ -135,14 +135,6 @@ AC_ARG_ENABLE(l2tp,
26 AC_HELP_STRING([--enable-l2tp], [enable l2tp support]),
27 [enable_l2tp=${enableval}], [enable_l2tp="no"])
28 if (test "${enable_l2tp}" != "no"); then
29- if (test -z "${path_pppd}"); then
30- AC_PATH_PROG(PPPD, [pppd], [/usr/sbin/pppd], $PATH:/sbin:/usr/sbin)
31- else
32- PPPD="${path_pppd}"
33- AC_SUBST(PPPD)
34- fi
35- AC_CHECK_HEADERS(pppd/pppd.h, dummy=yes,
36- AC_MSG_ERROR(ppp header files are required))
37 if (test -z "${path_l2tp}"); then
38 AC_PATH_PROG(L2TP, [xl2tpd], [/usr/sbin/xl2tpd], $PATH:/sbin:/usr/sbin)
39 else
40@@ -160,6 +152,18 @@ AC_ARG_ENABLE(pptp,
41 AC_HELP_STRING([--enable-pptp], [enable pptp support]),
42 [enable_pptp=${enableval}], [enable_pptp="no"])
43 if (test "${enable_pptp}" != "no"); then
44+ if (test -z "${path_pptp}"); then
45+ AC_PATH_PROG(PPTP, [pptp], [/usr/sbin/pptp], $PATH:/sbin:/usr/sbin)
46+ else
47+ PPTP="${path_pptp}"
48+ AC_SUBST(PPTP)
49+ fi
50+fi
51+AM_CONDITIONAL(PPTP, test "${enable_pptp}" != "no")
52+AM_CONDITIONAL(PPTP_BUILTIN, test "${enable_pptp}" = "builtin")
53+
54+if (test "${enable_pptp}" != "no" || test "${enable_l2tp}" != "no"); then
55+
56 if (test -z "${path_pppd}"); then
57 AC_PATH_PROG(PPPD, [pppd], [/usr/sbin/pppd], $PATH:/sbin:/usr/sbin)
58 else
59@@ -168,15 +172,23 @@ if (test "${enable_pptp}" != "no"); then
60 fi
61 AC_CHECK_HEADERS(pppd/pppd.h, dummy=yes,
62 AC_MSG_ERROR(ppp header files are required))
63- if (test -z "${path_pptp}"); then
64- AC_PATH_PROG(PPTP, [pptp], [/usr/sbin/pptp], $PATH:/sbin:/usr/sbin)
65- else
66- PPTP="${path_pptp}"
67- AC_SUBST(PPTP)
68+ AC_CHECK_HEADERS([pppd/chap.h pppd/chap-new.h pppd/chap_ms.h])
69+
70+ PKG_CHECK_EXISTS([pppd],
71+ [AS_VAR_SET([pppd_pkgconfig_support],[yes])])
72+
73+ PPPD_VERSION=2.4.9
74+ if test x"$pppd_pkgconfig_support" = xyes; then
75+ PPPD_VERSION=`$PKG_CONFIG --modversion pppd`
76 fi
77+
78+ AC_DEFINE_UNQUOTED([PPP_VERSION(x,y,z)],
79+ [((x & 0xFF) << 16 | (y & 0xFF) << 8 | (z & 0xFF) << 0)],
80+ [Macro to help determine the particular version of pppd])
81+ PPP_VERSION=$(echo $PPPD_VERSION | sed -e "s/\./\,/g")
82+ AC_DEFINE_UNQUOTED(WITH_PPP_VERSION, PPP_VERSION($PPP_VERSION),
83+ [The real version of pppd represented as an int])
84 fi
85-AM_CONDITIONAL(PPTP, test "${enable_pptp}" != "no")
86-AM_CONDITIONAL(PPTP_BUILTIN, test "${enable_pptp}" = "builtin")
87
88 AC_CHECK_HEADERS(resolv.h, dummy=yes,
89 AC_MSG_ERROR(resolver header files are required))
90diff --git a/scripts/libppp-compat.h b/scripts/libppp-compat.h
91new file mode 100644
92index 0000000..eee1d09
93--- /dev/null
94+++ b/scripts/libppp-compat.h
95@@ -0,0 +1,127 @@
96+/* Copyright (C) Eivind Naess, eivnaes@yahoo.com */
97+/* SPDX-License-Identifier: GPL-2.0-or-later */
98+
99+#ifndef __LIBPPP_COMPAT_H__
100+#define __LIBPPP_COMPAT_H__
101+
102+/* Define USE_EAPTLS compile with EAP TLS support against older pppd headers,
103+ * pppd >= 2.5.0 use PPP_WITH_EAPTLS and is defined in pppdconf.h */
104+#define USE_EAPTLS 1
105+
106+/* Define INET6 to compile with IPv6 support against older pppd headers,
107+ * pppd >= 2.5.0 use PPP_WITH_IPV6CP and is defined in pppdconf.h */
108+#define INET6 1
109+
110+/* PPP < 2.5.0 defines and exports VERSION which overlaps with current package VERSION define.
111+ * this silly macro magic is to work around that. */
112+#undef VERSION
113+#include <pppd/pppd.h>
114+
115+#ifndef PPPD_VERSION
116+#define PPPD_VERSION VERSION
117+#endif
118+
119+#include <pppd/fsm.h>
120+#include <pppd/ccp.h>
121+#include <pppd/eui64.h>
122+#include <pppd/ipcp.h>
123+#include <pppd/ipv6cp.h>
124+#include <pppd/eap.h>
125+#include <pppd/upap.h>
126+
127+#ifdef HAVE_PPPD_CHAP_H
128+#include <pppd/chap.h>
129+#endif
130+
131+#ifdef HAVE_PPPD_CHAP_NEW_H
132+#include <pppd/chap-new.h>
133+#endif
134+
135+#ifdef HAVE_PPPD_CHAP_MS_H
136+#include <pppd/chap_ms.h>
137+#endif
138+
139+#ifndef PPP_PROTO_CHAP
140+#define PPP_PROTO_CHAP 0xc223
141+#endif
142+
143+#ifndef PPP_PROTO_EAP
144+#define PPP_PROTO_EAP 0xc227
145+#endif
146+
147+
148+#if WITH_PPP_VERSION < PPP_VERSION(2,5,0)
149+
150+static inline bool
151+debug_on (void)
152+{
153+ return debug;
154+}
155+
156+static inline const char
157+*ppp_ipparam (void)
158+{
159+ return ipparam;
160+}
161+
162+static inline int
163+ppp_ifunit (void)
164+{
165+ return ifunit;
166+}
167+
168+static inline const char *
169+ppp_ifname (void)
170+{
171+ return ifname;
172+}
173+
174+static inline int
175+ppp_get_mtu (int idx)
176+{
177+ return netif_get_mtu(idx);
178+}
179+
180+typedef enum ppp_notify
181+{
182+ NF_PID_CHANGE,
183+ NF_PHASE_CHANGE,
184+ NF_EXIT,
185+ NF_SIGNALED,
186+ NF_IP_UP,
187+ NF_IP_DOWN,
188+ NF_IPV6_UP,
189+ NF_IPV6_DOWN,
190+ NF_AUTH_UP,
191+ NF_LINK_DOWN,
192+ NF_FORK,
193+ NF_MAX_NOTIFY
194+} ppp_notify_t;
195+
196+typedef void (ppp_notify_fn) (void *ctx, int arg);
197+
198+static inline void
199+ppp_add_notify (ppp_notify_t type, ppp_notify_fn *func, void *ctx)
200+{
201+ struct notifier **list[NF_MAX_NOTIFY] = {
202+ [NF_PID_CHANGE ] = &pidchange,
203+ [NF_PHASE_CHANGE] = &phasechange,
204+ [NF_EXIT ] = &exitnotify,
205+ [NF_SIGNALED ] = &sigreceived,
206+ [NF_IP_UP ] = &ip_up_notifier,
207+ [NF_IP_DOWN ] = &ip_down_notifier,
208+ [NF_IPV6_UP ] = &ipv6_up_notifier,
209+ [NF_IPV6_DOWN ] = &ipv6_down_notifier,
210+ [NF_AUTH_UP ] = &auth_up_notifier,
211+ [NF_LINK_DOWN ] = &link_down_notifier,
212+ [NF_FORK ] = &fork_notifier,
213+ };
214+
215+ struct notifier **notify = list[type];
216+ if (notify) {
217+ add_notifier(notify, func, ctx);
218+ }
219+}
220+
221+#endif /* #if WITH_PPP_VERSION < PPP_VERSION(2,5,0) */
222+#endif /* #if__LIBPPP_COMPAT_H__ */
223diff --git a/scripts/libppp-plugin.c b/scripts/libppp-plugin.c
224index 0dd8b47..61641b5 100644
225--- a/scripts/libppp-plugin.c
226+++ b/scripts/libppp-plugin.c
227@@ -29,14 +29,13 @@
228 #include <sys/types.h>
229 #include <sys/stat.h>
230 #include <fcntl.h>
231-#include <pppd/pppd.h>
232-#include <pppd/fsm.h>
233-#include <pppd/ipcp.h>
234 #include <netinet/in.h>
235 #include <arpa/inet.h>
236
237 #include <dbus/dbus.h>
238
239+#include "libppp-compat.h"
240+
241 #define INET_ADDRES_LEN (INET_ADDRSTRLEN + 5)
242 #define INET_DNS_LEN (2*INET_ADDRSTRLEN + 9)
243
244@@ -47,7 +46,7 @@ static char *path;
245 static DBusConnection *connection;
246 static int prev_phase;
247
248-char pppd_version[] = VERSION;
249+char pppd_version[] = PPPD_VERSION;
250
251 int plugin_init(void);
252
253@@ -170,7 +169,7 @@ static void ppp_up(void *data, int arg)
254 DBUS_TYPE_STRING_AS_STRING DBUS_TYPE_STRING_AS_STRING
255 DBUS_DICT_ENTRY_END_CHAR_AS_STRING, &dict);
256
257- append(&dict, "INTERNAL_IFNAME", ifname);
258+ append(&dict, "INTERNAL_IFNAME", ppp_ifname());
259
260 inet_ntop(AF_INET, &ipcp_gotoptions[0].ouraddr, buf, INET_ADDRSTRLEN);
261 append(&dict, "INTERNAL_IP4_ADDRESS", buf);
262@@ -309,9 +308,9 @@ int plugin_init(void)
263 chap_check_hook = ppp_have_secret;
264 pap_check_hook = ppp_have_secret;
265
266- add_notifier(&ip_up_notifier, ppp_up, NULL);
267- add_notifier(&phasechange, ppp_phase_change, NULL);
268- add_notifier(&exitnotify, ppp_exit, connection);
269+ ppp_add_notify(NF_IP_UP, ppp_up, NULL);
270+ ppp_add_notify(NF_PHASE_CHANGE, ppp_phase_change, NULL);
271+ ppp_add_notify(NF_EXIT, ppp_exit, connection);
272
273 return 0;
274 }
diff --git a/meta/recipes-connectivity/connman/connman_1.41.bb b/meta/recipes-connectivity/connman/connman_1.41.bb
index 3f2e29820f..d8ac1f5cde 100644
--- a/meta/recipes-connectivity/connman/connman_1.41.bb
+++ b/meta/recipes-connectivity/connman/connman_1.41.bb
@@ -9,6 +9,7 @@ SRC_URI = "${KERNELORG_MIRROR}/linux/network/${BPN}/${BP}.tar.xz \
9 file://CVE-2022-32293_p2.patch \ 9 file://CVE-2022-32293_p2.patch \
10 file://CVE-2022-32292.patch \ 10 file://CVE-2022-32292.patch \
11 file://0001-gdhcp-Verify-and-sanitize-packet-length-first.patch \ 11 file://0001-gdhcp-Verify-and-sanitize-packet-length-first.patch \
12 file://0001-vpn-Adding-support-for-latest-pppd-2.5.0-release.patch \
12 " 13 "
13 14
14SRC_URI:append:libc-musl = " file://0002-resolve-musl-does-not-implement-res_ninit.patch" 15SRC_URI:append:libc-musl = " file://0002-resolve-musl-does-not-implement-res_ninit.patch"