Gentoo Archives: gentoo-commits

From: Andrew Savchenko <bircoph@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: net-dialup/openl2tp/, net-dialup/openl2tp/files/examples/, ...
Date: Tue, 03 Jul 2018 18:54:33
Message-Id: 1530644003.24d104cdffb3fd63356d3b9aadadc34ba10c3779.bircoph@gentoo
1 commit: 24d104cdffb3fd63356d3b9aadadc34ba10c3779
2 Author: Andrew Savchenko <bircoph <AT> gentoo <DOT> org>
3 AuthorDate: Tue Jul 3 18:49:29 2018 +0000
4 Commit: Andrew Savchenko <bircoph <AT> gentoo <DOT> org>
5 CommitDate: Tue Jul 3 18:53:23 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=24d104cd
7
8 net-dialup/openl2tp: import from bircoph overlay
9
10 Import version long term used in overlay with RPC support fixed to
11 use libtirpc after it was removed from glibc.
12
13 Closes: https://bugs.gentoo.org/195461
14 Signed-off-by: Andrew Savchenko <bircoph <AT> gentoo.org>
15 Package-Manager: Portage-2.3.41, Repoman-2.3.9
16
17 net-dialup/openl2tp/Manifest | 1 +
18 .../openl2tp/files/examples/client.openl2tpd.conf | 30 ++
19 .../files/examples/server-radius.openl2tpd.conf | 28 ++
20 .../openl2tp/files/examples/server.openl2tpd.conf | 36 +++
21 .../files/examples/server.options.openl2tpd | 23 ++
22 .../openl2tp/files/openl2tp-1.8-cflags.patch | 34 +++
23 .../files/openl2tp-1.8-clientip_as_ipparam.patch | 217 +++++++++++++++
24 .../files/openl2tp-1.8-configure-Makefile.patch | 58 ++++
25 .../openl2tp/files/openl2tp-1.8-l2tpconfig.patch | 15 +
26 .../openl2tp/files/openl2tp-1.8-ldflags.patch | 73 +++++
27 net-dialup/openl2tp/files/openl2tp-1.8-man.patch | 40 +++
28 .../openl2tp/files/openl2tp-1.8-optionsfile.patch | 306 +++++++++++++++++++++
29 .../files/openl2tp-1.8-parallelbuild.patch | 30 ++
30 .../openl2tp/files/openl2tp-1.8-pppd-2.patch | 12 +
31 .../openl2tp/files/openl2tp-1.8-setkey.patch | 12 +
32 net-dialup/openl2tp/files/openl2tp-1.8-tirpc.patch | 53 ++++
33 .../openl2tp/files/openl2tp-1.8-unused-var.patch | 21 ++
34 .../openl2tp/files/openl2tp-1.8-werror.patch | 36 +++
35 net-dialup/openl2tp/files/openl2tpd.confd | 17 ++
36 net-dialup/openl2tp/files/openl2tpd.initd | 69 +++++
37 net-dialup/openl2tp/metadata.xml | 17 ++
38 net-dialup/openl2tp/openl2tp-1.8.ebuild | 127 +++++++++
39 22 files changed, 1255 insertions(+)
40
41 diff --git a/net-dialup/openl2tp/Manifest b/net-dialup/openl2tp/Manifest
42 new file mode 100644
43 index 00000000000..028a7dc26b0
44 --- /dev/null
45 +++ b/net-dialup/openl2tp/Manifest
46 @@ -0,0 +1 @@
47 +DIST openl2tp-1.8.tar.gz 491160 BLAKE2B 70c78cd4d7daba600f9a9115025acb38b82adc0a04bbf6e9d46daebf2c7c37cc8fe9df6fa7157a05525e998063f5200a85893bb5b33dbe3e66ca7b6a4d2c7972 SHA512 360f9032b2bb104cfaa41a18fc37005510ab604b31a34a3412563e0de3e8dad946ca61840cd41a19f0202d92d758d812f45479659c9fa4d4e9e13dd226f03fda
48
49 diff --git a/net-dialup/openl2tp/files/examples/client.openl2tpd.conf b/net-dialup/openl2tp/files/examples/client.openl2tpd.conf
50 new file mode 100644
51 index 00000000000..6ead75a6296
52 --- /dev/null
53 +++ b/net-dialup/openl2tp/files/examples/client.openl2tpd.conf
54 @@ -0,0 +1,30 @@
55 +system modify \
56 + deny_remote_tunnel_creates=yes \
57 + tunnel_establish_timeout=60 \
58 + session_establish_timeout=0 \
59 + tunnel_persist_pend_timeout=60 \
60 + session_persist_pend_timeout=60
61 +
62 +ppp profile modify \
63 + profile_name=default \
64 + mtu=1460 \
65 + mru=1460 \
66 + auth_peer=no \
67 + auth_pap=no \
68 + auth_eap=no \
69 + auth_mschapv1=no \
70 + lcp_echo_interval=10 \
71 + lcp_echo_failure_count=3 \
72 + default_route=yes
73 +
74 +tunnel create \
75 + tunnel_name=campus \
76 + dest_ipaddr=my.l2tp.provider \
77 + use_udp_checksums=off \
78 + persist=yes
79 +
80 +session create \
81 + tunnel_name=campus \
82 + session_name=campus \
83 + use_sequence_numbers=no \
84 + user_name=my_user_name
85
86 diff --git a/net-dialup/openl2tp/files/examples/server-radius.openl2tpd.conf b/net-dialup/openl2tp/files/examples/server-radius.openl2tpd.conf
87 new file mode 100644
88 index 00000000000..e666fdec610
89 --- /dev/null
90 +++ b/net-dialup/openl2tp/files/examples/server-radius.openl2tpd.conf
91 @@ -0,0 +1,28 @@
92 +ppp profile modify \
93 + profile_name=default \
94 + local_ipaddr=10.7.2.16 \
95 + auth_eap=no \
96 + auth_mschapv1=yes \
97 + auth_mschapv2=yes \
98 + use_radius=yes \
99 + ipcp_retransmit_interval=1 \
100 + lcp_retransmit_interval=1 \
101 + lcp_echo_interval=5 \
102 + chap_max_challenge=3 \
103 + chap_restart=1 \
104 + idle_timeout=0 \
105 + max_connect_time=0 \
106 + mtu=1460 \
107 + mru=1460 \
108 + radius_hint=/etc/radiusclient/radiusclient.conf
109 +
110 +tunnel profile modify \
111 + profile_name=default \
112 + src_ipaddr=10.50.0.16 \
113 + retry_timeout=1 \
114 + use_udp_checksums=no \
115 + our_udp_port=1701
116 +
117 +session profile modify \
118 + profile_name=default \
119 + use_sequence_numbers=no
120
121 diff --git a/net-dialup/openl2tp/files/examples/server.openl2tpd.conf b/net-dialup/openl2tp/files/examples/server.openl2tpd.conf
122 new file mode 100644
123 index 00000000000..e960e14e1a3
124 --- /dev/null
125 +++ b/net-dialup/openl2tp/files/examples/server.openl2tpd.conf
126 @@ -0,0 +1,36 @@
127 +system modify \
128 + deny_remote_tunnel_creates=no \
129 + tunnel_establish_timeout=60 \
130 + session_establish_timeout=0 \
131 + tunnel_persist_pend_timeout=60 \
132 + session_persist_pend_timeout=60
133 +
134 +ppp profile modify profile_name=default \
135 + optionsfile=/etc/ppp/options.openl2tpd \
136 + local_ipaddr=172.16.17.1 \
137 + lcp_echo_interval=10 \
138 + lcp_echo_failure_count=3 \
139 + auth_eap=no \
140 + auth_pap=no \
141 + auth_none=no \
142 + auth_chap=yes \
143 + auth_mschapv1=no \
144 + auth_mschapv2=yes
145 +
146 +session profile create profile_name=peer1 \
147 + ppp_profile_name=peer1
148 +
149 +ppp profile create profile_name=peer1 \
150 + optionsfile=/etc/ppp/options.openl2tpd \
151 + auth_none=no \
152 + auth_pap=no \
153 + auth_chap=yes \
154 + auth_mschapv1=no \
155 + auth_mschapv2=yes \
156 + auth_peer=no \
157 + dns_ipaddr_pri=172.16.17.1 \
158 + local_ipaddr=172.16.17.1 \
159 + remote_ipaddr=172.16.17.6 # ipaddr of peer1
160 +
161 +tunnel profile modify profile_name=default \
162 + our_udp_port=1701
163
164 diff --git a/net-dialup/openl2tp/files/examples/server.options.openl2tpd b/net-dialup/openl2tp/files/examples/server.options.openl2tpd
165 new file mode 100644
166 index 00000000000..411956fab1a
167 --- /dev/null
168 +++ b/net-dialup/openl2tp/files/examples/server.options.openl2tpd
169 @@ -0,0 +1,23 @@
170 +# usually placed at /etc/ppp/options.openl2tpd
171 +name host
172 +auth
173 +plugin pppol2tp.so
174 +refuse-mschap
175 +require-mschap-v2
176 +hide-password
177 +ipcp-accept-local
178 +ipcp-accept-remote
179 +lcp-echo-interval 15
180 +lcp-echo-failure 4
181 +ms-dns 172.16.17.1
182 +netmask 255.255.255.0
183 +nodefaultroute
184 +proxyarp
185 +crtscts
186 +noccp
187 +nobsdcomp
188 +nodeflate
189 +noaccomp
190 +nopcomp
191 +novj
192 +lock
193
194 diff --git a/net-dialup/openl2tp/files/openl2tp-1.8-cflags.patch b/net-dialup/openl2tp/files/openl2tp-1.8-cflags.patch
195 new file mode 100644
196 index 00000000000..fe8825766ea
197 --- /dev/null
198 +++ b/net-dialup/openl2tp/files/openl2tp-1.8-cflags.patch
199 @@ -0,0 +1,34 @@
200 +diff -Naurd openl2tp-1.8.orig/Makefile openl2tp-1.8/Makefile
201 +--- openl2tp-1.8.orig/Makefile 2018-07-03 04:59:51.000000000 +0900
202 ++++ openl2tp-1.8/Makefile 2018-07-03 05:00:44.133460163 +0900
203 +@@ -155,24 +155,23 @@
204 + endif
205 +
206 + CPPFLAGS= $(CPPFLAGS.l2tptest) $(CPPFLAGS-y)
207 +-CFLAGS= -I. -Iusl -Icli -isystem include \
208 ++CFLAGS+= -I. -Iusl -Icli -isystem include \
209 + -MMD -Wall -Wno-strict-aliasing \
210 + $(CPPFLAGS) $(CPPFLAGS.dmalloc) \
211 + -DSYS_LIBDIR=$(SYS_LIBDIR)
212 + LDFLAGS.l2tpd= -Wl,-E -L. -Lusl -lusl -ldl $(LIBS.dmalloc) -lc
213 + LDFLAGS.l2tpconfig= -Lcli -lcli -lreadline $(LIBS.dmalloc) $(READLINE_LDFLAGS) -lc
214 +
215 +-OPT_CFLAGS?= -O
216 +-
217 + ifeq ($(L2TP_DEBUG),y)
218 +-CFLAGS.optimize= -g
219 +-CFLAGS.optimize+= -DDEBUG
220 ++CFLAGS.opt= -g
221 ++CFLAGS.opt+= -DDEBUG
222 + else
223 +-CFLAGS.optimize= $(OPT_CFLAGS)
224 ++CFLAGS.opt= $(OPT_CFLAGS)
225 + endif
226 ++CFLAGS.optimize= $(CFLAGS) $(CFLAGS.opt)
227 + export CFLAGS.optimize
228 +
229 +-CFLAGS+= $(CFLAGS.optimize)
230 ++CFLAGS+= $(CFLAGS.opt)
231 +
232 + ifeq ($(L2TP_USE_ASYNC_RPC),y)
233 + CPPFLAGS+= -DL2TP_ASYNC_RPC
234
235 diff --git a/net-dialup/openl2tp/files/openl2tp-1.8-clientip_as_ipparam.patch b/net-dialup/openl2tp/files/openl2tp-1.8-clientip_as_ipparam.patch
236 new file mode 100644
237 index 00000000000..fcea3d110f5
238 --- /dev/null
239 +++ b/net-dialup/openl2tp/files/openl2tp-1.8-clientip_as_ipparam.patch
240 @@ -0,0 +1,217 @@
241 +diff -brau openl2tp-1.8.o/doc/openl2tp_rpc.4 openl2tp-1.8/doc/openl2tp_rpc.4
242 +--- openl2tp-1.8.o/doc/openl2tp_rpc.4 2011-06-04 10:02:34.000000000 +0200
243 ++++ openl2tp-1.8/doc/openl2tp_rpc.4 2011-06-04 21:17:22.000000000 +0200
244 +@@ -719,6 +719,10 @@
245 + .B chap_restart
246 + Retransmission timeout for CHAP challenges. Default=3.
247 + .TP
248 ++.B clientip_as_ipparam
249 ++Whether or not to pass the remote client ip (connecting IP) as ipparam to pppd
250 ++(similar to to pptpd).
251 ++.TP
252 + .B pap_max_auth_reqs
253 + Maximum number of PAP authenticate-request transmissions. Default=10.
254 + .TP
255 +diff -brau openl2tp-1.8.o/l2tp_common.c openl2tp-1.8/l2tp_common.c
256 +--- openl2tp-1.8.o/l2tp_common.c 2011-06-04 21:00:45.000000000 +0200
257 ++++ openl2tp-1.8/l2tp_common.c 2011-06-04 21:19:46.000000000 +0200
258 +@@ -931,6 +931,7 @@
259 + if (OPTSTRING_PTR(pp->remote_name) != NULL) {
260 + len += fprintf(file, " remote name for authentication: %s\n", OPTSTRING(pp->remote_name));
261 + }
262 ++ len += fprintf(file, " clientip as ipparam: %s\n", pp->clientip_as_ipparam ? "YES" : "NO");
263 + len += fprintf(file, " max connect time: %d, max failure count: %d, idle timeout: %d\n",
264 + pp->max_connect_time, pp->max_failure_count, pp->idle_timeout);
265 + if (pp->asyncmap != 0) {
266 +diff -brau openl2tp-1.8.o/l2tp_config.c openl2tp-1.8/l2tp_config.c
267 +--- openl2tp-1.8.o/l2tp_config.c 2011-06-04 11:43:03.000000000 +0200
268 ++++ openl2tp-1.8/l2tp_config.c 2011-06-04 21:30:48.000000000 +0200
269 +@@ -3124,6 +3124,7 @@
270 + L2TP_PPP_ARGID_REMOTE_NAME,
271 + L2TP_PPP_ARGID_PROXY_ARP,
272 + L2TP_PPP_ARGID_OPTIONSFILE,
273 ++ L2TP_PPP_ARGID_CLIENTIP_AS_IPPARAM,
274 + } l2tp_ppp_arg_ids_t;
275 +
276 + #undef ARG
277 +@@ -3189,7 +3190,8 @@
278 + ARG(USE_AS_DEFAULT_ROUTE, "default_route", 0, bool, "Use link as default route"), \
279 + ARG(MULTILINK, "multilink", 0, bool, "Enable PPP multilink connections."), \
280 + ARG(PROXY_ARP, "proxy_arp", 0, bool, "Use proxy arp."), \
281 +- ARG(OPTIONSFILE, "optionsfile", 0, string, "ppp options file to use")
282 ++ ARG(OPTIONSFILE, "optionsfile", 0, string, "ppp options file to use"), \
283 ++ ARG(CLIENTIP_AS_IPPARAM, "clientip_as_ipparam", 0, bool, "Pass the connecting client's IP as ipparam to pppd.")
284 +
285 +
286 + static struct cli_arg_entry l2tp_args_ppp_profile_create[] = {
287 +@@ -3270,6 +3272,7 @@
288 + FLG(MULTILINK, "multilink", "Enable PPP multilink connections."), \
289 + FLG(PROXY_ARP, "proxy_arp", "Use proxy arp."),
290 + FLG(OPTIONSFILE, "optionsfile", "ppp options file to use"),
291 ++ FLG(CLIENTIP_AS_IPPARAM, "clientip_as_ipparam", "Pass the connecting client's IP as ipparam to pppd."),
292 + { NULL, },
293 + };
294 +
295 +@@ -3500,6 +3503,9 @@
296 + msg->optionsfile.valid = 1;
297 + msg->flags2 |= L2TP_API_PPP_PROFILE_FLAG_OPTIONSFILE;
298 + break;
299 ++ case L2TP_PPP_ARGID_CLIENTIP_AS_IPPARAM:
300 ++ L2TP_ACT_PARSE_ARG(arg, arg_value, msg->clientip_as_ipparam, msg->flags2, L2TP_API_PPP_PROFILE_FLAG_CLIENTIP_AS_IPPARAM);
301 ++ break;
302 + }
303 +
304 + result = 0;
305 +@@ -3871,6 +3877,9 @@
306 + case L2TP_PPP_ARGID_OPTIONSFILE:
307 + msg.flags2 |= L2TP_API_PPP_PROFILE_FLAG_OPTIONSFILE;
308 + break;
309 ++ case L2TP_PPP_ARGID_CLIENTIP_AS_IPPARAM:
310 ++ msg.flags2 |= L2TP_API_PPP_PROFILE_FLAG_CLIENTIP_AS_IPPARAM;
311 ++ break;
312 + }
313 + } L2TP_ACT_END();
314 +
315 +@@ -4883,6 +4892,7 @@
316 + L2TP_API_PPP_PROFILE_FLAG_REMOTE_NAME |
317 + L2TP_API_PPP_PROFILE_FLAG_PROXY_ARP |
318 + L2TP_API_PPP_PROFILE_FLAG_OPTIONSFILE |
319 ++ L2TP_API_PPP_PROFILE_FLAG_CLIENTIP_AS_IPPARAM |
320 + L2TP_API_PPP_PROFILE_FLAG_AUTH_NONE |
321 + L2TP_API_PPP_PROFILE_FLAG_AUTH_REFUSE_EAP |
322 + L2TP_API_PPP_PROFILE_FLAG_AUTH_REFUSE_MSCHAPV2 |
323 +@@ -5047,6 +5057,9 @@
324 + if ((cfg->flags2 & L2TP_API_PPP_PROFILE_FLAG_OPTIONSFILE) && (OPTSTRING_PTR(cfg->optionsfile) != NULL)) {
325 + fprintf(file, "\toptionsfile=%s \\\n", OPTSTRING_PTR(cfg->optionsfile));
326 + }
327 ++ if (cfg->flags2 & L2TP_API_PPP_PROFILE_FLAG_CLIENTIP_AS_IPPARAM) {
328 ++ fprintf(file, "\tclientip_as_ipparam=%s \\\n", Y_OR_N(cfg->clientip_as_ipparam));
329 ++ }
330 + fprintf(file, "\n");
331 + }
332 + }
333 +diff -brau openl2tp-1.8.o/l2tp_config_parse.y openl2tp-1.8/l2tp_config_parse.y
334 +--- openl2tp-1.8.o/l2tp_config_parse.y 2011-06-04 11:11:42.000000000 +0200
335 ++++ openl2tp-1.8/l2tp_config_parse.y 2011-06-04 21:34:04.000000000 +0200
336 +@@ -155,6 +155,7 @@
337 + %token BOOL
338 + %token IPADDRESS
339 + %token OPTIONSFILE
340 ++%token CLIENTIP_AS_IPPARAM
341 +
342 + %token INITIAL_RCVD_LCP_CONFREQ
343 + %token CALLING_NUMBER
344 +@@ -1180,6 +1181,11 @@
345 + OPTSTRING(ppp_profile.optionsfile) = $3.buf;
346 + ppp_profile.optionsfile.valid = 1;
347 + }
348 ++ | CLIENTIP_AS_IPPARAM EQUALS BOOL
349 ++ {
350 ++ ppp_profile.flags2 |= L2TP_API_PPP_PROFILE_FLAG_CLIENTIP_AS_IPPARAM;
351 ++ ppp_profile.clientip_as_ipparam = $3;
352 ++ }
353 + ;
354 +
355 + tunnel_command
356 +diff -brau openl2tp-1.8.o/l2tp_config_token.l openl2tp-1.8/l2tp_config_token.l
357 +--- openl2tp-1.8.o/l2tp_config_token.l 2011-06-04 11:08:31.000000000 +0200
358 ++++ openl2tp-1.8/l2tp_config_token.l 2011-06-04 21:34:50.000000000 +0200
359 +@@ -192,6 +192,7 @@
360 + auth_none { return(AUTH_NOAUTH); }
361 + auth_peer { return(AUTH_PEER); }
362 + optionsfile { return(OPTIONSFILE); }
363 ++clientip_as_ipparam { return(CLIENTIP_AS_IPPARAM); }
364 +
365 + {ws} { }
366 + {linecont} { lineno++; }
367 +diff -brau openl2tp-1.8.o/l2tp_ppp.c openl2tp-1.8/l2tp_ppp.c
368 +--- openl2tp-1.8.o/l2tp_ppp.c 2011-06-04 16:08:25.000000000 +0200
369 ++++ openl2tp-1.8/l2tp_ppp.c 2011-06-04 21:42:37.000000000 +0200
370 +@@ -71,6 +71,7 @@
371 + int auth_refuse_mschapv2:1;
372 + int auth_refuse_eap:1;
373 + char *optionsfile;
374 ++ int clientip_as_ipparam;
375 + };
376 +
377 + static struct l2tp_ppp_profile *l2tp_ppp_defaults;
378 +@@ -245,6 +246,9 @@
379 + if (msg->flags2 & L2TP_API_PPP_PROFILE_FLAG_OPTIONSFILE) {
380 + L2TP_SET_OPTSTRING_VAR(profile, optionsfile);
381 + }
382 ++ if (msg->flags2 & L2TP_API_PPP_PROFILE_FLAG_CLIENTIP_AS_IPPARAM) {
383 ++ profile->clientip_as_ipparam = msg->clientip_as_ipparam;
384 ++ }
385 +
386 + out:
387 + return result;
388 +@@ -294,6 +298,7 @@
389 + profile->chap_interval = l2tp_ppp_defaults->chap_interval;
390 + profile->chap_max_challenge = l2tp_ppp_defaults->chap_max_challenge;
391 + profile->chap_restart = l2tp_ppp_defaults->chap_restart;
392 ++ profile->clientip_as_ipparam = l2tp_ppp_defaults->clientip_as_ipparam;
393 + profile->pap_max_auth_requests = l2tp_ppp_defaults->pap_max_auth_requests;
394 + profile->pap_restart_interval = l2tp_ppp_defaults->pap_restart_interval;
395 + profile->pap_timeout = l2tp_ppp_defaults->pap_timeout;
396 +@@ -553,6 +558,7 @@
397 + result->chap_interval = profile->chap_interval;
398 + result->chap_max_challenge = profile->chap_max_challenge;
399 + result->chap_restart = profile->chap_restart;
400 ++ result->clientip_as_ipparam = profile->clientip_as_ipparam;
401 + result->pap_max_auth_requests = profile->pap_max_auth_requests;
402 + result->pap_restart_interval = profile->pap_restart_interval;
403 + result->pap_timeout = profile->pap_timeout;
404 +@@ -893,6 +899,9 @@
405 + }
406 + profile->optionsfile = NULL;
407 + }
408 ++ if (msg.flags2 & L2TP_API_PPP_PROFILE_FLAG_CLIENTIP_AS_IPPARAM) {
409 ++ profile->use_radius = L2TP_API_PPP_PROFILE_DEFAULT_CLIENTIP_AS_IPPARAM;
410 ++ }
411 +
412 + /* Clear all requested flags */
413 + profile->flags &= ~(msg.flags);
414 +diff -brau openl2tp-1.8.o/l2tp_rpc.x openl2tp-1.8/l2tp_rpc.x
415 +--- openl2tp-1.8.o/l2tp_rpc.x 2011-06-04 11:06:08.000000000 +0200
416 ++++ openl2tp-1.8/l2tp_rpc.x 2011-06-04 21:45:00.000000000 +0200
417 +@@ -947,6 +947,7 @@
418 + const L2TP_API_PPP_PROFILE_FLAG_AUTH_REFUSE_PAP = 131072;
419 + const L2TP_API_PPP_PROFILE_FLAG_AUTH_PEER = 262144;
420 + const L2TP_API_PPP_PROFILE_FLAG_OPTIONSFILE = 524288;
421 ++const L2TP_API_PPP_PROFILE_FLAG_CLIENTIP_AS_IPPARAM = 1048576;
422 +
423 + /* Default values for PPP profile attributes.
424 + * These are used if an explicit value is not provided by the user.
425 +@@ -995,6 +996,7 @@
426 + const L2TP_API_PPP_PROFILE_DEFAULT_MULTILINK = 0;
427 + const L2TP_API_PPP_PROFILE_DEFAULT_PROXY_ARP = 0;
428 + const L2TP_API_PPP_PROFILE_DEFAULT_OPTIONSFILE = "";
429 ++const L2TP_API_PPP_PROFILE_DEFAULT_CLIENTIP_AS_IPPARAM = 0;
430 +
431 + enum l2tp_api_ppp_sync_mode {
432 + L2TP_API_PPP_SYNCMODE_SYNC_ASYNC,
433 +@@ -1054,6 +1056,7 @@
434 + optstring remote_name;
435 + bool proxy_arp;
436 + optstring optionsfile;
437 ++ bool clientip_as_ipparam;
438 + };
439 +
440 + struct l2tp_api_ppp_profile_list_entry {
441 +diff -brau openl2tp-1.8.o/plugins/ppp_unix.c openl2tp-1.8/plugins/ppp_unix.c
442 +--- openl2tp-1.8.o/plugins/ppp_unix.c 2011-06-04 14:41:43.000000000 +0200
443 ++++ openl2tp-1.8/plugins/ppp_unix.c 2011-06-04 22:11:54.000000000 +0200
444 +@@ -295,6 +295,13 @@
445 + argv[arg++] = "sync";
446 + }
447 +
448 ++ /* Check if we should pass ipparam */
449 ++ if (params->flags2 & L2TP_API_PPP_PROFILE_FLAG_CLIENTIP_AS_IPPARAM) {
450 ++ argv[arg++] = "ipparam";
451 ++ ip.s_addr = l2tp_tunnel_get_peer_addr(ppp->tunnel)->sin_addr.s_addr;
452 ++ argv[arg++] = strdup(inet_ntoa(ip));
453 ++ }
454 ++
455 + /* ppp auth options */
456 + if ((params->flags2 & L2TP_API_PPP_PROFILE_FLAG_AUTH_REFUSE_EAP) &&
457 + params->auth_refuse_eap) {
458
459 diff --git a/net-dialup/openl2tp/files/openl2tp-1.8-configure-Makefile.patch b/net-dialup/openl2tp/files/openl2tp-1.8-configure-Makefile.patch
460 new file mode 100644
461 index 00000000000..f840b2bea84
462 --- /dev/null
463 +++ b/net-dialup/openl2tp/files/openl2tp-1.8-configure-Makefile.patch
464 @@ -0,0 +1,58 @@
465 +--- openl2tp-1.8/Makefile.orig 2018-03-17 14:24:57.000000000 +0300
466 ++++ openl2tp-1.8/Makefile 2018-03-17 14:46:34.769800757 +0300
467 +@@ -1,26 +1,26 @@
468 + # BEGIN CONFIGURABLE SETTINGS
469 +
470 + # Compile-time features
471 +-L2TP_FEATURE_LAC_SUPPORT= y
472 +-L2TP_FEATURE_LNS_SUPPORT= y
473 +-L2TP_FEATURE_RPC_MANAGEMENT= y
474 +-L2TP_FEATURE_LAIC_SUPPORT= y
475 +-L2TP_FEATURE_LAOC_SUPPORT= y
476 +-L2TP_FEATURE_LNIC_SUPPORT= y
477 +-L2TP_FEATURE_LNOC_SUPPORT= y
478 ++L2TP_FEATURE_LAC_SUPPORT ?= y
479 ++L2TP_FEATURE_LNS_SUPPORT ?= y
480 ++L2TP_FEATURE_RPC_MANAGEMENT ?= y
481 ++L2TP_FEATURE_LAIC_SUPPORT ?= y
482 ++L2TP_FEATURE_LAOC_SUPPORT ?= y
483 ++L2TP_FEATURE_LNIC_SUPPORT ?= y
484 ++L2TP_FEATURE_LNOC_SUPPORT ?= y
485 + L2TP_FEATURE_LOCAL_CONF_FILE= y
486 +-#L2TP_FEATURE_LOCAL_STAT_FILE= y
487 ++L2TP_FEATURE_LOCAL_STAT_FILE ?= n
488 +
489 + # Define USE_DMALLOC to enable dmalloc memory debugging
490 +-# USE_DMALLOC= y
491 ++USE_DMALLOC ?= n
492 +
493 + # Define to include test code. This must be defined to run the
494 + # regression tests
495 +-# L2TP_TEST= y
496 ++L2TP_TEST ?= n
497 +
498 + # Define to compile in debug code. Also makes default trace flags
499 + # enable all messages
500 +-# L2TP_DEBUG= y
501 ++L2TP_DEBUG ?= n
502 +
503 + # Use asynchronous RPC requests where appropriate
504 + # Affects only L2TP-PPP-IPPOOL interfaces, not management interfaces.
505 +@@ -99,12 +99,14 @@
506 +
507 + # Build pppd dir only if ppp version is earlier than 2.4.5 since the
508 + # openl2tp plugins were integrated in ppp-2.4.5.
509 +-PPPD_SUBDIR=pppd
510 +-ifeq ($(PPPD_VERSION),2.4.5)
511 + PPPD_SUBDIR=
512 ++
513 ++TEST=
514 ++ifeq ($(L2TP_TEST),y)
515 ++TEST=test
516 + endif
517 +
518 +-SUBDIRS= usl cli plugins $(PPPD_SUBDIR) test doc
519 ++SUBDIRS= usl cli plugins $(PPPD_SUBDIR) $(TEST) doc
520 +
521 + .PHONY: $(SUBDIRS:%=subdir-%)
522 +
523
524 diff --git a/net-dialup/openl2tp/files/openl2tp-1.8-l2tpconfig.patch b/net-dialup/openl2tp/files/openl2tp-1.8-l2tpconfig.patch
525 new file mode 100644
526 index 00000000000..bf1644c9a14
527 --- /dev/null
528 +++ b/net-dialup/openl2tp/files/openl2tp-1.8-l2tpconfig.patch
529 @@ -0,0 +1,15 @@
530 +diff -Naur openl2tp-1.7.man//Makefile openl2tp-1.7/Makefile
531 +--- openl2tp-1.7.man//Makefile 2010-09-05 11:02:18.000000000 +0400
532 ++++ openl2tp-1.7/Makefile 2010-09-05 12:25:51.694863508 +0400
533 +@@ -314,9 +314,9 @@
534 + $(INSTALL) openl2tpd $(DESTDIR)/usr/sbin
535 +
536 + install-app:
537 +- $(INSTALL) -d $(DESTDIR)/usr/bin
538 ++ $(INSTALL) -d $(DESTDIR)/usr/sbin
539 + ifeq ($(L2TP_FEATURE_RPC_MANAGEMENT),y)
540 +- $(INSTALL) l2tpconfig $(DESTDIR)/usr/bin
541 ++ $(INSTALL) -m 0500 l2tpconfig $(DESTDIR)/usr/sbin
542 + endif
543 + $(INSTALL) -d $(DESTDIR)$(SYS_LIBDIR)/openl2tp
544 + $(INSTALL) -m 0644 l2tp_rpc.x $(DESTDIR)$(SYS_LIBDIR)/openl2tp/l2tp_rpc.x
545
546 diff --git a/net-dialup/openl2tp/files/openl2tp-1.8-ldflags.patch b/net-dialup/openl2tp/files/openl2tp-1.8-ldflags.patch
547 new file mode 100644
548 index 00000000000..7d1efffae92
549 --- /dev/null
550 +++ b/net-dialup/openl2tp/files/openl2tp-1.8-ldflags.patch
551 @@ -0,0 +1,73 @@
552 +diff -Naur openl2tp-1.8.werror/Makefile openl2tp-1.8/Makefile
553 +--- openl2tp-1.8.werror/Makefile 2010-11-28 17:18:02.000000000 +0300
554 ++++ openl2tp-1.8/Makefile 2010-11-28 17:22:27.950475976 +0300
555 +@@ -266,10 +266,10 @@
556 + etags $(wildcard *.c) $(wildcard *.h)
557 +
558 + openl2tpd: $(L2TPD_SRCS.o)
559 +- $(CC) -o $@ $^ $(LDFLAGS.l2tpd)
560 ++ $(CC) $(LDFLAGS) -o $@ $^ $(LDFLAGS.l2tpd)
561 +
562 + l2tpconfig: $(L2TPCONFIG_SRCS.o)
563 +- $(CC) -o $@ $^ $(LDFLAGS.l2tpconfig)
564 ++ $(CC) $(LDFLAGS) -o $@ $^ $(LDFLAGS.l2tpconfig)
565 +
566 + %.o: %.c
567 + $(CC) -c $(CFLAGS) $< -o $@
568 +diff -Naur openl2tp-1.8.werror/cli/Makefile openl2tp-1.8/cli/Makefile
569 +--- openl2tp-1.8.werror/cli/Makefile 2010-11-28 17:18:27.000000000 +0300
570 ++++ openl2tp-1.8/cli/Makefile 2010-11-28 17:22:27.950475976 +0300
571 +@@ -19,7 +19,7 @@
572 + $(AR) rus $@ $^
573 +
574 + cli_test: $(CLI_SRCS_TEST.o) libcli.a
575 +- $(CC) -o $@ $(CLI_SRCS_TEST.o) $(LDFLAGS.cli_test)
576 ++ $(CC) $(LDFLAGS) -o $@ $(CLI_SRCS_TEST.o) $(LDFLAGS.cli_test)
577 +
578 + clean:
579 + $(RM) $(CLI_SRCS.o) $(CLI_SRCS_TEST.o) libcli.a cli_test $(wildcard *.d)
580 +diff -Naur openl2tp-1.8.werror/plugins/Makefile openl2tp-1.8/plugins/Makefile
581 +--- openl2tp-1.8.werror/plugins/Makefile 2010-11-22 17:05:29.000000000 +0300
582 ++++ openl2tp-1.8/plugins/Makefile 2010-11-28 17:22:27.950475976 +0300
583 +@@ -1,7 +1,7 @@
584 + CFLAGS := $(CFLAGS.optimize) -MMD -Wall \
585 + -isystem ../include \
586 + -I. -I.. -I../usl -fPIC $(EXTRA_CFLAGS)
587 +-LDFLAGS := -shared
588 ++LDFLAGS.plugins := -shared
589 +
590 + PLUGINS.c:= ppp_unix.c ppp_null.c ipsec.c event_sock.c
591 +
592 +@@ -21,7 +21,7 @@
593 + $(RM) $(PLUGINS.so) $(wildcard *.o) $(wildcard *.d) $(SRC.generated)
594 +
595 + %.so: %.c
596 +- $(CC) -o $@ $(LDFLAGS) $(CFLAGS) $<
597 ++ $(CC) $(LDFLAGS) -o $@ $(LDFLAGS.plugins) $(CFLAGS) $<
598 +
599 + install: all
600 + $(INSTALL) -d $(DESTDIR)$(SYS_LIBDIR)/openl2tp
601 +diff -Naur openl2tp-1.8.werror/test/Makefile openl2tp-1.8/test/Makefile
602 +--- openl2tp-1.8.werror/test/Makefile 2007-05-28 18:28:53.000000000 +0400
603 ++++ openl2tp-1.8/test/Makefile 2010-11-28 17:25:52.871882050 +0300
604 +@@ -3,7 +3,7 @@
605 + all: pppd_dummy
606 +
607 + pppd_dummy: pppd_dummy.c
608 +- $(CC) -o $@ $<
609 ++ $(CC) $(LDFLAGS) -o $@ $<
610 +
611 + clean:
612 + -$(RM) pppd_dummy
613 +diff -Naur openl2tp-1.8.werror/usl/Makefile openl2tp-1.8/usl/Makefile
614 +--- openl2tp-1.8.werror/usl/Makefile 2010-11-28 17:18:15.000000000 +0300
615 ++++ openl2tp-1.8/usl/Makefile 2010-11-28 17:22:27.950475976 +0300
616 +@@ -26,7 +26,7 @@
617 + $(AR) rus $@ $^
618 +
619 + usl_test: $(USL_SRCS_TEST.o) libusl.a
620 +- $(CC) -o $@ $(USL_SRCS_TEST.o) $(LDFLAGS.usl_test)
621 ++ $(CC) $(LDFLAGS) -o $@ $(USL_SRCS_TEST.o) $(LDFLAGS.usl_test)
622 +
623 + clean:
624 + -$(RM) $(USL_SRCS.o) $(USL_SRCS_TEST.o) libusl.a usl_test $(wildcard *.d)
625
626 diff --git a/net-dialup/openl2tp/files/openl2tp-1.8-man.patch b/net-dialup/openl2tp/files/openl2tp-1.8-man.patch
627 new file mode 100644
628 index 00000000000..5375e169585
629 --- /dev/null
630 +++ b/net-dialup/openl2tp/files/openl2tp-1.8-man.patch
631 @@ -0,0 +1,40 @@
632 +diff -Naur openl2tp-1.7.pppd/doc/Makefile openl2tp-1.7/doc/Makefile
633 +--- openl2tp-1.7.pppd/doc/Makefile 2007-05-28 19:53:38.000000000 +0400
634 ++++ openl2tp-1.7/doc/Makefile 2010-07-31 18:21:56.163449838 +0400
635 +@@ -11,29 +11,24 @@
636 + MANSRC+= $(MANSRC.5)
637 + endif
638 +
639 +-all: $(MANSRC:%=%.gz)
640 +-
641 +-%.gz: %
642 +- gzip --best -c $< > $@
643 ++all: $(MANSRC)
644 +
645 + clean:
646 +- -$(RM) $(MANSRC:%=%.gz)
647 ++ -$(RM) $(MANSRC)
648 +
649 + install: all
650 + $(INSTALL) -d $(DESTDIR)/usr/share/man/man1
651 +-ifeq ($(L2TP_FEATURE_RPC_MANAGEMENT),y)
652 +- $(INSTALL) $(MANSRC.1:%=%.gz) $(DESTDIR)/usr/share/man/man1
653 ++ $(INSTALL) $(MANSRC.1) $(DESTDIR)/usr/share/man/man1
654 +-endif
655 + $(INSTALL) -d $(DESTDIR)/usr/share/man/man4
656 +- $(INSTALL) $(MANSRC.4:%=%.gz) $(DESTDIR)/usr/share/man/man4
657 ++ $(INSTALL) $(MANSRC.4) $(DESTDIR)/usr/share/man/man4
658 + ifeq ($(L2TP_FEATURE_LOCAL_CONF_FILE),y)
659 + $(INSTALL) -d $(DESTDIR)/usr/share/man/man5
660 +- $(INSTALL) $(MANSRC.5:%=%.gz) $(DESTDIR)/usr/share/man/man5
661 ++ $(INSTALL) $(MANSRC.5) $(DESTDIR)/usr/share/man/man5
662 + endif
663 + $(INSTALL) -d $(DESTDIR)/usr/share/man/man7
664 +- $(INSTALL) $(MANSRC.7:%=%.gz) $(DESTDIR)/usr/share/man/man7
665 ++ $(INSTALL) $(MANSRC.7) $(DESTDIR)/usr/share/man/man7
666 + $(INSTALL) -d $(DESTDIR)/usr/share/man/man8
667 +- $(INSTALL) $(MANSRC.8:%=%.gz) $(DESTDIR)/usr/share/man/man8
668 ++ $(INSTALL) $(MANSRC.8) $(DESTDIR)/usr/share/man/man8
669 +
670 + TAGS:
671 +
672
673 diff --git a/net-dialup/openl2tp/files/openl2tp-1.8-optionsfile.patch b/net-dialup/openl2tp/files/openl2tp-1.8-optionsfile.patch
674 new file mode 100644
675 index 00000000000..45c209fc775
676 --- /dev/null
677 +++ b/net-dialup/openl2tp/files/openl2tp-1.8-optionsfile.patch
678 @@ -0,0 +1,306 @@
679 +diff -brau openl2tp-1.8.o/doc/openl2tp_rpc.4 openl2tp-1.8/doc/openl2tp_rpc.4
680 +--- openl2tp-1.8.o/doc/openl2tp_rpc.4 2010-11-09 16:50:58.000000000 +0200
681 ++++ openl2tp-1.8/doc/openl2tp_rpc.4 2011-06-04 10:02:34.000000000 +0200
682 +@@ -774,6 +774,10 @@
683 + .B local_ip_addr
684 + The IP address to assign to the local end of the PPP link.
685 + .TP
686 ++.B optionsfile
687 ++Passes a file parameter to the pppd daemon, allowing for loading a custom
688 ++options file. See pppd(8) for more details.
689 ++.TP
690 + .B peer_ip_addr
691 + The IP address to assign to the remote (peer) end of the PPP link.
692 + .TP
693 +diff -brau openl2tp-1.8.o/l2tp_common.c openl2tp-1.8/l2tp_common.c
694 +--- openl2tp-1.8.o/l2tp_common.c 2008-01-08 19:23:51.000000000 +0200
695 ++++ openl2tp-1.8/l2tp_common.c 2011-06-04 21:00:45.000000000 +0200
696 +@@ -938,6 +938,10 @@
697 + }
698 + len += fprintf(file, " multilink: %s, proxy arp: %s\n",
699 + pp->multilink ? "YES" : "NO", pp->proxy_arp ? "YES" : "NO");
700 ++ if (OPTSTRING_PTR(pp->optionsfile) != NULL) {
701 ++ len += fprintf(file, " optionsfile: %s\n", OPTSTRING(pp->optionsfile));
702 ++ }
703 ++
704 + len += fprintf(file, " IP parameters:-\n");
705 + ip_to_string(&local_ip[0], pp->local_ip_addr.s_addr);
706 + ip_to_string(&peer_ip[0], pp->peer_ip_addr.s_addr);
707 +diff -brau openl2tp-1.8.o/l2tp_config.c openl2tp-1.8/l2tp_config.c
708 +--- openl2tp-1.8.o/l2tp_config.c 2010-01-18 12:35:14.000000000 +0200
709 ++++ openl2tp-1.8/l2tp_config.c 2011-06-04 11:43:03.000000000 +0200
710 +@@ -3123,6 +3123,7 @@
711 + L2TP_PPP_ARGID_LOCAL_NAME,
712 + L2TP_PPP_ARGID_REMOTE_NAME,
713 + L2TP_PPP_ARGID_PROXY_ARP,
714 ++ L2TP_PPP_ARGID_OPTIONSFILE,
715 + } l2tp_ppp_arg_ids_t;
716 +
717 + #undef ARG
718 +@@ -3187,7 +3188,8 @@
719 + ARG(REMOTE_NAME, "remote_name", 0, string, "Name to assume for the remote peer for authentication purposes"), \
720 + ARG(USE_AS_DEFAULT_ROUTE, "default_route", 0, bool, "Use link as default route"), \
721 + ARG(MULTILINK, "multilink", 0, bool, "Enable PPP multilink connections."), \
722 +- ARG(PROXY_ARP, "proxy_arp", 0, bool, "Use proxy arp.")
723 ++ ARG(PROXY_ARP, "proxy_arp", 0, bool, "Use proxy arp."), \
724 ++ ARG(OPTIONSFILE, "optionsfile", 0, string, "ppp options file to use")
725 +
726 +
727 + static struct cli_arg_entry l2tp_args_ppp_profile_create[] = {
728 +@@ -3267,6 +3269,7 @@
729 + FLG(USE_AS_DEFAULT_ROUTE, "default_route", "Use link as default route"), \
730 + FLG(MULTILINK, "multilink", "Enable PPP multilink connections."), \
731 + FLG(PROXY_ARP, "proxy_arp", "Use proxy arp."),
732 ++ FLG(OPTIONSFILE, "optionsfile", "ppp options file to use"),
733 + { NULL, },
734 + };
735 +
736 +@@ -3488,6 +3491,15 @@
737 + msg->remote_name.valid = 1;
738 + msg->flags2 |= L2TP_API_PPP_PROFILE_FLAG_REMOTE_NAME;
739 + break;
740 ++ case L2TP_PPP_ARGID_OPTIONSFILE:
741 ++ OPTSTRING(msg->optionsfile) = strdup(arg_value);
742 ++ if (OPTSTRING(msg->optionsfile) == NULL) {
743 ++ result = -ENOMEM;
744 ++ goto out;
745 ++ }
746 ++ msg->optionsfile.valid = 1;
747 ++ msg->flags2 |= L2TP_API_PPP_PROFILE_FLAG_OPTIONSFILE;
748 ++ break;
749 + }
750 +
751 + result = 0;
752 +@@ -3856,6 +3868,9 @@
753 + case L2TP_PPP_ARGID_REMOTE_NAME:
754 + msg.flags2 |= L2TP_API_PPP_PROFILE_FLAG_REMOTE_NAME;
755 + break;
756 ++ case L2TP_PPP_ARGID_OPTIONSFILE:
757 ++ msg.flags2 |= L2TP_API_PPP_PROFILE_FLAG_OPTIONSFILE;
758 ++ break;
759 + }
760 + } L2TP_ACT_END();
761 +
762 +@@ -4867,6 +4882,7 @@
763 + L2TP_API_PPP_PROFILE_FLAG_LOCAL_NAME |
764 + L2TP_API_PPP_PROFILE_FLAG_REMOTE_NAME |
765 + L2TP_API_PPP_PROFILE_FLAG_PROXY_ARP |
766 ++ L2TP_API_PPP_PROFILE_FLAG_OPTIONSFILE |
767 + L2TP_API_PPP_PROFILE_FLAG_AUTH_NONE |
768 + L2TP_API_PPP_PROFILE_FLAG_AUTH_REFUSE_EAP |
769 + L2TP_API_PPP_PROFILE_FLAG_AUTH_REFUSE_MSCHAPV2 |
770 +@@ -5028,6 +5044,9 @@
771 + if (cfg->flags2 & L2TP_API_PPP_PROFILE_FLAG_PROXY_ARP) {
772 + fprintf(file, "\tproxy_arp=%s \\\n", Y_OR_N(cfg->proxy_arp));
773 + }
774 ++ if ((cfg->flags2 & L2TP_API_PPP_PROFILE_FLAG_OPTIONSFILE) && (OPTSTRING_PTR(cfg->optionsfile) != NULL)) {
775 ++ fprintf(file, "\toptionsfile=%s \\\n", OPTSTRING_PTR(cfg->optionsfile));
776 ++ }
777 + fprintf(file, "\n");
778 + }
779 + }
780 +diff -brau openl2tp-1.8.o/l2tp_config_parse.y openl2tp-1.8/l2tp_config_parse.y
781 +--- openl2tp-1.8.o/l2tp_config_parse.y 2010-11-09 16:50:58.000000000 +0200
782 ++++ openl2tp-1.8/l2tp_config_parse.y 2011-06-04 11:11:42.000000000 +0200
783 +@@ -154,6 +154,7 @@
784 + %token QUOTEDSTRING
785 + %token BOOL
786 + %token IPADDRESS
787 ++%token OPTIONSFILE
788 +
789 + %token INITIAL_RCVD_LCP_CONFREQ
790 + %token CALLING_NUMBER
791 +@@ -1167,6 +1168,18 @@
792 + OPTSTRING(ppp_profile.remote_name) = $3.buf;
793 + ppp_profile.remote_name.valid = 1;
794 + }
795 ++ | OPTIONSFILE EQUALS STRING
796 ++ {
797 ++ ppp_profile.flags2 |= L2TP_API_PPP_PROFILE_FLAG_OPTIONSFILE;
798 ++ OPTSTRING(ppp_profile.optionsfile) = $3.buf;
799 ++ ppp_profile.optionsfile.valid = 1;
800 ++ }
801 ++ | OPTIONSFILE EQUALS QUOTEDSTRING
802 ++ {
803 ++ ppp_profile.flags2 |= L2TP_API_PPP_PROFILE_FLAG_OPTIONSFILE;
804 ++ OPTSTRING(ppp_profile.optionsfile) = $3.buf;
805 ++ ppp_profile.optionsfile.valid = 1;
806 ++ }
807 + ;
808 +
809 + tunnel_command
810 +diff -brau openl2tp-1.8.o/l2tp_config_token.l openl2tp-1.8/l2tp_config_token.l
811 +--- openl2tp-1.8.o/l2tp_config_token.l 2010-11-12 14:31:21.000000000 +0200
812 ++++ openl2tp-1.8/l2tp_config_token.l 2011-06-04 11:08:31.000000000 +0200
813 +@@ -191,6 +191,7 @@
814 + auth_eap { return(AUTH_EAP); }
815 + auth_none { return(AUTH_NOAUTH); }
816 + auth_peer { return(AUTH_PEER); }
817 ++optionsfile { return(OPTIONSFILE); }
818 +
819 + {ws} { }
820 + {linecont} { lineno++; }
821 +diff -brau openl2tp-1.8.o/l2tp_ppp.c openl2tp-1.8/l2tp_ppp.c
822 +--- openl2tp-1.8.o/l2tp_ppp.c 2008-05-07 22:44:20.000000000 +0200
823 ++++ openl2tp-1.8/l2tp_ppp.c 2011-06-04 16:08:25.000000000 +0200
824 +@@ -70,6 +70,7 @@
825 + int auth_refuse_mschap:1;
826 + int auth_refuse_mschapv2:1;
827 + int auth_refuse_eap:1;
828 ++ char *optionsfile;
829 + };
830 +
831 + static struct l2tp_ppp_profile *l2tp_ppp_defaults;
832 +@@ -241,6 +242,9 @@
833 + if (msg->flags2 & L2TP_API_PPP_PROFILE_FLAG_REMOTE_NAME) {
834 + L2TP_SET_OPTSTRING_VAR(profile, remote_name);
835 + }
836 ++ if (msg->flags2 & L2TP_API_PPP_PROFILE_FLAG_OPTIONSFILE) {
837 ++ L2TP_SET_OPTSTRING_VAR(profile, optionsfile);
838 ++ }
839 +
840 + out:
841 + return result;
842 +@@ -346,6 +350,14 @@
843 + }
844 + }
845 +
846 ++ if (l2tp_ppp_defaults->optionsfile != NULL) {
847 ++ profile->optionsfile = strdup(l2tp_ppp_defaults->optionsfile);
848 ++ if (profile->optionsfile == NULL) {
849 ++ *result = -ENOMEM;
850 ++ goto err;
851 ++ }
852 ++ }
853 ++
854 + /* Override defaults by user-supplied params */
855 + *result = l2tp_ppp_profile_modify(&msg, profile);
856 +
857 +@@ -379,6 +391,24 @@
858 + *result = -ENOMEM;
859 + goto out;
860 + err:
861 ++ if (profile->radius_hint != NULL) {
862 ++ free(profile->radius_hint);
863 ++ }
864 ++ if (profile->ip_pool_name != NULL) {
865 ++ free(profile->ip_pool_name);
866 ++ }
867 ++ if (profile->profile_name != NULL) {
868 ++ free(profile->profile_name);
869 ++ }
870 ++ if (profile->local_name != NULL) {
871 ++ free(profile->local_name);
872 ++ }
873 ++ if (profile->remote_name != NULL) {
874 ++ free(profile->remote_name);
875 ++ }
876 ++ if (profile->optionsfile != NULL) {
877 ++ free(profile->optionsfile);
878 ++ }
879 + free(profile);
880 + goto out;
881 + }
882 +@@ -430,6 +460,9 @@
883 + if (profile->remote_name != NULL) {
884 + free(profile->remote_name);
885 + }
886 ++ if (profile->optionsfile != NULL) {
887 ++ free(profile->optionsfile);
888 ++ }
889 + USL_POISON_MEMORY(profile, 0xe5, sizeof(*profile));
890 + free(profile);
891 + *result = 0;
892 +@@ -578,6 +611,14 @@
893 + }
894 + result->remote_name.valid = 1;
895 + }
896 ++ if (profile->optionsfile != NULL) {
897 ++ OPTSTRING(result->optionsfile) = strdup(profile->optionsfile);
898 ++ if (OPTSTRING(result->optionsfile) == NULL) {
899 ++ result->result_code = -ENOMEM;
900 ++ goto out;
901 ++ }
902 ++ result->optionsfile.valid = 1;
903 ++ }
904 +
905 + out:
906 + L2TP_DEBUG(L2TP_API, "%s: flags=%x/%x result=%d", __func__, result->flags, result->flags2, result->result_code);
907 +@@ -598,6 +639,9 @@
908 + if (OPTSTRING_PTR(msg->remote_name) != NULL) {
909 + free(OPTSTRING(msg->remote_name));
910 + }
911 ++ if (OPTSTRING_PTR(msg->optionsfile) != NULL) {
912 ++ free(OPTSTRING(msg->optionsfile));
913 ++ }
914 + if (msg->profile_name != NULL) {
915 + free(msg->profile_name);
916 + }
917 +@@ -843,6 +887,12 @@
918 + }
919 + profile->remote_name = NULL;
920 + }
921 ++ if (msg.flags2 & L2TP_API_PPP_PROFILE_FLAG_OPTIONSFILE) {
922 ++ if (profile->optionsfile != NULL) {
923 ++ free(profile->optionsfile);
924 ++ }
925 ++ profile->optionsfile = NULL;
926 ++ }
927 +
928 + /* Clear all requested flags */
929 + profile->flags &= ~(msg.flags);
930 +@@ -937,6 +987,12 @@
931 + }
932 + l2tp_ppp_defaults->local_name = NULL;
933 + l2tp_ppp_defaults->remote_name = NULL;
934 ++ if (strlen(L2TP_API_PPP_PROFILE_DEFAULT_OPTIONSFILE) > 0) {
935 ++ l2tp_ppp_defaults->optionsfile = strdup(L2TP_API_PPP_PROFILE_DEFAULT_OPTIONSFILE);
936 ++ if (l2tp_ppp_defaults->optionsfile == NULL) {
937 ++ goto nomem;
938 ++ }
939 ++ }
940 +
941 + USL_LIST_HEAD_INIT(&l2tp_ppp_defaults->list);
942 + usl_list_add(&l2tp_ppp_defaults->list, &l2tp_ppp_profile_list);
943 +diff -brau openl2tp-1.8.o/l2tp_rpc.x openl2tp-1.8/l2tp_rpc.x
944 +--- openl2tp-1.8.o/l2tp_rpc.x 2010-11-04 18:30:36.000000000 +0200
945 ++++ openl2tp-1.8/l2tp_rpc.x 2011-06-04 11:06:08.000000000 +0200
946 +@@ -946,6 +946,7 @@
947 + const L2TP_API_PPP_PROFILE_FLAG_AUTH_REFUSE_CHAP = 65536;
948 + const L2TP_API_PPP_PROFILE_FLAG_AUTH_REFUSE_PAP = 131072;
949 + const L2TP_API_PPP_PROFILE_FLAG_AUTH_PEER = 262144;
950 ++const L2TP_API_PPP_PROFILE_FLAG_OPTIONSFILE = 524288;
951 +
952 + /* Default values for PPP profile attributes.
953 + * These are used if an explicit value is not provided by the user.
954 +@@ -993,6 +994,7 @@
955 + const L2TP_API_PPP_PROFILE_DEFAULT_USE_AS_DEFAULT_ROUTE = 0;
956 + const L2TP_API_PPP_PROFILE_DEFAULT_MULTILINK = 0;
957 + const L2TP_API_PPP_PROFILE_DEFAULT_PROXY_ARP = 0;
958 ++const L2TP_API_PPP_PROFILE_DEFAULT_OPTIONSFILE = "";
959 +
960 + enum l2tp_api_ppp_sync_mode {
961 + L2TP_API_PPP_SYNCMODE_SYNC_ASYNC,
962 +@@ -1051,6 +1053,7 @@
963 + optstring local_name;
964 + optstring remote_name;
965 + bool proxy_arp;
966 ++ optstring optionsfile;
967 + };
968 +
969 + struct l2tp_api_ppp_profile_list_entry {
970 +diff -brau openl2tp-1.8.o/plugins/ppp_unix.c openl2tp-1.8/plugins/ppp_unix.c
971 +--- openl2tp-1.8.o/plugins/ppp_unix.c 2010-11-22 16:03:48.000000000 +0200
972 ++++ openl2tp-1.8/plugins/ppp_unix.c 2011-06-04 14:41:43.000000000 +0200
973 +@@ -282,6 +282,11 @@
974 + }
975 + }
976 +
977 ++ if ((params->flags2 & L2TP_API_PPP_PROFILE_FLAG_OPTIONSFILE) && (OPTSTRING_PTR(params->optionsfile) != NULL)) {
978 ++ argv[arg++] = "file";
979 ++ argv[arg++] = strdup(OPTSTRING(params->optionsfile));
980 ++ }
981 ++
982 + /* By default, use sync mode */
983 + if (!((params->flags & L2TP_API_PPP_PROFILE_FLAG_SYNC_MODE) &&
984 + (params->sync_mode == L2TP_API_PPP_SYNCMODE_ASYNC))) {
985
986 diff --git a/net-dialup/openl2tp/files/openl2tp-1.8-parallelbuild.patch b/net-dialup/openl2tp/files/openl2tp-1.8-parallelbuild.patch
987 new file mode 100644
988 index 00000000000..fb6b9f96b35
989 --- /dev/null
990 +++ b/net-dialup/openl2tp/files/openl2tp-1.8-parallelbuild.patch
991 @@ -0,0 +1,30 @@
992 +diff -rau openl2tp-1.8.o/Makefile openl2tp-1.8/Makefile
993 +--- openl2tp-1.8.o/Makefile 2011-06-03 18:21:09.000000000 +0200
994 ++++ openl2tp-1.8/Makefile 2011-06-03 18:54:43.000000000 +0200
995 +@@ -197,7 +197,7 @@
996 +
997 + .PHONY: $(SUBDIRS:%=subdir-%)
998 +
999 +-$(SUBDIRS:%=subdir-%): FORCE
1000 ++$(SUBDIRS:%=subdir-%): FORCE generated-files
1001 + $(MAKE) -C $(@:subdir-%=%) $(MFLAGS) EXTRA_CFLAGS="$(CPPFLAGS)"
1002 +
1003 + ifeq ($(L2TP_FEATURE_LOCAL_CONF_FILE),y)
1004 +@@ -211,7 +211,7 @@
1005 + %.h %.c: %.y
1006 + $(YACC) -d -o l2tp_config_parse.c $<
1007 +
1008 +-l2tp_config_token.o: l2tp_config_token.c
1009 ++l2tp_config_token.o: l2tp_config_token.c l2tp_config_parse.h
1010 + $(CC) -I. -MMD -w $(CFLAGS.optimize) -c -DYY_NO_UNPUT $<
1011 +
1012 + l2tp_config_parse.o: l2tp_config_parse.c l2tp_config_parse.h
1013 +@@ -271,7 +271,7 @@
1014 + l2tpconfig: $(L2TPCONFIG_SRCS.o)
1015 + $(CC) $(LDFLAGS) -o $@ $^ $(LDFLAGS.l2tpconfig)
1016 +
1017 +-%.o: %.c
1018 ++%.o: %.c generated-files
1019 + $(CC) -c $(CFLAGS) $< -o $@
1020 +
1021 + l2tp_options.h: FORCE
1022
1023 diff --git a/net-dialup/openl2tp/files/openl2tp-1.8-pppd-2.patch b/net-dialup/openl2tp/files/openl2tp-1.8-pppd-2.patch
1024 new file mode 100644
1025 index 00000000000..5d326562c41
1026 --- /dev/null
1027 +++ b/net-dialup/openl2tp/files/openl2tp-1.8-pppd-2.patch
1028 @@ -0,0 +1,12 @@
1029 +diff -Nrau openl2tp-1.8.o/Makefile openl2tp-1.8/Makefile
1030 +--- openl2tp-1.8.o/Makefile 2011-06-03 17:45:24.000000000 +0200
1031 ++++ openl2tp-1.8/Makefile 2011-06-03 17:52:22.000000000 +0200
1032 +@@ -55,7 +55,7 @@
1033 + # in the pppd subdirectory of the compiler's default search path
1034 + # (e.g. /usr/include/pppd). but can be pointed to another directory if
1035 + # desired.
1036 +-PPPD_VERSION= 2.4.5
1037 ++#PPPD_VERSION= 2.4.5
1038 + # PPPD_INCDIR= /usr/include/pppd
1039 + # PPPD_LIBDIR= $(SYS_LIBDIR)/pppd/$(PPPD_VERSION)
1040 +
1041
1042 diff --git a/net-dialup/openl2tp/files/openl2tp-1.8-setkey.patch b/net-dialup/openl2tp/files/openl2tp-1.8-setkey.patch
1043 new file mode 100644
1044 index 00000000000..d7b9e068182
1045 --- /dev/null
1046 +++ b/net-dialup/openl2tp/files/openl2tp-1.8-setkey.patch
1047 @@ -0,0 +1,12 @@
1048 +diff -brau openl2tp-1.8.o/plugins/ipsec.c openl2tp-1.8/plugins/ipsec.c
1049 +--- openl2tp-1.8.o/plugins/ipsec.c 2010-01-18 11:00:08.000000000 +0200
1050 ++++ openl2tp-1.8/plugins/ipsec.c 2011-06-05 11:00:28.000000000 +0200
1051 +@@ -31,7 +31,7 @@
1052 + #include "usl.h"
1053 + #include "l2tp_private.h"
1054 +
1055 +-#define IPSEC_SETKEY_CMD "/sbin/setkey"
1056 ++#define IPSEC_SETKEY_CMD "/usr/sbin/setkey"
1057 + #define IPSEC_SETKEY_FILE "/tmp/openl2tpd-tmp"
1058 + #define IPSEC_SETKEY_ACTION IPSEC_SETKEY_CMD " -f " IPSEC_SETKEY_FILE
1059 +
1060
1061 diff --git a/net-dialup/openl2tp/files/openl2tp-1.8-tirpc.patch b/net-dialup/openl2tp/files/openl2tp-1.8-tirpc.patch
1062 new file mode 100644
1063 index 00000000000..038d53c30d5
1064 --- /dev/null
1065 +++ b/net-dialup/openl2tp/files/openl2tp-1.8-tirpc.patch
1066 @@ -0,0 +1,53 @@
1067 +diff -Naurd openl2tp-1.8.orig/Makefile openl2tp-1.8/Makefile
1068 +--- openl2tp-1.8.orig/Makefile 2018-07-03 05:02:39.734741959 +0900
1069 ++++ openl2tp-1.8/Makefile 2018-07-03 05:01:52.071450387 +0900
1070 +@@ -159,8 +159,8 @@
1071 + -MMD -Wall -Wno-strict-aliasing \
1072 + $(CPPFLAGS) $(CPPFLAGS.dmalloc) \
1073 + -DSYS_LIBDIR=$(SYS_LIBDIR)
1074 +-LDFLAGS.l2tpd= -Wl,-E -L. -Lusl -lusl -ldl $(LIBS.dmalloc) -lc
1075 ++LDFLAGS.l2tpd= -Wl,-E -L. -Lusl -lusl -ldl -ltirpc $(LIBS.dmalloc) -lc
1076 +-LDFLAGS.l2tpconfig= -Lcli -lcli -lreadline $(LIBS.dmalloc) $(READLINE_LDFLAGS) -lc
1077 ++LDFLAGS.l2tpconfig= -Lcli -lcli -lreadline -ltirpc $(LIBS.dmalloc) $(READLINE_LDFLAGS) -lc
1078 +
1079 + ifeq ($(L2TP_DEBUG),y)
1080 + CFLAGS.opt= -g
1081 +@@ -168,6 +168,7 @@
1082 + else
1083 + CFLAGS.opt= $(OPT_CFLAGS)
1084 + endif
1085 ++CFLAGS.opt+= -isystem /usr/include/tirpc
1086 + CFLAGS.optimize= $(CFLAGS) $(CFLAGS.opt)
1087 + export CFLAGS.optimize
1088 +
1089 +diff -Naurd openl2tp-1.8.orig/l2tp_api.c openl2tp-1.8/l2tp_api.c
1090 +--- openl2tp-1.8.orig/l2tp_api.c 2018-07-03 04:59:47.000000000 +0900
1091 ++++ openl2tp-1.8/l2tp_api.c 2018-07-03 05:01:52.073450358 +0900
1092 +@@ -25,6 +25,7 @@
1093 +
1094 + #include <rpc/pmap_clnt.h>
1095 + #include <net/ethernet.h>
1096 ++#include <netinet/in.h>
1097 +
1098 + #include "usl.h"
1099 +
1100 +@@ -443,14 +443,16 @@
1101 + */
1102 + int l2tp_api_rpc_check_request(SVCXPRT *xprt)
1103 + {
1104 ++ char straddr[INET6_ADDRSTRLEN];
1105 + /* If remote RPC is not enabled and the request is from a
1106 + * non-loopback interface, reject the request.
1107 + */
1108 + if ((!l2tp_opt_remote_rpc) &&
1109 +- ((xprt->xp_raddr.sin_addr.s_addr != htonl(INADDR_LOOPBACK)) &&
1110 +- (xprt->xp_raddr.sin_addr.s_addr != htonl(INADDR_ANY)))) {
1111 ++ memcmp(&xprt->xp_raddr.sin6_addr, &in6addr_loopback, 16) &&
1112 ++ memcmp(&xprt->xp_raddr.sin6_addr, &in6addr_any, 16)) {
1113 + if (l2tp_opt_trace_flags & L2TP_DEBUG_API) {
1114 +- l2tp_log(LOG_ERR, "Rejecting RPC request from %s", inet_ntoa(xprt->xp_raddr.sin_addr));
1115 ++ l2tp_log(LOG_ERR, "Rejecting RPC request from %s",
1116 ++ inet_ntop(AF_INET6, &xprt->xp_raddr.sin6_addr, straddr, INET6_ADDRSTRLEN));
1117 + }
1118 + svcerr_auth(xprt, AUTH_TOOWEAK);
1119 + return -EPERM;
1120
1121 diff --git a/net-dialup/openl2tp/files/openl2tp-1.8-unused-var.patch b/net-dialup/openl2tp/files/openl2tp-1.8-unused-var.patch
1122 new file mode 100644
1123 index 00000000000..2e1f6277cf5
1124 --- /dev/null
1125 +++ b/net-dialup/openl2tp/files/openl2tp-1.8-unused-var.patch
1126 @@ -0,0 +1,21 @@
1127 +diff -Naurd openl2tp-1.8.orig/pppd/pppol2tp.c openl2tp-1.8/pppd/pppol2tp.c
1128 +--- openl2tp-1.8.orig/pppd/pppol2tp.c 2010-11-15 15:12:43.000000000 +0300
1129 ++++ openl2tp-1.8/pppd/pppol2tp.c 2018-03-17 14:11:07.484281421 +0300
1130 +@@ -297,7 +297,7 @@
1131 + static bool got_recv_accm = 0;
1132 + static uint32_t recv_accm = 0xffffffff;
1133 + static uint32_t send_accm = 0xffffffff;
1134 +- static bool snooping = 1;
1135 ++ // static bool snooping = 1;
1136 +
1137 + uint16_t protocol;
1138 + uint16_t lcp_pkt_len;
1139 +@@ -328,7 +328,7 @@
1140 + "Network protocol %04x found.",
1141 + protocol);
1142 + }
1143 +- snooping = 0;
1144 ++ // snooping = 0;
1145 + return;
1146 + }
1147 +
1148
1149 diff --git a/net-dialup/openl2tp/files/openl2tp-1.8-werror.patch b/net-dialup/openl2tp/files/openl2tp-1.8-werror.patch
1150 new file mode 100644
1151 index 00000000000..d36447dfe96
1152 --- /dev/null
1153 +++ b/net-dialup/openl2tp/files/openl2tp-1.8-werror.patch
1154 @@ -0,0 +1,36 @@
1155 +diff -Naur openl2tp-1.8.orig/Makefile openl2tp-1.8/Makefile
1156 +--- openl2tp-1.8.orig/Makefile 2010-11-22 12:47:26.000000000 +0300
1157 ++++ openl2tp-1.8/Makefile 2010-11-28 17:18:02.547651027 +0300
1158 +@@ -154,7 +154,7 @@
1159 +
1160 + CPPFLAGS= $(CPPFLAGS.l2tptest) $(CPPFLAGS-y)
1161 + CFLAGS= -I. -Iusl -Icli -isystem include \
1162 +- -MMD -Wall -Werror -Wno-strict-aliasing \
1163 ++ -MMD -Wall -Wno-strict-aliasing \
1164 + $(CPPFLAGS) $(CPPFLAGS.dmalloc) \
1165 + -DSYS_LIBDIR=$(SYS_LIBDIR)
1166 + LDFLAGS.l2tpd= -Wl,-E -L. -Lusl -lusl -ldl $(LIBS.dmalloc) -lc
1167 +diff -Naur openl2tp-1.8.orig/cli/Makefile openl2tp-1.8/cli/Makefile
1168 +--- openl2tp-1.8.orig/cli/Makefile 2010-11-12 15:28:47.000000000 +0300
1169 ++++ openl2tp-1.8/cli/Makefile 2010-11-28 17:18:27.707453102 +0300
1170 +@@ -7,7 +7,7 @@
1171 +
1172 + LDFLAGS.cli_test= -L.. -L. $(READLINE_LDFLAGS) -lcli -lusl -lreadline -lcurses -lc
1173 +
1174 +-CFLAGS= $(CFLAGS.optimize) -MMD -Wall -Werror -I.. $(READLINE_CFLAGS)
1175 ++CFLAGS= $(CFLAGS.optimize) -MMD -Wall -I.. $(READLINE_CFLAGS)
1176 +
1177 + .PHONY: all test clean
1178 +
1179 +diff -Naur openl2tp-1.8.orig/usl/Makefile openl2tp-1.8/usl/Makefile
1180 +--- openl2tp-1.8.orig/usl/Makefile 2010-11-04 19:27:08.000000000 +0300
1181 ++++ openl2tp-1.8/usl/Makefile 2010-11-28 17:18:15.615816682 +0300
1182 +@@ -14,7 +14,7 @@
1183 + endif
1184 +
1185 + CPPFLAGS+= $(CFLAGS.optimize) -g
1186 +-CFLAGS= -I. -MMD -Wall -Werror -Wno-strict-aliasing $(CPPFLAGS) $(CPPFLAGS.dmalloc)
1187 ++CFLAGS= -I. -MMD -Wall -Wno-strict-aliasing $(CPPFLAGS) $(CPPFLAGS.dmalloc)
1188 +
1189 + .PHONY: all test clean
1190 +
1191
1192 diff --git a/net-dialup/openl2tp/files/openl2tpd.confd b/net-dialup/openl2tp/files/openl2tpd.confd
1193 new file mode 100644
1194 index 00000000000..c4b7ee5ec39
1195 --- /dev/null
1196 +++ b/net-dialup/openl2tp/files/openl2tpd.confd
1197 @@ -0,0 +1,17 @@
1198 +# Settings for the OpenL2TP daemon.
1199 +# OPENL2TPDARGS= : any extra command-line startup arguments for openl2tpd
1200 +# -D - enable debug messages from all tunnels and sessions
1201 +# -d nnn - set debug trace mask to nnn
1202 +# -L log-facility - set syslog facility (default LOG_DAEMON)
1203 +# -R - allow remote management using RPC
1204 +#
1205 +# OPENL2TPD_CONFIG_FILE= : a file containing L2TP config that
1206 +# is loaded when openl2tpd starts up.
1207 +
1208 +# Use ipsec.so plugin for IPSec setups.
1209 +#OPENL2TPDARGS="-p ipsec.so"
1210 +OPENL2TPDARGS=
1211 +
1212 +# Config file to load at openl2tpd startup.
1213 +# /etc/openl2tpd.conf is used by default if none is provided here
1214 +OPENL2TPD_CONFIG_FILE=
1215
1216 diff --git a/net-dialup/openl2tp/files/openl2tpd.initd b/net-dialup/openl2tp/files/openl2tpd.initd
1217 new file mode 100644
1218 index 00000000000..b1d1511a564
1219 --- /dev/null
1220 +++ b/net-dialup/openl2tp/files/openl2tpd.initd
1221 @@ -0,0 +1,69 @@
1222 +#!/sbin/openrc-run
1223 +# Copyright 1999-2018 Gentoo Foundation
1224 +# Distributed under the terms of the GNU General Public License v2
1225 +
1226 +userpc="yes"
1227 +retry_count="40"
1228 +retry_delay="0.5"
1229 +
1230 +bin=/usr/sbin/openl2tpd
1231 +pid=/var/run/openl2tpd.pid
1232 +[ -z "${OPENL2TPD_CONFIG_FILE}" ] && OPENL2TPD_CONFIG_FILE="/etc/openl2tpd.conf"
1233 +
1234 +depend() {
1235 + need net
1236 + [ "${userpc}" = "yes" ] && need portmap
1237 + use dns ipsec racoon
1238 +}
1239 +
1240 +check_module () {
1241 + if ! [ -f /proc/net/pppol2tp ]; then
1242 + ebegin "Loading l2tp module"
1243 + # try both new and old module names
1244 + modprobe l2tp_ppp 2>/dev/null || modprobe pppol2tp 2>/dev/null
1245 + eend $?
1246 + fi
1247 +}
1248 +
1249 +start() {
1250 + check_module
1251 + ebegin "Starting openl2tpd"
1252 + # if rpc is enabled do not read config file by daemon (has bugs),
1253 + # but read by l2tpconfig instead
1254 + if [ "${userpc}" = "yes" ]; then
1255 + conf="/dev/null"
1256 + else
1257 + conf="${OPENL2TPD_CONFIG_FILE}"
1258 + fi
1259 +
1260 + start-stop-daemon --start --quiet --exec ${bin} --pidfile ${pid} \
1261 + -- -c "$conf" ${OPENL2TPDARGS}
1262 +
1263 + # it is possible to not to have config at all
1264 + if [ "${userpc}" = "yes" ] && [ -r "${OPENL2TPD_CONFIG_FILE}" ]; then
1265 + # on system startup it may take some time to load daemon
1266 + local i=0;
1267 + while [ $i -lt $retry_count ]; do
1268 + l2tpconfig config restore file="${OPENL2TPD_CONFIG_FILE}" >/dev/null 2>&1
1269 + retcode=$?
1270 + [ ${retcode} = 0 ] && break
1271 + i=$((i+1))
1272 + sleep $retry_delay
1273 + done
1274 + fi
1275 + eend $retcode
1276 +}
1277 +
1278 +stop() {
1279 + local rc
1280 + ebegin "Stopping openl2tpd"
1281 + start-stop-daemon --stop --quiet --exec ${bin} --pidfile ${pid}
1282 + rc=$?
1283 +
1284 + if [ ${RC_CMD} = "restart" ]; then
1285 + einfo "sleepinng for server to finilize connections"
1286 + sleep 2
1287 + fi
1288 +
1289 + eend ${rc}
1290 +}
1291
1292 diff --git a/net-dialup/openl2tp/metadata.xml b/net-dialup/openl2tp/metadata.xml
1293 new file mode 100644
1294 index 00000000000..5f1b920a55a
1295 --- /dev/null
1296 +++ b/net-dialup/openl2tp/metadata.xml
1297 @@ -0,0 +1,17 @@
1298 +<?xml version="1.0" encoding="UTF-8"?>
1299 +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
1300 +<pkgmetadata>
1301 +<maintainer type="person">
1302 + <email>bircoph@g.o</email>
1303 + <name>Andrew Savchenko</name>
1304 +</maintainer>
1305 +<use>
1306 + <flag name='client'>Enable l2tp client.</flag>
1307 + <flag name='dmalloc'>Enable debugging using <pkg>dev-libs/dmalloc</pkg>.</flag>
1308 + <flag name='rpc'>Enable RPC control management. This flag is required for
1309 + l2tpconfig to be built and used.</flag>
1310 + <flag name='server'>Enable l2tp server.</flag>
1311 + <flag name='stats'>Enable status files. Note: when they are used, this
1312 + hampers performance of the daemon.</flag>
1313 +</use>
1314 +</pkgmetadata>
1315
1316 diff --git a/net-dialup/openl2tp/openl2tp-1.8.ebuild b/net-dialup/openl2tp/openl2tp-1.8.ebuild
1317 new file mode 100644
1318 index 00000000000..707cccebd5a
1319 --- /dev/null
1320 +++ b/net-dialup/openl2tp/openl2tp-1.8.ebuild
1321 @@ -0,0 +1,127 @@
1322 +# Copyright 1999-2018 Gentoo Foundation
1323 +# Distributed under the terms of the GNU General Public License v2
1324 +
1325 +EAPI=6
1326 +
1327 +inherit linux-info
1328 +
1329 +DESCRIPTION="Userspace tools for kernel L2TP implementation"
1330 +HOMEPAGE="http://www.openl2tp.org/"
1331 +SRC_URI="mirror://sourceforge/openl2tp/${P}.tar.gz"
1332 +
1333 +LICENSE="GPL-2"
1334 +SLOT="0"
1335 +KEYWORDS="~amd64 ~x86"
1336 +IUSE="+client debug dmalloc doc +examples rpc server stats"
1337 +
1338 +REQUIRED_USE="|| ( client server )"
1339 +
1340 +CDEPEND="
1341 + >=net-dialup/ppp-2.4.5
1342 + >=net-libs/libtirpc-1.0.3
1343 + sys-libs/readline:=
1344 + dmalloc? ( dev-libs/dmalloc )
1345 +"
1346 +DEPEND="${CDEPEND}
1347 + >=net-libs/rpcsvc-proto-1.3.1-r1
1348 + sys-devel/bison
1349 + sys-devel/flex
1350 +"
1351 +RDEPEND="${CDEPEND}
1352 + rpc? ( net-nds/rpcbind )
1353 +"
1354 +
1355 +CONFIG_CHECK="~PPPOL2TP"
1356 +
1357 +PATCHES=(
1358 + "${FILESDIR}/${P}-werror.patch"
1359 + "${FILESDIR}/${P}-ldflags.patch"
1360 + "${FILESDIR}/${P}-pppd-2.patch"
1361 + "${FILESDIR}/${P}-man.patch"
1362 + "${FILESDIR}/${P}-l2tpconfig.patch"
1363 + "${FILESDIR}/${P}-parallelbuild.patch"
1364 + "${FILESDIR}/${P}-optionsfile.patch"
1365 + "${FILESDIR}/${P}-clientip_as_ipparam.patch"
1366 + "${FILESDIR}/${P}-setkey.patch"
1367 + "${FILESDIR}/${P}-unused-var.patch"
1368 + "${FILESDIR}/${P}-configure-Makefile.patch"
1369 + "${FILESDIR}/${P}-cflags.patch"
1370 + "${FILESDIR}/${P}-tirpc.patch"
1371 +)
1372 +
1373 +src_prepare() {
1374 + default
1375 + sed -i 's/CFLAGS.optimize/CFLAGS_optimize/g' Makefile */Makefile || die "Makefile sed failed"
1376 +}
1377 +
1378 +src_configure() {
1379 + declare -a myconf # not local, should be used at src_compile()
1380 +
1381 + use client || myconf+=( L2TP_FEATURE_LAC_SUPPORT=n
1382 + L2TP_FEATURE_LAIC_SUPPORT=n
1383 + L2TP_FEATURE_LAOC_SUPPORT=n )
1384 +
1385 + use server || myconf+=( L2TP_FEATURE_LNS_SUPPORT=n
1386 + L2TP_FEATURE_LNIC_SUPPORT=n
1387 + L2TP_FEATURE_LNOC_SUPPORT=n )
1388 +
1389 + use rpc || myconf+=( L2TP_FEATURE_RPC_MANAGEMENT=n )
1390 +
1391 + use stats && myconf+=( L2TP_FEATURE_LOCAL_STAT_FILE=y )
1392 + use debug && myconf+=( L2TP_DEBUG=y )
1393 + use dmalloc && myconf+=( USE_DMALLOC=y )
1394 +
1395 + # pppd plugin is only needed for pppd < 2.4.5
1396 + unset PPPD_SUBDIR
1397 +}
1398 +
1399 +src_compile() {
1400 + emake ${myconf[@]}
1401 +}
1402 +
1403 +src_install() {
1404 + emake ${myconf[@]} DESTDIR="${D}" install
1405 +
1406 + if use examples; then
1407 + docinto event_socket
1408 + dodoc doc/{event_sock_example.c,README.event_sock}
1409 + docinto
1410 + dodoc -r "${FILESDIR}"/examples
1411 + fi
1412 +
1413 + if use doc; then
1414 + dodoc doc/*.txt
1415 + newdoc plugins/README README.plugins
1416 + dodoc -r ipsec
1417 + fi
1418 +
1419 + newinitd "${FILESDIR}"/openl2tpd.initd openl2tpd
1420 + # init.d script is quite different for RPC and non-RPC versions.
1421 + use rpc || sed -i s/userpc=\"yes\"/userpc=\"no\"/ "${D}/etc/init.d/openl2tpd" || die "sed failed"
1422 + newconfd "${FILESDIR}"/openl2tpd.confd openl2tpd
1423 +}
1424 +
1425 +pkg_postinst() {
1426 + if use rpc; then
1427 + ewarn
1428 + ewarn "RPC control does not provide any auth checks for control connection."
1429 + ewarn "Unless you need this you should disable it, for reference:"
1430 + ewarn "http://forums.openl2tp.org/viewtopic.php?f=4&t=41"
1431 + ewarn
1432 + ewarn "Therefore DO NOT USE RPC IN INSECURE ENVIRONMENTS!"
1433 + else
1434 + ewarn
1435 + ewarn "Without RPC support you won't be able to use l2tpconfig."
1436 + ewarn "Please read http://forums.openl2tp.org/viewtopic.php?f=4&t=41"
1437 + ewarn "for more information about the security risk before enabling."
1438 + ewarn
1439 + ewarn "If you are using numerical strings (e.g. login name containing only"
1440 + ewarn "digits) or special characters in password, please use double quotes"
1441 + ewarn "to enclose them."
1442 + fi
1443 + if use stats; then
1444 + ewarn
1445 + ewarn "To enable status files openl2tpd must be started with -S option."
1446 + ewarn "Upstream warns about runtime overhead with status files enabled."
1447 + fi
1448 +}