summaryrefslogtreecommitdiffstats
path: root/meta/recipes-connectivity/connman/connman
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-connectivity/connman/connman')
-rw-r--r--meta/recipes-connectivity/connman/connman/0001-connman.service-stop-systemd-networkd-when-using-con.patch29
-rw-r--r--meta/recipes-connectivity/connman/connman/0001-src-log.c-Include-libgen.h-for-basename-API.patch55
-rw-r--r--meta/recipes-connectivity/connman/connman/0001-vpn-Adding-support-for-latest-pppd-2.5.0-release.patch152
-rw-r--r--meta/recipes-connectivity/connman/connman/0002-resolve-musl-does-not-implement-res_ninit.patch115
-rw-r--r--meta/recipes-connectivity/connman/connman/connman40
5 files changed, 268 insertions, 123 deletions
diff --git a/meta/recipes-connectivity/connman/connman/0001-connman.service-stop-systemd-networkd-when-using-con.patch b/meta/recipes-connectivity/connman/connman/0001-connman.service-stop-systemd-networkd-when-using-con.patch
deleted file mode 100644
index dd012750a4..0000000000
--- a/meta/recipes-connectivity/connman/connman/0001-connman.service-stop-systemd-networkd-when-using-con.patch
+++ /dev/null
@@ -1,29 +0,0 @@
1From 9fea099d0a3ece37d80ad70d32ebb8a93f8f3280 Mon Sep 17 00:00:00 2001
2From: Yi Zhao <yi.zhao@windriver.com>
3Date: Fri, 30 Oct 2020 13:48:45 +0800
4Subject: [PATCH] connman.service: stop systemd-networkd when using connman
5
6Stop systemd-networkd service when we use connman as network manager.
7
8Upstream-Status: Inappropriate [configuration]
9
10Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
11---
12 src/connman.service.in | 1 +
13 1 file changed, 1 insertion(+)
14
15diff --git a/src/connman.service.in b/src/connman.service.in
16index 79e75d6..014eafe 100644
17--- a/src/connman.service.in
18+++ b/src/connman.service.in
19@@ -6,6 +6,7 @@ RequiresMountsFor=@localstatedir@/lib/connman
20 After=dbus.service network-pre.target systemd-sysusers.service
21 Before=network.target multi-user.target shutdown.target
22 Wants=network.target
23+Conflicts=systemd-networkd.service systemd-networkd.socket
24 Conflicts=systemd-resolved.service
25
26 [Service]
27--
282.17.1
29
diff --git a/meta/recipes-connectivity/connman/connman/0001-src-log.c-Include-libgen.h-for-basename-API.patch b/meta/recipes-connectivity/connman/connman/0001-src-log.c-Include-libgen.h-for-basename-API.patch
new file mode 100644
index 0000000000..8012606db7
--- /dev/null
+++ b/meta/recipes-connectivity/connman/connman/0001-src-log.c-Include-libgen.h-for-basename-API.patch
@@ -0,0 +1,55 @@
1From cbba6638986c2de763981bf6fc59df6a86fed44f Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Mon, 1 Jan 2024 17:42:21 -0800
4Subject: [PATCH v2] src/log.c: Include libgen.h for basename API
5
6Use POSIX version of basename. This comes to front with latest musl
7which dropped the declaration from string.h [1] it fails to build with
8clang-17+ because it treats implicit function declaration as error.
9
10Fix it by applying the basename on a copy of string since posix version
11may modify the input string.
12
13[1] https://git.musl-libc.org/cgit/musl/commit/?id=725e17ed6dff4d0cd22487bb64470881e86a92e7
14
15Upstream-Status: Submitted [https://lore.kernel.org/connman/20240102015917.3732089-1-raj.khem@gmail.com/T/#u]
16Signed-off-by: Khem Raj <raj.khem@gmail.com>
17---
18
19 src/log.c | 6 ++++--
20 1 file changed, 4 insertions(+), 2 deletions(-)
21
22diff --git a/src/log.c b/src/log.c
23index 554b046..2df3af7 100644
24--- a/src/log.c
25+++ b/src/log.c
26@@ -24,6 +24,7 @@
27 #endif
28
29 #include <stdio.h>
30+#include <libgen.h>
31 #include <unistd.h>
32 #include <stdarg.h>
33 #include <stdlib.h>
34@@ -196,6 +197,7 @@ int __connman_log_init(const char *program, const char *debug,
35 const char *program_name, const char *program_version)
36 {
37 static char path[PATH_MAX];
38+ char* tmp = strdup(program);
39 int option = LOG_NDELAY | LOG_PID;
40
41 program_exec = program;
42@@ -212,8 +214,8 @@ int __connman_log_init(const char *program, const char *debug,
43 if (backtrace)
44 signal_setup(signal_handler);
45
46- openlog(basename(program), option, LOG_DAEMON);
47-
48+ openlog(basename(tmp), option, LOG_DAEMON);
49+ free(tmp);
50 syslog(LOG_INFO, "%s version %s", program_name, program_version);
51
52 return 0;
53--
542.43.0
55
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..9e5ac8da15
--- /dev/null
+++ b/meta/recipes-connectivity/connman/connman/0001-vpn-Adding-support-for-latest-pppd-2.5.0-release.patch
@@ -0,0 +1,152 @@
1From af55a6a414d32c12f9ef3cab778385a361e1ad6d 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---
16 scripts/libppp-compat.h | 127 ++++++++++++++++++++++++++++++++++++++++
17 1 file changed, 127 insertions(+)
18 create mode 100644 scripts/libppp-compat.h
19
20diff --git a/scripts/libppp-compat.h b/scripts/libppp-compat.h
21new file mode 100644
22index 0000000..eee1d09
23--- /dev/null
24+++ b/scripts/libppp-compat.h
25@@ -0,0 +1,127 @@
26+/* Copyright (C) Eivind Naess, eivnaes@yahoo.com */
27+/* SPDX-License-Identifier: GPL-2.0-or-later */
28+
29+#ifndef __LIBPPP_COMPAT_H__
30+#define __LIBPPP_COMPAT_H__
31+
32+/* Define USE_EAPTLS compile with EAP TLS support against older pppd headers,
33+ * pppd >= 2.5.0 use PPP_WITH_EAPTLS and is defined in pppdconf.h */
34+#define USE_EAPTLS 1
35+
36+/* Define INET6 to compile with IPv6 support against older pppd headers,
37+ * pppd >= 2.5.0 use PPP_WITH_IPV6CP and is defined in pppdconf.h */
38+#define INET6 1
39+
40+/* PPP < 2.5.0 defines and exports VERSION which overlaps with current package VERSION define.
41+ * this silly macro magic is to work around that. */
42+#undef VERSION
43+#include <pppd/pppd.h>
44+
45+#ifndef PPPD_VERSION
46+#define PPPD_VERSION VERSION
47+#endif
48+
49+#include <pppd/fsm.h>
50+#include <pppd/ccp.h>
51+#include <pppd/eui64.h>
52+#include <pppd/ipcp.h>
53+#include <pppd/ipv6cp.h>
54+#include <pppd/eap.h>
55+#include <pppd/upap.h>
56+
57+#ifdef HAVE_PPPD_CHAP_H
58+#include <pppd/chap.h>
59+#endif
60+
61+#ifdef HAVE_PPPD_CHAP_NEW_H
62+#include <pppd/chap-new.h>
63+#endif
64+
65+#ifdef HAVE_PPPD_CHAP_MS_H
66+#include <pppd/chap_ms.h>
67+#endif
68+
69+#ifndef PPP_PROTO_CHAP
70+#define PPP_PROTO_CHAP 0xc223
71+#endif
72+
73+#ifndef PPP_PROTO_EAP
74+#define PPP_PROTO_EAP 0xc227
75+#endif
76+
77+
78+#if WITH_PPP_VERSION < PPP_VERSION(2,5,0)
79+
80+static inline bool
81+debug_on (void)
82+{
83+ return debug;
84+}
85+
86+static inline const char
87+*ppp_ipparam (void)
88+{
89+ return ipparam;
90+}
91+
92+static inline int
93+ppp_ifunit (void)
94+{
95+ return ifunit;
96+}
97+
98+static inline const char *
99+ppp_ifname (void)
100+{
101+ return ifname;
102+}
103+
104+static inline int
105+ppp_get_mtu (int idx)
106+{
107+ return netif_get_mtu(idx);
108+}
109+
110+typedef enum ppp_notify
111+{
112+ NF_PID_CHANGE,
113+ NF_PHASE_CHANGE,
114+ NF_EXIT,
115+ NF_SIGNALED,
116+ NF_IP_UP,
117+ NF_IP_DOWN,
118+ NF_IPV6_UP,
119+ NF_IPV6_DOWN,
120+ NF_AUTH_UP,
121+ NF_LINK_DOWN,
122+ NF_FORK,
123+ NF_MAX_NOTIFY
124+} ppp_notify_t;
125+
126+typedef void (ppp_notify_fn) (void *ctx, int arg);
127+
128+static inline void
129+ppp_add_notify (ppp_notify_t type, ppp_notify_fn *func, void *ctx)
130+{
131+ struct notifier **list[NF_MAX_NOTIFY] = {
132+ [NF_PID_CHANGE ] = &pidchange,
133+ [NF_PHASE_CHANGE] = &phasechange,
134+ [NF_EXIT ] = &exitnotify,
135+ [NF_SIGNALED ] = &sigreceived,
136+ [NF_IP_UP ] = &ip_up_notifier,
137+ [NF_IP_DOWN ] = &ip_down_notifier,
138+ [NF_IPV6_UP ] = &ipv6_up_notifier,
139+ [NF_IPV6_DOWN ] = &ipv6_down_notifier,
140+ [NF_AUTH_UP ] = &auth_up_notifier,
141+ [NF_LINK_DOWN ] = &link_down_notifier,
142+ [NF_FORK ] = &fork_notifier,
143+ };
144+
145+ struct notifier **notify = list[type];
146+ if (notify) {
147+ add_notifier(notify, func, ctx);
148+ }
149+}
150+
151+#endif /* #if WITH_PPP_VERSION < PPP_VERSION(2,5,0) */
152+#endif /* #if__LIBPPP_COMPAT_H__ */
diff --git a/meta/recipes-connectivity/connman/connman/0002-resolve-musl-does-not-implement-res_ninit.patch b/meta/recipes-connectivity/connman/connman/0002-resolve-musl-does-not-implement-res_ninit.patch
index 942b9c97b6..9e2cc34995 100644
--- a/meta/recipes-connectivity/connman/connman/0002-resolve-musl-does-not-implement-res_ninit.patch
+++ b/meta/recipes-connectivity/connman/connman/0002-resolve-musl-does-not-implement-res_ninit.patch
@@ -1,83 +1,88 @@
1From c7734e1547db967eccf242fe4b9e8a30b9ff141c Mon Sep 17 00:00:00 2001 1From 60783f0d885c9a0db8b6f1d528786321e53f1512 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Mon, 6 Apr 2015 23:02:21 -0700 3Date: Mon, 6 Apr 2015 23:02:21 -0700
4Subject: [PATCH] resolve: musl does not implement res_ninit 4Subject: [PATCH] gweb/gresolv.c: make use of res_ninit optional and subject to
5 __RES
5 6
6ported from 7Not all libc implementation have those functions, and the way to determine
8if they do is to check __RES which is explained in resolv.h thusly:
9
10/*
11 * Revision information. This is the release date in YYYYMMDD format.
12 * It can change every day so the right thing to do with it is use it
13 * in preprocessor commands such as "#if (__RES > 19931104)". Do not
14 * compare for equality; rather, use it to determine whether your resolver
15 * is new enough to contain a certain feature.
16 */
17
18Indeed, it needs to be at least 19991006.
19
20The portion of the patch that implements a fallback is ported from
21Alpine Linux:
7http://git.alpinelinux.org/cgit/aports/plain/testing/connman/libresolv.patch 22http://git.alpinelinux.org/cgit/aports/plain/testing/connman/libresolv.patch
8 23
9Upstream-Status: Pending 24Upstream-Status: Submitted [to connman@lists.linux.dev,marcel@holtmann.org]
10 25
11Signed-off-by: Khem Raj <raj.khem@gmail.com> 26Signed-off-by: Khem Raj <raj.khem@gmail.com>
12
13--- 27---
14 gweb/gresolv.c | 34 +++++++++++++--------------------- 28 gweb/gresolv.c | 21 +++++++++++++++++++++
15 1 file changed, 13 insertions(+), 21 deletions(-) 29 1 file changed, 21 insertions(+)
16 30
17diff --git a/gweb/gresolv.c b/gweb/gresolv.c 31diff --git a/gweb/gresolv.c b/gweb/gresolv.c
18index 38a554e..a9e8740 100644 32index 8101d71..9f1477c 100644
19--- a/gweb/gresolv.c 33--- a/gweb/gresolv.c
20+++ b/gweb/gresolv.c 34+++ b/gweb/gresolv.c
21@@ -36,6 +36,7 @@ 35@@ -879,7 +879,9 @@ GResolv *g_resolv_new(int index)
22 #include <arpa/inet.h>
23 #include <arpa/nameser.h>
24 #include <net/if.h>
25+#include <ctype.h>
26
27 #include "gresolv.h"
28
29@@ -877,8 +878,6 @@ GResolv *g_resolv_new(int index)
30 resolv->index = index; 36 resolv->index = index;
31 resolv->nameserver_list = NULL; 37 resolv->nameserver_list = NULL;
32 38
33- res_ninit(&resolv->res); 39+#if (__RES >= 19991006)
34- 40 res_ninit(&resolv->res);
41+#endif
42
35 return resolv; 43 return resolv;
36 } 44 }
37 45@@ -920,7 +922,9 @@ void g_resolv_unref(GResolv *resolv)
38@@ -918,8 +917,6 @@ void g_resolv_unref(GResolv *resolv)
39 46
40 flush_nameservers(resolv); 47 flush_nameservers(resolv);
41 48
42- res_nclose(&resolv->res); 49+#if (__RES >= 19991006)
43- 50 res_nclose(&resolv->res);
51+#endif
52
44 g_free(resolv); 53 g_free(resolv);
45 } 54 }
46 55@@ -1024,6 +1028,7 @@ guint g_resolv_lookup_hostname(GResolv *resolv, const char *hostname,
47@@ -1022,24 +1019,19 @@ guint g_resolv_lookup_hostname(GResolv *resolv, const char *hostname,
48 debug(resolv, "hostname %s", hostname); 56 debug(resolv, "hostname %s", hostname);
49 57
50 if (!resolv->nameserver_list) { 58 if (!resolv->nameserver_list) {
51- int i; 59+#if (__RES >= 19991006)
52- 60 int i;
53- for (i = 0; i < resolv->res.nscount; i++) { 61
54- char buf[100]; 62 for (i = 0; i < resolv->res.nscount; i++) {
55- int family = resolv->res.nsaddr_list[i].sin_family; 63@@ -1043,6 +1048,22 @@ guint g_resolv_lookup_hostname(GResolv *resolv, const char *hostname,
56- void *sa_addr = &resolv->res.nsaddr_list[i].sin_addr; 64 if (inet_ntop(family, sa_addr, buf, sizeof(buf)))
57- 65 g_resolv_add_nameserver(resolv, buf, 53, 0);
58- if (family != AF_INET &&
59- resolv->res._u._ext.nsaddrs[i]) {
60- family = AF_INET6;
61- sa_addr = &resolv->res._u._ext.nsaddrs[i]->sin6_addr;
62+ FILE *f = fopen("/etc/resolv.conf", "r");
63+ if (f) {
64+ char line[256], *s;
65+ int i;
66+ while (fgets(line, sizeof(line), f)) {
67+ if (strncmp(line, "nameserver", 10) || !isspace(line[10]))
68+ continue;
69+ for (s = &line[11]; isspace(s[0]); s++);
70+ for (i = 0; s[i] && !isspace(s[i]); i++);
71+ s[i] = 0;
72+ g_resolv_add_nameserver(resolv, s, 53, 0);
73 }
74-
75- if (family != AF_INET && family != AF_INET6)
76- continue;
77-
78- if (inet_ntop(family, sa_addr, buf, sizeof(buf)))
79- g_resolv_add_nameserver(resolv, buf, 53, 0);
80+ fclose(f);
81 } 66 }
67+#else
68+ FILE *f = fopen("/etc/resolv.conf", "r");
69+ if (f) {
70+ char line[256], *s;
71+ int i;
72+ while (fgets(line, sizeof(line), f)) {
73+ if (strncmp(line, "nameserver", 10) || !isspace(line[10]))
74+ continue;
75+ for (s = &line[11]; isspace(s[0]); s++);
76+ for (i = 0; s[i] && !isspace(s[i]); i++);
77+ s[i] = 0;
78+ g_resolv_add_nameserver(resolv, s, 53, 0);
79+ }
80+ fclose(f);
81+ }
82+#endif
82 83
83 if (!resolv->nameserver_list) 84 if (!resolv->nameserver_list)
85 g_resolv_add_nameserver(resolv, "127.0.0.1", 53, 0);
86--
872.39.2
88
diff --git a/meta/recipes-connectivity/connman/connman/connman b/meta/recipes-connectivity/connman/connman/connman
index c64fa0d715..a021fd4655 100644
--- a/meta/recipes-connectivity/connman/connman/connman
+++ b/meta/recipes-connectivity/connman/connman/connman
@@ -10,49 +10,11 @@ fi
10 10
11set -e 11set -e
12 12
13nfsroot=0
14
15exec 9<&0 < /proc/mounts
16while read dev mtpt fstype rest; do
17 if test $mtpt = "/" ; then
18 case $fstype in
19 nfs | nfs4)
20 nfsroot=1
21 break
22 ;;
23 *)
24 ;;
25 esac
26 fi
27done
28
29do_start() { 13do_start() {
30 EXTRA_PARAM=""
31 if test $nfsroot -eq 1 ; then
32 NET_DEVS=`cat /proc/net/dev | sed -ne 's/^\([a-zA-Z0-9 ]*\):.*$/\1/p'`
33 NET_ADDR=`cat /proc/cmdline | sed -ne 's/^.*ip=\([^ :]*\).*$/\1/p'`
34
35 if [ ! -z "$NET_ADDR" ]; then
36 if [ "$NET_ADDR" = dhcp ]; then
37 ethn=`ifconfig | grep "^eth" | sed -e "s/\(eth[0-9]\)\(.*\)/\1/"`
38 if [ ! -z "$ethn" ]; then
39 EXTRA_PARAM="-I $ethn"
40 fi
41 else
42 for i in $NET_DEVS; do
43 ADDR=`ifconfig $i | sed 's/addr://g' | sed -ne 's/^.*inet \([0-9.]*\) .*$/\1/p'`
44 if [ "$NET_ADDR" = "$ADDR" ]; then
45 EXTRA_PARAM="-I $i"
46 break
47 fi
48 done
49 fi
50 fi
51 fi
52 if [ -f @DATADIR@/connman/wired-setup ] ; then 14 if [ -f @DATADIR@/connman/wired-setup ] ; then
53 . @DATADIR@/connman/wired-setup 15 . @DATADIR@/connman/wired-setup
54 fi 16 fi
55 $DAEMON $EXTRA_PARAM 17 $DAEMON
56} 18}
57 19
58do_stop() { 20do_stop() {