1 From af55a6a414d32c12f9ef3cab778385a361e1ad6d Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Eivind=20N=C3=A6ss?= <eivnaes@yahoo.com>
3 Date: Sat, 25 Mar 2023 20:51:52 +0000
4 Subject: [PATCH] vpn: Adding support for latest pppd 2.5.0 release
6 The API has gone through a significant overhaul, and this change fixes any compile issues.
7 1) Fixes to configure.ac itself
8 2) Cleanup in pppd plugin itself
10 Adding a libppp-compat.h file to mask for any differences in the version.
12 Upstream-Status: Backport [https://git.kernel.org/pub/scm/network/connman/connman.git/commit/?id=a48864a2e5d2a725dfc6eef567108bc13b43857f]
13 Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
16 scripts/libppp-compat.h | 127 ++++++++++++++++++++++++++++++++++++++++
17 1 file changed, 127 insertions(+)
18 create mode 100644 scripts/libppp-compat.h
20 diff --git a/scripts/libppp-compat.h b/scripts/libppp-compat.h
22 index 0000000..eee1d09
24 +++ b/scripts/libppp-compat.h
26 +/* Copyright (C) Eivind Naess, eivnaes@yahoo.com */
27 +/* SPDX-License-Identifier: GPL-2.0-or-later */
29 +#ifndef __LIBPPP_COMPAT_H__
30 +#define __LIBPPP_COMPAT_H__
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 */
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 */
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. */
43 +#include <pppd/pppd.h>
46 +#define PPPD_VERSION VERSION
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>
57 +#ifdef HAVE_PPPD_CHAP_H
58 +#include <pppd/chap.h>
61 +#ifdef HAVE_PPPD_CHAP_NEW_H
62 +#include <pppd/chap-new.h>
65 +#ifdef HAVE_PPPD_CHAP_MS_H
66 +#include <pppd/chap_ms.h>
69 +#ifndef PPP_PROTO_CHAP
70 +#define PPP_PROTO_CHAP 0xc223
73 +#ifndef PPP_PROTO_EAP
74 +#define PPP_PROTO_EAP 0xc227
78 +#if WITH_PPP_VERSION < PPP_VERSION(2,5,0)
86 +static inline const char
98 +static inline const char *
105 +ppp_get_mtu (int idx)
107 + return netif_get_mtu(idx);
110 +typedef enum ppp_notify
126 +typedef void (ppp_notify_fn) (void *ctx, int arg);
129 +ppp_add_notify (ppp_notify_t type, ppp_notify_fn *func, void *ctx)
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,
145 + struct notifier **notify = list[type];
147 + add_notifier(notify, func, ctx);
151 +#endif /* #if WITH_PPP_VERSION < PPP_VERSION(2,5,0) */
152 +#endif /* #if__LIBPPP_COMPAT_H__ */