summaryrefslogtreecommitdiffstats
path: root/meta-networking
diff options
context:
space:
mode:
Diffstat (limited to 'meta-networking')
-rw-r--r--meta-networking/recipes-connectivity/networkmanager/networkmanager-fortisslvpn/0001-fix-ppp-2.5.0-build.patch306
-rw-r--r--meta-networking/recipes-connectivity/networkmanager/networkmanager-fortisslvpn/0002-fix-ppp-2.5.0-build.patch34
-rw-r--r--meta-networking/recipes-connectivity/networkmanager/networkmanager-fortisslvpn_1.4.0.bb70
3 files changed, 410 insertions, 0 deletions
diff --git a/meta-networking/recipes-connectivity/networkmanager/networkmanager-fortisslvpn/0001-fix-ppp-2.5.0-build.patch b/meta-networking/recipes-connectivity/networkmanager/networkmanager-fortisslvpn/0001-fix-ppp-2.5.0-build.patch
new file mode 100644
index 000000000..0a568fa23
--- /dev/null
+++ b/meta-networking/recipes-connectivity/networkmanager/networkmanager-fortisslvpn/0001-fix-ppp-2.5.0-build.patch
@@ -0,0 +1,306 @@
1From 084ef529c5fb816927ca54866f66b340265aa9f6 Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Eivind=20N=C3=A6ss?= <eivnaes@yahoo.com>
3Date: Sat, 4 Mar 2023 21:20:43 +0000
4Subject: [PATCH] Adding support for compiling against pppd-2.5.0 (or master
5 branch)
6MIME-Version: 1.0
7Content-Type: text/plain; charset=UTF-8
8Content-Transfer-Encoding: 8bit
9
10Upstream-Status: Accepted
11Signed-off-by: Eivind Næss <eivnaes@yahoo.com>
12---
13 Makefile.am | 5 +-
14 configure.ac | 37 +++++++-
15 src/nm-fortisslvpn-pppd-compat.h | 93 +++++++++++++++++++
16 src/nm-fortisslvpn-pppd-plugin.c | 24 ++---
17 ...-status.h => nm-fortisslvpn-pppd-status.h} | 0
18 src/nm-fortisslvpn-service.c | 2 +-
19 6 files changed, 145 insertions(+), 16 deletions(-)
20 create mode 100644 src/nm-fortisslvpn-pppd-compat.h
21 rename src/{nm-ppp-status.h => nm-fortisslvpn-pppd-status.h} (100%)
22
23diff --git a/Makefile.am b/Makefile.am
24index b2e5533..e1e5ec9 100644
25--- a/Makefile.am
26+++ b/Makefile.am
27@@ -81,7 +81,7 @@ libexec_PROGRAMS += src/nm-fortisslvpn-service
28 src_nm_fortisslvpn_service_SOURCES = \
29 shared/nm-utils/nm-shared-utils.c \
30 shared/nm-utils/nm-shared-utils.h \
31- src/nm-ppp-status.h \
32+ src/nm-fortisslvpn-pppd-status.h \
33 src/nm-fortisslvpn-service.h \
34 src/nm-fortisslvpn-service.c \
35 shared/nm-fortissl-properties.c \
36@@ -106,7 +106,8 @@ src_nm_fortisslvpn_pppd_plugin_la_SOURCES = \
37 shared/nm-utils/nm-shared-utils.c \
38 shared/nm-utils/nm-shared-utils.h \
39 src/nm-fortisslvpn-pppd-plugin.c \
40- src/nm-ppp-status.h
41+ src/nm-fortisslvpn-pppd-compat.h \
42+ src/nm-fortisslvpn-pppd-status.h
43 nodist_src_nm_fortisslvpn_pppd_plugin_la_SOURCES = \
44 src/nm-fortisslvpn-pppd-service-dbus.h
45 src_nm_fortisslvpn_pppd_plugin_la_CPPFLAGS = $(src_cppflags)
46diff --git a/configure.ac b/configure.ac
47index a998707..877493e 100644
48--- a/configure.ac
49+++ b/configure.ac
50@@ -19,7 +19,10 @@ AC_PROG_CC
51 AM_PROG_CC_C_O
52 AC_PROG_INSTALL
53 AC_PROG_LIBTOOL
54+AC_PROG_CPP
55+AC_PROG_EGREP
56 AC_PATH_PROG(GLIB_COMPILE_RESOURCES, glib-compile-resources)
57+PKG_PROG_PKG_CONFIG()
58
59 AC_GNU_SOURCE
60
61@@ -37,20 +40,50 @@ dnl
62 dnl Required headers
63 dnl
64 AC_HEADER_STDC
65-AC_CHECK_HEADERS(fcntl.h paths.h sys/ioctl.h sys/time.h syslog.h unistd.h)
66+AC_CHECK_HEADERS(fcntl.h paths.h stdarg.h stdbool.h sys/ioctl.h sys/time.h syslog.h unistd.h)
67
68 AC_CHECK_HEADERS(pppd/pppd.h,,
69 AC_MSG_ERROR(couldn't find pppd.h. pppd development headers are required.))
70
71+dnl
72+dnl Check the presense of other pppd/*.h files
73+AC_CHECK_HEADERS([
74+ pppd/chap.h
75+ pppd/chap-new.h
76+ pppd/chap_ms.h
77+ ])
78+
79+dnl
80+dnl Versions >= 2.5.0 will have pkg-config support
81+PKG_CHECK_EXISTS([pppd],
82+ [AS_VAR_SET([pppd_pkgconfig_support],[yes])])
83+
84+dnl
85+dnl Get the version of pppd using pkg-config, assume 2.4.9 if not present
86+PPPD_VERSION=2.4.5
87+if test x"$pppd_pkgconfig_support" = xyes; then
88+ PPPD_VERSION=`$PKG_CONFIG --modversion pppd`
89+fi
90+
91+
92 AC_ARG_WITH([pppd-plugin-dir], AS_HELP_STRING([--with-pppd-plugin-dir=DIR], [path to the pppd plugins directory]))
93
94 if test -n "$with_pppd_plugin_dir" ; then
95 PPPD_PLUGIN_DIR="$with_pppd_plugin_dir"
96 else
97- PPPD_PLUGIN_DIR="${libdir}/pppd/2.4.5"
98+ PPPD_PLUGIN_DIR="${libdir}/pppd/$PPPD_VERSION"
99 fi
100 AC_SUBST(PPPD_PLUGIN_DIR)
101
102+dnl The version of pppd dictates what code can be included, i.e. enable use of
103+dnl #if WITH_PPP_VERSION >= PPP_VERSION(2,5,0) in the code
104+AC_DEFINE_UNQUOTED([PPP_VERSION(x,y,z)],
105+ [((x & 0xFF) << 16 | (y & 0xFF) << 8 | (z & 0xFF) << 0)],
106+ [Macro to help determine the particular version of pppd])
107+PPP_VERSION=$(echo $PPPD_VERSION | sed -e "s/\./\,/g")
108+AC_DEFINE_UNQUOTED(WITH_PPP_VERSION, PPP_VERSION($PPP_VERSION),
109+ [The real version of pppd represented as an int])
110+
111 dnl
112 dnl Checks for typedefs, structures, and compiler characteristics.
113 dnl
114diff --git a/src/nm-fortisslvpn-pppd-compat.h b/src/nm-fortisslvpn-pppd-compat.h
115new file mode 100644
116index 0000000..9a02908
117--- /dev/null
118+++ b/src/nm-fortisslvpn-pppd-compat.h
119@@ -0,0 +1,93 @@
120+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
121+/* nm-sstp-service - sstp (and other pppd) integration with NetworkManager
122+ *
123+ * Copyright (C) Eivind Næss, eivnaes@yahoo.com
124+ *
125+ * This program is free software; you can redistribute it and/or modify
126+ * it under the terms of the GNU General Public License as published by
127+ * the Free Software Foundation; either version 2 of the License, or
128+ * (at your option) any later version.
129+ *
130+ * This program is distributed in the hope that it will be useful,
131+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
132+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
133+ * GNU General Public License for more details.
134+ *
135+ * You should have received a copy of the GNU General Public License along
136+ * with this program; if not, write to the Free Software Foundation, Inc.,
137+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
138+ *
139+ */
140+
141+#ifndef __NM_FORTISSLVPN_PPPD_COMPAT_H__
142+#define __NM_FORTISSLVPN_PPPD_COMPAT_H__
143+
144+#define INET6 1
145+
146+// PPP < 2.5.0 defines and exports VERSION which overlaps with current package VERSION define.
147+// this silly macro magic is to work around that.
148+
149+#undef VERSION
150+#include <pppd/pppd.h>
151+
152+#ifndef PPPD_VERSION
153+#define PPPD_VERSION VERSION
154+#endif
155+
156+#include <pppd/fsm.h>
157+#include <pppd/ccp.h>
158+#include <pppd/eui64.h>
159+#include <pppd/ipcp.h>
160+#include <pppd/ipv6cp.h>
161+#include <pppd/eap.h>
162+#include <pppd/upap.h>
163+
164+#ifdef HAVE_PPPD_CHAP_H
165+ #include <pppd/chap.h>
166+#endif
167+
168+#ifdef HAVE_PPPD_CHAP_NEW_H
169+ #include <pppd/chap-new.h>
170+#endif
171+
172+#ifdef HAVE_PPPD_CHAP_MS_H
173+ #include <pppd/chap_ms.h>
174+#endif
175+
176+#ifndef PPP_PROTO_CHAP
177+#define PPP_PROTO_CHAP 0xc223
178+#endif
179+
180+#ifndef PPP_PROTO_EAP
181+#define PPP_PROTO_EAP 0xc227
182+#endif
183+
184+#if WITH_PPP_VERSION < PPP_VERSION(2,5,0)
185+
186+static inline bool debug_on(void)
187+{
188+ return debug;
189+}
190+
191+static inline const char *ppp_ipparam(void)
192+{
193+ return ipparam;
194+}
195+
196+static inline int ppp_ifunit(void)
197+{
198+ return ifunit;
199+}
200+
201+static inline const char *ppp_ifname(void)
202+{
203+ return ifname;
204+}
205+
206+static inline int ppp_get_mtu(int idx)
207+{
208+ return netif_get_mtu(idx);
209+}
210+
211+#endif // #if WITH_PPP_VERSION < PPP_VERSION(2,5,0)
212+#endif // #ifdef __NM_FORTISSLVPN_PPPD_COMPAT_H__
213diff --git a/src/nm-fortisslvpn-pppd-plugin.c b/src/nm-fortisslvpn-pppd-plugin.c
214index f2ad262..c2efb9a 100644
215--- a/src/nm-fortisslvpn-pppd-plugin.c
216+++ b/src/nm-fortisslvpn-pppd-plugin.c
217@@ -23,12 +23,6 @@
218 #define ___CONFIG_H__
219 #include <config.h>
220
221-#include <pppd/pppd.h>
222-#include <pppd/fsm.h>
223-#include <pppd/ipcp.h>
224-
225-#include "nm-default.h"
226-
227 #include <sys/types.h>
228 #include <string.h>
229 #include <sys/socket.h>
230@@ -42,10 +36,12 @@
231 #include <grp.h>
232 #include <glib/gstdio.h>
233
234+#include "nm-fortisslvpn-pppd-status.h"
235+#include "nm-fortisslvpn-pppd-compat.h"
236 #include "nm-fortisslvpn-pppd-service-dbus.h"
237-#include "nm-fortisslvpn-service.h"
238-#include "nm-ppp-status.h"
239
240+#include "nm-default.h"
241+#include "nm-fortisslvpn-service.h"
242 #include "nm-utils/nm-shared-utils.h"
243 #include "nm-utils/nm-vpn-plugin-macros.h"
244
245@@ -80,7 +76,7 @@ static struct {
246
247 int plugin_init (void);
248
249-char pppd_version[] = VERSION;
250+char pppd_version[] = PPPD_VERSION;
251
252 static void
253 chroot_sandbox (void)
254@@ -296,7 +292,7 @@ get_ip4_routes (in_addr_t ouraddr)
255 static void
256 nm_ip_up (void *data, int arg)
257 {
258- guint32 pppd_made_up_address = htonl (0x0a404040 + ifunit);
259+ guint32 pppd_made_up_address = htonl (0x0a404040 + ppp_ifunit());
260 ipcp_options opts = ipcp_gotoptions[0];
261 ipcp_options peer_opts = ipcp_hisoptions[0];
262 GVariantBuilder builder;
263@@ -317,7 +313,7 @@ nm_ip_up (void *data, int arg)
264
265 g_variant_builder_add (&builder, "{sv}",
266 NM_VPN_PLUGIN_IP4_CONFIG_TUNDEV,
267- g_variant_new_string (ifname));
268+ g_variant_new_string (ppp_ifname()));
269
270 str = g_getenv ("VPN_GATEWAY");
271 if (str) {
272@@ -442,8 +438,14 @@ plugin_init (void)
273 return -1;
274 }
275
276+#if WITH_PPP_VERSION < PPP_VERSION(2,5,0)
277 add_notifier (&phasechange, nm_phasechange, NULL);
278 add_notifier (&ip_up_notifier, nm_ip_up, NULL);
279 add_notifier (&exitnotify, nm_exit_notify, NULL);
280+#else
281+ ppp_add_notify (NF_PHASE_CHANGE, nm_phasechange, NULL);
282+ ppp_add_notify (NF_IP_UP, nm_ip_up, NULL);
283+ ppp_add_notify (NF_EXIT, nm_exit_notify, NULL);
284+#endif
285 return 0;
286 }
287diff --git a/src/nm-ppp-status.h b/src/nm-fortisslvpn-pppd-status.h
288similarity index 100%
289rename from src/nm-ppp-status.h
290rename to src/nm-fortisslvpn-pppd-status.h
291diff --git a/src/nm-fortisslvpn-service.c b/src/nm-fortisslvpn-service.c
292index 6c340d0..a8483c2 100644
293--- a/src/nm-fortisslvpn-service.c
294+++ b/src/nm-fortisslvpn-service.c
295@@ -40,7 +40,7 @@
296 #include <glib/gstdio.h>
297
298 #include "nm-fortissl-properties.h"
299-#include "nm-ppp-status.h"
300+#include "nm-fortisslvpn-pppd-status.h"
301 #include "nm-fortisslvpn-pppd-service-dbus.h"
302 #include "nm-utils/nm-shared-utils.h"
303 #include "nm-utils/nm-vpn-plugin-macros.h"
304--
305GitLab
306
diff --git a/meta-networking/recipes-connectivity/networkmanager/networkmanager-fortisslvpn/0002-fix-ppp-2.5.0-build.patch b/meta-networking/recipes-connectivity/networkmanager/networkmanager-fortisslvpn/0002-fix-ppp-2.5.0-build.patch
new file mode 100644
index 000000000..798a57b0d
--- /dev/null
+++ b/meta-networking/recipes-connectivity/networkmanager/networkmanager-fortisslvpn/0002-fix-ppp-2.5.0-build.patch
@@ -0,0 +1,34 @@
1From 8773f772d39f8eee6edc1fd2e5437c754ed41e1e Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Eivind=20N=C3=A6ss?= <eivnaes@yahoo.com>
3Date: Sat, 4 Mar 2023 21:29:54 +0000
4Subject: [PATCH] Fixing configure.ac from previous change
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9Upstream-Status: Accepted
10Signed-off-by: Eivind Næss <eivnaes@yahoo.com>
11---
12 configure.ac | 6 +-----
13 1 file changed, 1 insertion(+), 5 deletions(-)
14
15diff --git a/configure.ac b/configure.ac
16index 877493e..a5b4abb 100644
17--- a/configure.ac
18+++ b/configure.ac
19@@ -47,11 +47,7 @@ AC_CHECK_HEADERS(pppd/pppd.h,,
20
21 dnl
22 dnl Check the presense of other pppd/*.h files
23-AC_CHECK_HEADERS([
24- pppd/chap.h
25- pppd/chap-new.h
26- pppd/chap_ms.h
27- ])
28+AC_CHECK_HEADERS(pppd/chap.h pppd/chap-new.h pppd/chap_ms.h)
29
30 dnl
31 dnl Versions >= 2.5.0 will have pkg-config support
32--
33GitLab
34
diff --git a/meta-networking/recipes-connectivity/networkmanager/networkmanager-fortisslvpn_1.4.0.bb b/meta-networking/recipes-connectivity/networkmanager/networkmanager-fortisslvpn_1.4.0.bb
new file mode 100644
index 000000000..a251e8bf3
--- /dev/null
+++ b/meta-networking/recipes-connectivity/networkmanager/networkmanager-fortisslvpn_1.4.0.bb
@@ -0,0 +1,70 @@
1SUMMARY = "Fortinet SSLVPN support for NetworkManager"
2SECTION = "net/misc"
3
4LICENSE = "GPL-2.0-or-later"
5LIC_FILES_CHKSUM = "file://COPYING;md5=59530bdf33659b29e73d4adb9f9f6552"
6
7DEPENDS = "glib-2.0-native libxml2-native networkmanager ppp"
8
9inherit gnomebase gettext useradd
10
11SRC_URI = " \
12 ${GNOME_MIRROR}/NetworkManager-fortisslvpn/${@gnome_verdir("${PV}")}/NetworkManager-fortisslvpn-${PV}.tar.xz \
13 file://0001-fix-ppp-2.5.0-build.patch \
14 file://0002-fix-ppp-2.5.0-build.patch \
15"
16SRC_URI[sha256sum] = "b055e26349b516b23585798ab3ef57b436b014800e92a8ac732cfc8e76c5dafa"
17
18S = "${WORKDIR}/NetworkManager-fortisslvpn-${PV}"
19
20# meta-gnome in layers is required using gnome:
21PACKAGECONFIG[gnome] = "--with-gnome,--without-gnome,gtk+3 libnma libsecret,"
22PACKAGECONFIG[gtk4] = "--with-gtk4,--without-gtk4,gtk4,"
23
24EXTRA_OECONF = "--with-pppd-plugin-dir=${libdir}/pppd/${@get_ppp_version(d)}"
25
26def get_ppp_version(d):
27 import re
28
29 pppd_plugin = d.expand('${STAGING_LIBDIR}/pppd')
30 if not os.path.isdir(pppd_plugin):
31 return None
32
33 bb.debug(1, "pppd plugin dir %s" % pppd_plugin)
34 r = re.compile(r"\d*\.\d*\.\d*")
35 for f in os.listdir(pppd_plugin):
36 if os.path.isdir(os.path.join(pppd_plugin, f)):
37 ma = r.match(f)
38 if ma:
39 bb.debug(1, "pppd version dir %s" % f)
40 return f
41 else:
42 bb.debug(1, "under pppd plugin dir %s" % f)
43
44 return None
45
46# gdbus-codegen requires target directories to exist
47do_configure:append() {
48 mkdir -p ${B}/properties
49 mkdir -p ${B}/src
50}
51
52USERADD_PACKAGES = "${PN}"
53USERADD_PARAM:${PN} = "--system nm-fortisslvpn"
54
55FILES:${PN} += " \
56 ${libdir}/NetworkManager/*.so \
57 ${libdir}/pppd/*/*.so \
58 ${nonarch_libdir}/NetworkManager/VPN/nm-fortisslvpn-service.name \
59"
60
61FILES:${PN}-staticdev += " \
62 ${libdir}/NetworkManager/*.a \
63 ${libdir}/pppd/*/*.a \
64"
65
66RDEPENDS:${PN} = " \
67 networkmanager \
68 openfortivpn \
69 ppp \
70"