]>
Commit | Line | Data |
---|---|---|
cb9029dd JB |
1 | --- connman-1.42/scripts/libppp-compat.h.orig 1970-01-01 01:00:00.000000000 +0100 |
2 | +++ connman-1.42/scripts/libppp-compat.h 2023-09-01 18:28:08.210878898 +0200 | |
3 | @@ -0,0 +1,127 @@ | |
4 | +/* Copyright (C) Eivind Naess, eivnaes@yahoo.com */ | |
5 | +/* SPDX-License-Identifier: GPL-2.0-or-later */ | |
6 | + | |
7 | +#ifndef __LIBPPP_COMPAT_H__ | |
8 | +#define __LIBPPP_COMPAT_H__ | |
9 | + | |
10 | +/* Define USE_EAPTLS compile with EAP TLS support against older pppd headers, | |
11 | + * pppd >= 2.5.0 use PPP_WITH_EAPTLS and is defined in pppdconf.h */ | |
12 | +#define USE_EAPTLS 1 | |
13 | + | |
14 | +/* Define INET6 to compile with IPv6 support against older pppd headers, | |
15 | + * pppd >= 2.5.0 use PPP_WITH_IPV6CP and is defined in pppdconf.h */ | |
16 | +#define INET6 1 | |
17 | + | |
18 | +/* PPP < 2.5.0 defines and exports VERSION which overlaps with current package VERSION define. | |
19 | + * this silly macro magic is to work around that. */ | |
20 | +#undef VERSION | |
21 | +#include <pppd/pppd.h> | |
22 | + | |
23 | +#ifndef PPPD_VERSION | |
24 | +#define PPPD_VERSION VERSION | |
25 | +#endif | |
26 | + | |
27 | +#include <pppd/fsm.h> | |
28 | +#include <pppd/ccp.h> | |
29 | +#include <pppd/eui64.h> | |
30 | +#include <pppd/ipcp.h> | |
31 | +#include <pppd/ipv6cp.h> | |
32 | +#include <pppd/eap.h> | |
33 | +#include <pppd/upap.h> | |
34 | + | |
35 | +#ifdef HAVE_PPPD_CHAP_H | |
36 | +#include <pppd/chap.h> | |
37 | +#endif | |
38 | + | |
39 | +#ifdef HAVE_PPPD_CHAP_NEW_H | |
40 | +#include <pppd/chap-new.h> | |
41 | +#endif | |
42 | + | |
43 | +#ifdef HAVE_PPPD_CHAP_MS_H | |
44 | +#include <pppd/chap_ms.h> | |
45 | +#endif | |
46 | + | |
47 | +#ifndef PPP_PROTO_CHAP | |
48 | +#define PPP_PROTO_CHAP 0xc223 | |
49 | +#endif | |
50 | + | |
51 | +#ifndef PPP_PROTO_EAP | |
52 | +#define PPP_PROTO_EAP 0xc227 | |
53 | +#endif | |
54 | + | |
55 | + | |
56 | +#if WITH_PPP_VERSION < PPP_VERSION(2,5,0) | |
57 | + | |
58 | +static inline bool | |
59 | +debug_on (void) | |
60 | +{ | |
61 | + return debug; | |
62 | +} | |
63 | + | |
64 | +static inline const char | |
65 | +*ppp_ipparam (void) | |
66 | +{ | |
67 | + return ipparam; | |
68 | +} | |
69 | + | |
70 | +static inline int | |
71 | +ppp_ifunit (void) | |
72 | +{ | |
73 | + return ifunit; | |
74 | +} | |
75 | + | |
76 | +static inline const char * | |
77 | +ppp_ifname (void) | |
78 | +{ | |
79 | + return ifname; | |
80 | +} | |
81 | + | |
82 | +static inline int | |
83 | +ppp_get_mtu (int idx) | |
84 | +{ | |
85 | + return netif_get_mtu(idx); | |
86 | +} | |
87 | + | |
88 | +typedef enum ppp_notify | |
89 | +{ | |
90 | + NF_PID_CHANGE, | |
91 | + NF_PHASE_CHANGE, | |
92 | + NF_EXIT, | |
93 | + NF_SIGNALED, | |
94 | + NF_IP_UP, | |
95 | + NF_IP_DOWN, | |
96 | + NF_IPV6_UP, | |
97 | + NF_IPV6_DOWN, | |
98 | + NF_AUTH_UP, | |
99 | + NF_LINK_DOWN, | |
100 | + NF_FORK, | |
101 | + NF_MAX_NOTIFY | |
102 | +} ppp_notify_t; | |
103 | + | |
104 | +typedef void (ppp_notify_fn) (void *ctx, int arg); | |
105 | + | |
106 | +static inline void | |
107 | +ppp_add_notify (ppp_notify_t type, ppp_notify_fn *func, void *ctx) | |
108 | +{ | |
109 | + struct notifier **list[NF_MAX_NOTIFY] = { | |
110 | + [NF_PID_CHANGE ] = &pidchange, | |
111 | + [NF_PHASE_CHANGE] = &phasechange, | |
112 | + [NF_EXIT ] = &exitnotify, | |
113 | + [NF_SIGNALED ] = &sigreceived, | |
114 | + [NF_IP_UP ] = &ip_up_notifier, | |
115 | + [NF_IP_DOWN ] = &ip_down_notifier, | |
116 | + [NF_IPV6_UP ] = &ipv6_up_notifier, | |
117 | + [NF_IPV6_DOWN ] = &ipv6_down_notifier, | |
118 | + [NF_AUTH_UP ] = &auth_up_notifier, | |
119 | + [NF_LINK_DOWN ] = &link_down_notifier, | |
120 | + [NF_FORK ] = &fork_notifier, | |
121 | + }; | |
122 | + | |
123 | + struct notifier **notify = list[type]; | |
124 | + if (notify) { | |
125 | + add_notifier(notify, func, ctx); | |
126 | + } | |
127 | +} | |
128 | + | |
129 | +#endif /* #if WITH_PPP_VERSION < PPP_VERSION(2,5,0) */ | |
130 | +#endif /* #if__LIBPPP_COMPAT_H__ */ |