community/connman: upgrade to 1.42

This commit is contained in:
Celeste 2023-08-08 01:38:17 +00:00 committed by Simon Zeni
parent 69a51d5cb0
commit f7fbafab4e
4 changed files with 138 additions and 362 deletions

View File

@ -2,8 +2,8 @@
# Contributor: Valery Kartel <valery.kartel@gmail.com>
# Contributor: Jakub Jirutka <jakub@jirutka.cz>
pkgname=connman
pkgver=1.41
pkgrel=4
pkgver=1.42
pkgrel=0
pkgdesc="Daemon for managing internet connections"
url="https://git.kernel.org/pub/scm/network/connman/connman.git"
arch="all"
@ -41,9 +41,8 @@ subpackages="
source="https://www.kernel.org/pub/linux/network/connman/connman-$pkgver.tar.xz
libresolv.patch
dbus-rules.patch
add-ethernet-prop-for-vpn-to-dbus.patch
implicit.patch
pppd-2.5.patch
ppp-missing-header.patch
openvpn.conf
$pkgname.initd
$pkgname.confd
@ -172,12 +171,11 @@ wireguard() {
}
sha512sums="
b7880d908635ab9350c12e207213d20b11c1a50afcb93ae92e1fc57d4345bf792afe1a5534650e18b8cd05a3766ce9993083b2d659e49f87b867e6f2c1a83b2d connman-1.41.tar.xz
d919080b91fb61806c0e948be14e26bfe5d2501865f76b2e2dddd4cef8c46c0f7aa26406ed938b347889e48adc726e53bbb415bf9c280f9310597045da784ace connman-1.42.tar.xz
122b48fc9e25354e25ba3a3e0864bdd84da84457fed94aeea726bcb189b2f05f2cc361ae15f44af5c49bcee572e91e4c0488ef3b0bc79d20f6efe15853fb6b3a libresolv.patch
0223dba51be67c131c297d0e865fe1276e4800be5eee25c4f142df8e651318bf5dae98c1d559bb70c002cdfc3ce3c24d12128ddca5656192f962d91af6906caa dbus-rules.patch
fa2cd99400ebff23d4397c3ac61f771cbf7b3ce3dfe93d71ed311f66a09d16d0ff87d7f6737da606cac29933231f89cfa9fe6872fe8cac12acfc133b53cbc05e add-ethernet-prop-for-vpn-to-dbus.patch
e4095b51de42b31da6bc892e70be6dbcb34451348e90f50f1779c31a11a6b69013f50bafe156aacdfce4b49c2abdbd56cea62ecec20427bf2f6f942777f3c270 implicit.patch
51bf44084acbd725264f1a67e2abf0aeb1a717fc60b1cf15259ca94c48518bf666bf59f96be439cdfea9fa0c67afd0a7f526fe7e429e8533c9220312c7d20177 pppd-2.5.patch
e6caff8721324a5d02465da53fcca9616d0812c3fd36e874e96919bcc252cfcc471ed2d7f95e3cf24a0930fb3611b49171fe29b9e6f25f567c9a5375f34954df ppp-missing-header.patch
7f90bfdbe27a468c401bde04ccedc7d15afba11ca460ee6155233c3ef99285033303cbf7afac3849cbcd6e95a90eae5bdc772e416aef57e5ada7c4eed38f4de9 openvpn.conf
f5cdeba7ebdbe52424ebe74088d57ff57d45dcdbfa6f17cfe7bfa59308c8188174e0f44a86ffaea8a7247793fbffc1463bbd791033e188f1f44f80847fbf71e0 connman.initd
73f505a777df04039ca51bc3959aa89969a0bbc21ea971fb98e04e9b5851553de35955453ed859f5a6273724bbcce38f13012950c6cb4e0a2bc80bc531ccff1e connman.confd

View File

