lol
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge #229416: networkmanager-fortisslvpn: patch to build with ppp-2.5.0

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