@ -1,79 +0,0 @@
Patch-Source: https://lore.kernel.org/connman/20220426194853.13343-1-jakub@jirutka.cz
--
From: Jakub Jirutka <jakub@jirutka.cz>
Subject: [PATCH] service: Add "Ethernet" property for VPN into n.c.Manager GetServices
Date: Tue, 26 Apr 2022 21:48:53 +0200
Scope:
This patch affects the Service properties exposed by D-Bus method
GetServices in interface net.connman.Manager.
Before (current state):
Services of type WIFI, ETHERNET, BLUETOOTH, and GADGET have property
"Ethernet" with a dictionary of "Method", "Interface", "Address", and
"MTU". Services of type VPN (and also P2P, GPS, and SYSTEM) don't include
this property, althrough VPNs are IP-based too and the data is available
(at least for some, e.g. OpenVPN, not sure if all).
After (proposed change):
Even services of type VPN includes property "Ethernet".
Motivation:
ConnMan integration with resolvconf(8) via D-Bus
(https://github.com/jirutka/connman-resolvconf) - I need to know
"Interface" even for VPN services.
Considerations:
Function append_ethernet in src/service.c checks if either
service->ipconfig_ipv4 or service->ipconfig_ipv6 is non-NULL and do
nothing if this condition is not satisfied. Otherwise,
__connman_ipconfig_append_ethernet from src/ipconfig.c is called.
This function checks if the index of passed service->ipconfig_ipv4
(or _ipv6) is present in ipdevice_hash. If it's not, it just sets
"Method" property with value "auto" and returns.
Thus I think this change shouldn't break anything, even if ipconfig
data is not available for some VPN types. I tested it myself with just
OpenVPN provider though.
This may introduce an asymmetry between Service properties returned by
GetServices and signal PropertyChanged in interface net.connman.Service
- change in "Ethernet" is currently not being announced for VPN
services. I originally wanted to implement this as well (actually, before
GetServices), but got lost in code duplication and unclear relation
between src/ and vpn/.
Anyway, I don't think this asymetry is a problem (and probably more
asymetries already exist there?).
I didn't consider method GetProperties in interface net.connman.Service
at all, because it's marked as deprecated. However, I hope that it
calls the same functions as the method GetServices.
The same change should be considered even for P2P services, but I don't
use this service type and didn't look into its specifics.
---
src/service.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/service.c b/src/service.c
index 66ab99d8..988928e7 100644
--- a/src/service.c
+++ b/src/service.c
@@ -2593,7 +2593,6 @@ static void append_properties(DBusMessageIter *dict, dbus_bool_t limited,
case CONNMAN_SERVICE_TYPE_UNKNOWN:
case CONNMAN_SERVICE_TYPE_SYSTEM:
case CONNMAN_SERVICE_TYPE_GPS:
- case CONNMAN_SERVICE_TYPE_VPN:
case CONNMAN_SERVICE_TYPE_P2P:
break;
case CONNMAN_SERVICE_TYPE_CELLULAR:
@@ -2604,6 +2603,7 @@ static void append_properties(DBusMessageIter *dict, dbus_bool_t limited,
connman_dbus_dict_append_dict(dict, "Ethernet",
append_ethernet, service);
break;
+ case CONNMAN_SERVICE_TYPE_VPN:
case CONNMAN_SERVICE_TYPE_WIFI:
case CONNMAN_SERVICE_TYPE_ETHERNET:
case CONNMAN_SERVICE_TYPE_BLUETOOTH:
--
2.16.4

View File

@ -0,0 +1,133 @@
diff --git a/scripts/libppp-compat.h b/scripts/libppp-compat.h
new file mode 100644
index 00000000..eee1d09d
--- /dev/null
+++ b/scripts/libppp-compat.h
@@ -0,0 +1,127 @@
+/* Copyright (C) Eivind Naess, eivnaes@yahoo.com */
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+
+#ifndef __LIBPPP_COMPAT_H__
+#define __LIBPPP_COMPAT_H__
+
+/* Define USE_EAPTLS compile with EAP TLS support against older pppd headers,
+ * pppd >= 2.5.0 use PPP_WITH_EAPTLS and is defined in pppdconf.h */
+#define USE_EAPTLS 1
+
+/* Define INET6 to compile with IPv6 support against older pppd headers,
+ * pppd >= 2.5.0 use PPP_WITH_IPV6CP and is defined in pppdconf.h */
+#define INET6 1
+
+/* PPP < 2.5.0 defines and exports VERSION which overlaps with current package VERSION define.
+ * this silly macro magic is to work around that. */
+#undef VERSION
+#include <pppd/pppd.h>
+
+#ifndef PPPD_VERSION
+#define PPPD_VERSION VERSION
+#endif
+
+#include <pppd/fsm.h>
+#include <pppd/ccp.h>
+#include <pppd/eui64.h>
+#include <pppd/ipcp.h>
+#include <pppd/ipv6cp.h>
+#include <pppd/eap.h>
+#include <pppd/upap.h>
+
+#ifdef HAVE_PPPD_CHAP_H
+#include <pppd/chap.h>
+#endif
+
+#ifdef HAVE_PPPD_CHAP_NEW_H
+#include <pppd/chap-new.h>
+#endif
+
+#ifdef HAVE_PPPD_CHAP_MS_H
+#include <pppd/chap_ms.h>
+#endif
+
+#ifndef PPP_PROTO_CHAP
+#define PPP_PROTO_CHAP 0xc223
+#endif
+
+#ifndef PPP_PROTO_EAP
+#define PPP_PROTO_EAP 0xc227
+#endif
+
+
+#if WITH_PPP_VERSION < PPP_VERSION(2,5,0)
+
+static inline bool
+debug_on (void)
+{
+ return debug;
+}
+
+static inline const char
+*ppp_ipparam (void)
+{
+ return ipparam;
+}
+
+static inline int
+ppp_ifunit (void)
+{
+ return ifunit;
+}
+
+static inline const char *
+ppp_ifname (void)
+{
+ return ifname;
+}
+
+static inline int
+ppp_get_mtu (int idx)
+{
+ return netif_get_mtu(idx);
+}
+
+typedef enum ppp_notify
+{
+ NF_PID_CHANGE,
+ NF_PHASE_CHANGE,
+ NF_EXIT,
+ NF_SIGNALED,
+ NF_IP_UP,
+ NF_IP_DOWN,
+ NF_IPV6_UP,
+ NF_IPV6_DOWN,
+ NF_AUTH_UP,
+ NF_LINK_DOWN,
+ NF_FORK,
+ NF_MAX_NOTIFY
+} ppp_notify_t;
+
+typedef void (ppp_notify_fn) (void *ctx, int arg);
+
+static inline void
+ppp_add_notify (ppp_notify_t type, ppp_notify_fn *func, void *ctx)
+{
+ struct notifier **list[NF_MAX_NOTIFY] = {
+ [NF_PID_CHANGE ] = &pidchange,
+ [NF_PHASE_CHANGE] = &phasechange,
+ [NF_EXIT ] = &exitnotify,
+ [NF_SIGNALED ] = &sigreceived,
+ [NF_IP_UP ] = &ip_up_notifier,
+ [NF_IP_DOWN ] = &ip_down_notifier,
+ [NF_IPV6_UP ] = &ipv6_up_notifier,
+ [NF_IPV6_DOWN ] = &ipv6_down_notifier,
+ [NF_AUTH_UP ] = &auth_up_notifier,
+ [NF_LINK_DOWN ] = &link_down_notifier,
+ [NF_FORK ] = &fork_notifier,
+ };
+
+ struct notifier **notify = list[type];
+ if (notify) {
+ add_notifier(notify, func, ctx);
+ }
+}
+
+#endif /* #if WITH_PPP_VERSION < PPP_VERSION(2,5,0) */
+#endif /* #if__LIBPPP_COMPAT_H__ */

View File

@ -1,276 +0,0 @@
Patch-Source: https://git.kernel.org/pub/scm/network/connman/connman.git/commit/?id=a48864a2e5d2a725dfc6eef567108bc13b43857f
--
From a48864a2e5d2a725dfc6eef567108bc13b43857f Mon Sep 17 00:00:00 2001
From: Eivind Næss <eivnaes@yahoo.com>
Date: Sat, 25 Mar 2023 20:51:52 +0000
Subject: vpn: Adding support for latest pppd 2.5.0 release
The API has gone through a significant overhaul, and this change fixes any compile issues.
1) Fixes to configure.ac itself
2) Cleanup in pppd plugin itself
Adding a libppp-compat.h file to mask for any differences in the version.
---
configure.ac | 42 ++++++++++------
scripts/libppp-compat.h | 127 ++++++++++++++++++++++++++++++++++++++++++++++++
scripts/libppp-plugin.c | 15 +++---
3 files changed, 161 insertions(+), 23 deletions(-)
create mode 100644 scripts/libppp-compat.h
diff --git a/configure.ac b/configure.ac
index ea7a2fac..e82ba469 100644
--- a/configure.ac
+++ b/configure.ac
@@ -135,14 +135,6 @@ AC_ARG_ENABLE(l2tp,
AC_HELP_STRING([--enable-l2tp], [enable l2tp support]),
[enable_l2tp=${enableval}], [enable_l2tp="no"])
if (test "${enable_l2tp}" != "no"); then
- if (test -z "${path_pppd}"); then
- AC_PATH_PROG(PPPD, [pppd], [/usr/sbin/pppd], $PATH:/sbin:/usr/sbin)
- else
- PPPD="${path_pppd}"
- AC_SUBST(PPPD)
- fi
- AC_CHECK_HEADERS(pppd/pppd.h, dummy=yes,
- AC_MSG_ERROR(ppp header files are required))
if (test -z "${path_l2tp}"); then
AC_PATH_PROG(L2TP, [xl2tpd], [/usr/sbin/xl2tpd], $PATH:/sbin:/usr/sbin)
else
@@ -160,6 +152,18 @@ AC_ARG_ENABLE(pptp,
AC_HELP_STRING([--enable-pptp], [enable pptp support]),
[enable_pptp=${enableval}], [enable_pptp="no"])
if (test "${enable_pptp}" != "no"); then
+ if (test -z "${path_pptp}"); then
+ AC_PATH_PROG(PPTP, [pptp], [/usr/sbin/pptp], $PATH:/sbin:/usr/sbin)
+ else
+ PPTP="${path_pptp}"
+ AC_SUBST(PPTP)
+ fi
+fi
+AM_CONDITIONAL(PPTP, test "${enable_pptp}" != "no")
+AM_CONDITIONAL(PPTP_BUILTIN, test "${enable_pptp}" = "builtin")
+
+if (test "${enable_pptp}" != "no" || test "${enable_l2tp}" != "no"); then
+
if (test -z "${path_pppd}"); then
AC_PATH_PROG(PPPD, [pppd], [/usr/sbin/pppd], $PATH:/sbin:/usr/sbin)
else
@@ -168,15 +172,23 @@ if (test "${enable_pptp}" != "no"); then
fi
AC_CHECK_HEADERS(pppd/pppd.h, dummy=yes,
AC_MSG_ERROR(ppp header files are required))
- if (test -z "${path_pptp}"); then
- AC_PATH_PROG(PPTP, [pptp], [/usr/sbin/pptp], $PATH:/sbin:/usr/sbin)
- else
- PPTP="${path_pptp}"
- AC_SUBST(PPTP)
+ AC_CHECK_HEADERS([pppd/chap.h pppd/chap-new.h pppd/chap_ms.h])
+
+ PKG_CHECK_EXISTS([pppd],
+ [AS_VAR_SET([pppd_pkgconfig_support],[yes])])
+
+ PPPD_VERSION=2.4.9
+ if test x"$pppd_pkgconfig_support" = xyes; then
+ PPPD_VERSION=`$PKG_CONFIG --modversion pppd`
fi
+
+ AC_DEFINE_UNQUOTED([PPP_VERSION(x,y,z)],
+ [((x & 0xFF) << 16 | (y & 0xFF) << 8 | (z & 0xFF) << 0)],
+ [Macro to help determine the particular version of pppd])
+ PPP_VERSION=$(echo $PPPD_VERSION | sed -e "s/\./\,/g")
+ AC_DEFINE_UNQUOTED(WITH_PPP_VERSION, PPP_VERSION($PPP_VERSION),
+ [The real version of pppd represented as an int])
fi
-AM_CONDITIONAL(PPTP, test "${enable_pptp}" != "no")
-AM_CONDITIONAL(PPTP_BUILTIN, test "${enable_pptp}" = "builtin")
AC_CHECK_HEADERS(resolv.h, dummy=yes,
AC_MSG_ERROR(resolver header files are required))
diff --git a/scripts/libppp-compat.h b/scripts/libppp-compat.h
new file mode 100644
index 00000000..eee1d09d
--- /dev/null
+++ b/scripts/libppp-compat.h
@@ -0,0 +1,127 @@
+/* Copyright (C) Eivind Naess, eivnaes@yahoo.com */
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+
+#ifndef __LIBPPP_COMPAT_H__
+#define __LIBPPP_COMPAT_H__
+
+/* Define USE_EAPTLS compile with EAP TLS support against older pppd headers,
+ * pppd >= 2.5.0 use PPP_WITH_EAPTLS and is defined in pppdconf.h */
+#define USE_EAPTLS 1
+
+/* Define INET6 to compile with IPv6 support against older pppd headers,
+ * pppd >= 2.5.0 use PPP_WITH_IPV6CP and is defined in pppdconf.h */
+#define INET6 1
+
+/* PPP < 2.5.0 defines and exports VERSION which overlaps with current package VERSION define.
+ * this silly macro magic is to work around that. */
+#undef VERSION
+#include <pppd/pppd.h>
+
+#ifndef PPPD_VERSION
+#define PPPD_VERSION VERSION
+#endif
+
+#include <pppd/fsm.h>
+#include <pppd/ccp.h>
+#include <pppd/eui64.h>
+#include <pppd/ipcp.h>
+#include <pppd/ipv6cp.h>
+#include <pppd/eap.h>
+#include <pppd/upap.h>
+
+#ifdef HAVE_PPPD_CHAP_H
+#include <pppd/chap.h>
+#endif
+
+#ifdef HAVE_PPPD_CHAP_NEW_H
+#include <pppd/chap-new.h>
+#endif
+
+#ifdef HAVE_PPPD_CHAP_MS_H
+#include <pppd/chap_ms.h>
+#endif
+
+#ifndef PPP_PROTO_CHAP
+#define PPP_PROTO_CHAP 0xc223
+#endif
+
+#ifndef PPP_PROTO_EAP
+#define PPP_PROTO_EAP 0xc227
+#endif
+
+
+#if WITH_PPP_VERSION < PPP_VERSION(2,5,0)
+
+static inline bool
+debug_on (void)
+{
+ return debug;
+}
+
+static inline const char
+*ppp_ipparam (void)
+{
+ return ipparam;
+}
+
+static inline int
+ppp_ifunit (void)
+{
+ return ifunit;
+}
+
+static inline const char *
+ppp_ifname (void)
+{
+ return ifname;
+}
+
+static inline int
+ppp_get_mtu (int idx)
+{
+ return netif_get_mtu(idx);
+}
+
+typedef enum ppp_notify
+{
+ NF_PID_CHANGE,
+ NF_PHASE_CHANGE,
+ NF_EXIT,
+ NF_SIGNALED,
+ NF_IP_UP,
+ NF_IP_DOWN,
+ NF_IPV6_UP,
+ NF_IPV6_DOWN,
+ NF_AUTH_UP,
+ NF_LINK_DOWN,
+ NF_FORK,
+ NF_MAX_NOTIFY
+} ppp_notify_t;
+
+typedef void (ppp_notify_fn) (void *ctx, int arg);
+
+static inline void
+ppp_add_notify (ppp_notify_t type, ppp_notify_fn *func, void *ctx)
+{
+ struct notifier **list[NF_MAX_NOTIFY] = {
+ [NF_PID_CHANGE ] = &pidchange,
+ [NF_PHASE_CHANGE] = &phasechange,
+ [NF_EXIT ] = &exitnotify,
+ [NF_SIGNALED ] = &sigreceived,
+ [NF_IP_UP ] = &ip_up_notifier,
+ [NF_IP_DOWN ] = &ip_down_notifier,
+ [NF_IPV6_UP ] = &ipv6_up_notifier,
+ [NF_IPV6_DOWN ] = &ipv6_down_notifier,
+ [NF_AUTH_UP ] = &auth_up_notifier,
+ [NF_LINK_DOWN ] = &link_down_notifier,
+ [NF_FORK ] = &fork_notifier,
+ };
+
+ struct notifier **notify = list[type];
+ if (notify) {
+ add_notifier(notify, func, ctx);
+ }
+}
+
+#endif /* #if WITH_PPP_VERSION < PPP_VERSION(2,5,0) */
+#endif /* #if__LIBPPP_COMPAT_H__ */
diff --git a/scripts/libppp-plugin.c b/scripts/libppp-plugin.c
index 0dd8b471..61641b5b 100644
--- a/scripts/libppp-plugin.c
+++ b/scripts/libppp-plugin.c
@@ -29,14 +29,13 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
-#include <pppd/pppd.h>
-#include <pppd/fsm.h>
-#include <pppd/ipcp.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <dbus/dbus.h>
+#include "libppp-compat.h"
+
#define INET_ADDRES_LEN (INET_ADDRSTRLEN + 5)
#define INET_DNS_LEN (2*INET_ADDRSTRLEN + 9)
@@ -47,7 +46,7 @@ static char *path;
static DBusConnection *connection;
static int prev_phase;
-char pppd_version[] = VERSION;
+char pppd_version[] = PPPD_VERSION;
int plugin_init(void);
@@ -170,7 +169,7 @@ static void ppp_up(void *data, int arg)
DBUS_TYPE_STRING_AS_STRING DBUS_TYPE_STRING_AS_STRING
DBUS_DICT_ENTRY_END_CHAR_AS_STRING, &dict);
- append(&dict, "INTERNAL_IFNAME", ifname);
+ append(&dict, "INTERNAL_IFNAME", ppp_ifname());
inet_ntop(AF_INET, &ipcp_gotoptions[0].ouraddr, buf, INET_ADDRSTRLEN);
append(&dict, "INTERNAL_IP4_ADDRESS", buf);
@@ -309,9 +308,9 @@ int plugin_init(void)
chap_check_hook = ppp_have_secret;
pap_check_hook = ppp_have_secret;
- add_notifier(&ip_up_notifier, ppp_up, NULL);
- add_notifier(&phasechange, ppp_phase_change, NULL);
- add_notifier(&exitnotify, ppp_exit, connection);
+ ppp_add_notify(NF_IP_UP, ppp_up, NULL);
+ ppp_add_notify(NF_PHASE_CHANGE, ppp_phase_change, NULL);
+ ppp_add_notify(NF_EXIT, ppp_exit, connection);
return 0;
}
--
cgit