summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Savchenko <bircoph@gmail.com>2011-06-10 07:14:51 +0400
committerAndrew Savchenko <bircoph@gmail.com>2011-06-10 07:14:51 +0400
commit9b88d7093d3f5a2c137b1e5b2e3a2620ef74ab9c (patch)
treed4d24de8c5a54b84730c85c2a6ff0f07ecab4b93 /net-dialup/openl2tp
parentdhcp: remove old (diff)
downloadbircoph-9b88d7093d3f5a2c137b1e5b2e3a2620ef74ab9c.tar.gz
bircoph-9b88d7093d3f5a2c137b1e5b2e3a2620ef74ab9c.tar.bz2
bircoph-9b88d7093d3f5a2c137b1e5b2e3a2620ef74ab9c.zip
openl2tp: ebuild and patchset update
Use patches from Jaco Kroon to add new functionality and update ebuild based on his valuable suggestions. See bug 195461 for details.
Diffstat (limited to 'net-dialup/openl2tp')
-rw-r--r--net-dialup/openl2tp/ChangeLog12
-rw-r--r--net-dialup/openl2tp/Manifest8
-rw-r--r--net-dialup/openl2tp/files/openl2tp-1.8-clientip_as_ipparam.patch217
-rw-r--r--net-dialup/openl2tp/files/openl2tp-1.8-optionsfile.patch306
-rw-r--r--net-dialup/openl2tp/files/openl2tp-1.8-parallelbuild.patch21
-rw-r--r--net-dialup/openl2tp/files/openl2tp-1.8-pppd-2.patch12
-rw-r--r--net-dialup/openl2tp/files/openl2tp-1.8-setkey.patch12
-rw-r--r--net-dialup/openl2tp/openl2tp-1.8-r3.ebuild126
8 files changed, 713 insertions, 1 deletions
diff --git a/net-dialup/openl2tp/ChangeLog b/net-dialup/openl2tp/ChangeLog
index ec79cf6..a7b6a0e 100644
--- a/net-dialup/openl2tp/ChangeLog
+++ b/net-dialup/openl2tp/ChangeLog
@@ -2,6 +2,18 @@
# Copyright 2000-2011 Gentoo Foundation; Distributed under the GPL v2
# $Header: $
+*openl2tp-1.8-r3.ebuild (10 Jun 2011)
+
+ 10 Jun 2011; Andrew Savchenko <bircoph@gmail.com>
+ +openl2tp-1.8-r3.ebuild, +files/openl2tp-1.8-pppd-2.patch,
+ +files/openl2tp-1.8-clientip_as_ipparam.patch,
+ +files/openl2tp-1.8-optionsfile.patch,
+ +files/openl2tp-1.8-parallelbuild.patch,
+ files/openl2tp-1.8-setkey.patch:
+ Use patches from Jaco Kroon to add new functionality and update
+ ebuild based on his valuable suggestions.
+ See bug 195461 for details.
+
*openl2tp-1.8-r2.ebuild (21 Jan 2011)
21 Jan 2011; Andrew Savchenko <bircoph@gmail.com>
diff --git a/net-dialup/openl2tp/Manifest b/net-dialup/openl2tp/Manifest
index 6900ac7..5c6e940 100644
--- a/net-dialup/openl2tp/Manifest
+++ b/net-dialup/openl2tp/Manifest
@@ -1,12 +1,18 @@
+AUX openl2tp-1.8-clientip_as_ipparam.patch 8643 RMD160 1f7274a3110e941f58324fe6cbc68d70face9d45 SHA1 687d561ba6c4494d685d429a8b76f24512d28227 SHA256 ae0bd3029c921b515716c7b8087c6a586a1e58fd031d670d08890026d07bc67c
AUX openl2tp-1.8-l2tpconfig.patch 621 RMD160 ca821f3336fcc35336e2bd857ac92700d1e37c5e SHA1 e116771492724db3543e5cfb35bd88b4812aeebe SHA256 f7176518baad226d276006fa3d0c877b5ebab982266ffaef954f6d72dcf1bb8a
AUX openl2tp-1.8-ldflags.patch 2620 RMD160 c1b7c4e252f1a657e23396d1ecf75aac3b19da41 SHA1 53cb621f6488f6b96f5c2747629c23e2d43cb3aa SHA256 94f13f30bbfb79f0f656dbdc84153ba926e25c926864fbb5067ed6bda117b988
AUX openl2tp-1.8-man.patch 1345 RMD160 4103470fbaaebba1cfa232aaaf2a042b77e61e7f SHA1 4f1a05616a3f4faf4cc75ff5e2a64e4329cf1d15 SHA256 6752ee913ca7fae689408da9bc1148dd302cc5a97a18c7c0b9280d12e9f933c3
+AUX openl2tp-1.8-optionsfile.patch 10143 RMD160 f61135a8f41028e99b5179a443a3ea143f9fe768 SHA1 1a61d1d06d19f48f1c75aa58acf774c6d5f3175f SHA256 b38adc12e53663453bc82a60c1dd52677f6b5ac1ebaec27a5f132e3127db2b66
+AUX openl2tp-1.8-parallelbuild.patch 629 RMD160 7cb2c7777b4c8a25aba1000a996a3fee95b8b1bd SHA1 3abd6ae04e6e3e5e24950a4becfbdf784767e75c SHA256 2e358acab1ac32221414ae2508e7ae213af12e50ae1dcdfd8d32c07d8d12e47f
+AUX openl2tp-1.8-pppd-2.patch 485 RMD160 e1b4f4305983d61caa74c19a6bc6f8d91a6cbcd8 SHA1 079569092e1517540af7b13edb3ef1163629784e SHA256 5385e280d2c7db0b6bea1389295ae39b961f7cb202b31f54e0e12842de2d1de3
AUX openl2tp-1.8-pppd.patch 846 RMD160 8ac9afbee793d60a1682364a00e1e2d409d17fae SHA1 0031365873bc2964f0d3f8c9537a3e1e6999642d SHA256 d6f2708b79dc211591c0b2f28e308ecf17adc6fc826f6f3b7483d6a18f7f6c6c
+AUX openl2tp-1.8-setkey.patch 483 RMD160 9383c7149da0b9aaeceb3c76208d01e69fb29ff4 SHA1 2cc3a2f49b6b4d141b22d946d4f229a4e9b2c8c3 SHA256 66f7a8de192525a0eb538493465023ec4530215ef87ad0540eb644d4b1bbdc95
AUX openl2tp-1.8-werror.patch 1466 RMD160 85df32f171301bce175557ef078ae681d2b51d3d SHA1 c7e36dbe97a8c4fff199cb6a769fa7bb17f6bfc4 SHA256 5da5272f697d803c71256f298070c3a9783c1e8e43c890576a4615a407e069aa
AUX openl2tpd.conf.sample 678 RMD160 34f2e81c2e1f810041eebf6859fb661105643428 SHA1 540606a185775d86137faff790bc54b905a297e0 SHA256 8f6b6bd8150b2275e3b0886fbe38fe79dc83870fc6d6ae848bdebda42e70d4a4
AUX openl2tpd.confd 627 RMD160 c98ef7bdcca067cab855b43f4c28d7db5651dbee SHA1 ab72ca17e0f3b1d8839bc1a644c11f160529bc9d SHA256 9bea610cf2614bdd6c2f371987f98f8c9b854dd8332d33647505c895ae9a7314
AUX openl2tpd.initd 1688 RMD160 41179b0e7a1640aab545f85cd5d5dfbf2a0ff0b2 SHA1 590d8698344ea540301855a492c272d021257229 SHA256 09b5bfc7a5ade30dd7ebb4b87af09a28e3a7e9c65c09fd066c24528b1d29ba1e
DIST openl2tp-1.8.tar.gz 491160 RMD160 29913730809f7ea670c994c175551f31f2ba1e6f SHA1 314a8bb70f9f06bac840200fac0916e80d8d06b3 SHA256 1c97704d4b963a87fbc0e741668d4530933991515ae9ab0dffd11b5444f4860f
EBUILD openl2tp-1.8-r2.ebuild 4280 RMD160 37649c4b15eab28dd3aec9c193cb00c78d1a7d39 SHA1 c591aa5d86cc703b6c465c923ba1ca82633b3abf SHA256 968d9c4c620def4e0b1adf80dfc2f3b1e8f31fc2b73f125fe6fcc6a2b4fb8344
-MISC ChangeLog 2030 RMD160 d3ca1c8af016eaef64d26da5b2dc0d18cd6699b1 SHA1 112ee25eca5d3d169388d0372a648f1872d71585 SHA256 67736f50ee0260cc5566b11767f83eeabf012e49a53e26a5ca711dced67d882f
+EBUILD openl2tp-1.8-r3.ebuild 3445 RMD160 0c19c78af10b435091e24a5198a056b68ea7c7f3 SHA1 249da0f1b6b1c041ebb98e3e7ef869c492c68d84 SHA256 344fb9410952cb8a2006b86cddc9d6af6812302edd29ded355130a3cc7149b45
+MISC ChangeLog 2492 RMD160 75080c7ae5a9bea3dee2f48eb2859918ecbd2057 SHA1 8c8503a1468e1a66eaf9dcdead4c198b0ffd312b SHA256 110585da7eff36458e49e03daddc580c28faa91b5f45f536ae28410a207ceb7e
MISC metadata.xml 762 RMD160 416cd2087fe041e02046f07bb6c1677908542c37 SHA1 302dc937814f7d4c32ad16c0300020794f519c0e SHA256 e765957111816f91553fd3db2fef165babdd02ee82d923da6f5b455b684afd72
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
new file mode 100644
index 0000000..fcea3d1
--- /dev/null
+++ b/net-dialup/openl2tp/files/openl2tp-1.8-clientip_as_ipparam.patch
@@ -0,0 +1,217 @@
+diff -brau openl2tp-1.8.o/doc/openl2tp_rpc.4 openl2tp-1.8/doc/openl2tp_rpc.4
+--- openl2tp-1.8.o/doc/openl2tp_rpc.4 2011-06-04 10:02:34.000000000 +0200
++++ openl2tp-1.8/doc/openl2tp_rpc.4 2011-06-04 21:17:22.000000000 +0200
+@@ -719,6 +719,10 @@
+ .B chap_restart
+ Retransmission timeout for CHAP challenges. Default=3.
+ .TP
++.B clientip_as_ipparam
++Whether or not to pass the remote client ip (connecting IP) as ipparam to pppd
++(similar to to pptpd).
++.TP
+ .B pap_max_auth_reqs
+ Maximum number of PAP authenticate-request transmissions. Default=10.
+ .TP
+diff -brau openl2tp-1.8.o/l2tp_common.c openl2tp-1.8/l2tp_common.c
+--- openl2tp-1.8.o/l2tp_common.c 2011-06-04 21:00:45.000000000 +0200
++++ openl2tp-1.8/l2tp_common.c 2011-06-04 21:19:46.000000000 +0200
+@@ -931,6 +931,7 @@
+ if (OPTSTRING_PTR(pp->remote_name) != NULL) {
+ len += fprintf(file, " remote name for authentication: %s\n", OPTSTRING(pp->remote_name));
+ }
++ len += fprintf(file, " clientip as ipparam: %s\n", pp->clientip_as_ipparam ? "YES" : "NO");
+ len += fprintf(file, " max connect time: %d, max failure count: %d, idle timeout: %d\n",
+ pp->max_connect_time, pp->max_failure_count, pp->idle_timeout);
+ if (pp->asyncmap != 0) {
+diff -brau openl2tp-1.8.o/l2tp_config.c openl2tp-1.8/l2tp_config.c
+--- openl2tp-1.8.o/l2tp_config.c 2011-06-04 11:43:03.000000000 +0200
++++ openl2tp-1.8/l2tp_config.c 2011-06-04 21:30:48.000000000 +0200
+@@ -3124,6 +3124,7 @@
+ L2TP_PPP_ARGID_REMOTE_NAME,
+ L2TP_PPP_ARGID_PROXY_ARP,
+ L2TP_PPP_ARGID_OPTIONSFILE,
++ L2TP_PPP_ARGID_CLIENTIP_AS_IPPARAM,
+ } l2tp_ppp_arg_ids_t;
+
+ #undef ARG
+@@ -3189,7 +3190,8 @@
+ ARG(USE_AS_DEFAULT_ROUTE, "default_route", 0, bool, "Use link as default route"), \
+ ARG(MULTILINK, "multilink", 0, bool, "Enable PPP multilink connections."), \
+ ARG(PROXY_ARP, "proxy_arp", 0, bool, "Use proxy arp."), \
+- ARG(OPTIONSFILE, "optionsfile", 0, string, "ppp options file to use")
++ ARG(OPTIONSFILE, "optionsfile", 0, string, "ppp options file to use"), \
++ ARG(CLIENTIP_AS_IPPARAM, "clientip_as_ipparam", 0, bool, "Pass the connecting client's IP as ipparam to pppd.")
+
+
+ static struct cli_arg_entry l2tp_args_ppp_profile_create[] = {
+@@ -3270,6 +3272,7 @@
+ FLG(MULTILINK, "multilink", "Enable PPP multilink connections."), \
+ FLG(PROXY_ARP, "proxy_arp", "Use proxy arp."),
+ FLG(OPTIONSFILE, "optionsfile", "ppp options file to use"),
++ FLG(CLIENTIP_AS_IPPARAM, "clientip_as_ipparam", "Pass the connecting client's IP as ipparam to pppd."),
+ { NULL, },
+ };
+
+@@ -3500,6 +3503,9 @@
+ msg->optionsfile.valid = 1;
+ msg->flags2 |= L2TP_API_PPP_PROFILE_FLAG_OPTIONSFILE;
+ break;
++ case L2TP_PPP_ARGID_CLIENTIP_AS_IPPARAM:
++ L2TP_ACT_PARSE_ARG(arg, arg_value, msg->clientip_as_ipparam, msg->flags2, L2TP_API_PPP_PROFILE_FLAG_CLIENTIP_AS_IPPARAM);
++ break;
+ }
+
+ result = 0;
+@@ -3871,6 +3877,9 @@
+ case L2TP_PPP_ARGID_OPTIONSFILE:
+ msg.flags2 |= L2TP_API_PPP_PROFILE_FLAG_OPTIONSFILE;
+ break;
++ case L2TP_PPP_ARGID_CLIENTIP_AS_IPPARAM:
++ msg.flags2 |= L2TP_API_PPP_PROFILE_FLAG_CLIENTIP_AS_IPPARAM;
++ break;
+ }
+ } L2TP_ACT_END();
+
+@@ -4883,6 +4892,7 @@
+ L2TP_API_PPP_PROFILE_FLAG_REMOTE_NAME |
+ L2TP_API_PPP_PROFILE_FLAG_PROXY_ARP |
+ L2TP_API_PPP_PROFILE_FLAG_OPTIONSFILE |
++ L2TP_API_PPP_PROFILE_FLAG_CLIENTIP_AS_IPPARAM |
+ L2TP_API_PPP_PROFILE_FLAG_AUTH_NONE |
+ L2TP_API_PPP_PROFILE_FLAG_AUTH_REFUSE_EAP |
+ L2TP_API_PPP_PROFILE_FLAG_AUTH_REFUSE_MSCHAPV2 |
+@@ -5047,6 +5057,9 @@
+ if ((cfg->flags2 & L2TP_API_PPP_PROFILE_FLAG_OPTIONSFILE) && (OPTSTRING_PTR(cfg->optionsfile) != NULL)) {
+ fprintf(file, "\toptionsfile=%s \\\n", OPTSTRING_PTR(cfg->optionsfile));
+ }
++ if (cfg->flags2 & L2TP_API_PPP_PROFILE_FLAG_CLIENTIP_AS_IPPARAM) {
++ fprintf(file, "\tclientip_as_ipparam=%s \\\n", Y_OR_N(cfg->clientip_as_ipparam));
++ }
+ fprintf(file, "\n");
+ }
+ }
+diff -brau openl2tp-1.8.o/l2tp_config_parse.y openl2tp-1.8/l2tp_config_parse.y
+--- openl2tp-1.8.o/l2tp_config_parse.y 2011-06-04 11:11:42.000000000 +0200
++++ openl2tp-1.8/l2tp_config_parse.y 2011-06-04 21:34:04.000000000 +0200
+@@ -155,6 +155,7 @@
+ %token BOOL
+ %token IPADDRESS
+ %token OPTIONSFILE
++%token CLIENTIP_AS_IPPARAM
+
+ %token INITIAL_RCVD_LCP_CONFREQ
+ %token CALLING_NUMBER
+@@ -1180,6 +1181,11 @@
+ OPTSTRING(ppp_profile.optionsfile) = $3.buf;
+ ppp_profile.optionsfile.valid = 1;
+ }
++ | CLIENTIP_AS_IPPARAM EQUALS BOOL
++ {
++ ppp_profile.flags2 |= L2TP_API_PPP_PROFILE_FLAG_CLIENTIP_AS_IPPARAM;
++ ppp_profile.clientip_as_ipparam = $3;
++ }
+ ;
+
+ tunnel_command
+diff -brau openl2tp-1.8.o/l2tp_config_token.l openl2tp-1.8/l2tp_config_token.l
+--- openl2tp-1.8.o/l2tp_config_token.l 2011-06-04 11:08:31.000000000 +0200
++++ openl2tp-1.8/l2tp_config_token.l 2011-06-04 21:34:50.000000000 +0200
+@@ -192,6 +192,7 @@
+ auth_none { return(AUTH_NOAUTH); }
+ auth_peer { return(AUTH_PEER); }
+ optionsfile { return(OPTIONSFILE); }
++clientip_as_ipparam { return(CLIENTIP_AS_IPPARAM); }
+
+ {ws} { }
+ {linecont} { lineno++; }
+diff -brau openl2tp-1.8.o/l2tp_ppp.c openl2tp-1.8/l2tp_ppp.c
+--- openl2tp-1.8.o/l2tp_ppp.c 2011-06-04 16:08:25.000000000 +0200
++++ openl2tp-1.8/l2tp_ppp.c 2011-06-04 21:42:37.000000000 +0200
+@@ -71,6 +71,7 @@
+ int auth_refuse_mschapv2:1;
+ int auth_refuse_eap:1;
+ char *optionsfile;
++ int clientip_as_ipparam;
+ };
+
+ static struct l2tp_ppp_profile *l2tp_ppp_defaults;
+@@ -245,6 +246,9 @@
+ if (msg->flags2 & L2TP_API_PPP_PROFILE_FLAG_OPTIONSFILE) {
+ L2TP_SET_OPTSTRING_VAR(profile, optionsfile);
+ }
++ if (msg->flags2 & L2TP_API_PPP_PROFILE_FLAG_CLIENTIP_AS_IPPARAM) {
++ profile->clientip_as_ipparam = msg->clientip_as_ipparam;
++ }
+
+ out:
+ return result;
+@@ -294,6 +298,7 @@
+ profile->chap_interval = l2tp_ppp_defaults->chap_interval;
+ profile->chap_max_challenge = l2tp_ppp_defaults->chap_max_challenge;
+ profile->chap_restart = l2tp_ppp_defaults->chap_restart;
++ profile->clientip_as_ipparam = l2tp_ppp_defaults->clientip_as_ipparam;
+ profile->pap_max_auth_requests = l2tp_ppp_defaults->pap_max_auth_requests;
+ profile->pap_restart_interval = l2tp_ppp_defaults->pap_restart_interval;
+ profile->pap_timeout = l2tp_ppp_defaults->pap_timeout;
+@@ -553,6 +558,7 @@
+ result->chap_interval = profile->chap_interval;
+ result->chap_max_challenge = profile->chap_max_challenge;
+ result->chap_restart = profile->chap_restart;
++ result->clientip_as_ipparam = profile->clientip_as_ipparam;
+ result->pap_max_auth_requests = profile->pap_max_auth_requests;
+ result->pap_restart_interval = profile->pap_restart_interval;
+ result->pap_timeout = profile->pap_timeout;
+@@ -893,6 +899,9 @@
+ }
+ profile->optionsfile = NULL;
+ }
++ if (msg.flags2 & L2TP_API_PPP_PROFILE_FLAG_CLIENTIP_AS_IPPARAM) {
++ profile->use_radius = L2TP_API_PPP_PROFILE_DEFAULT_CLIENTIP_AS_IPPARAM;
++ }
+
+ /* Clear all requested flags */
+ profile->flags &= ~(msg.flags);
+diff -brau openl2tp-1.8.o/l2tp_rpc.x openl2tp-1.8/l2tp_rpc.x
+--- openl2tp-1.8.o/l2tp_rpc.x 2011-06-04 11:06:08.000000000 +0200
++++ openl2tp-1.8/l2tp_rpc.x 2011-06-04 21:45:00.000000000 +0200
+@@ -947,6 +947,7 @@
+ const L2TP_API_PPP_PROFILE_FLAG_AUTH_REFUSE_PAP = 131072;
+ const L2TP_API_PPP_PROFILE_FLAG_AUTH_PEER = 262144;
+ const L2TP_API_PPP_PROFILE_FLAG_OPTIONSFILE = 524288;
++const L2TP_API_PPP_PROFILE_FLAG_CLIENTIP_AS_IPPARAM = 1048576;
+
+ /* Default values for PPP profile attributes.
+ * These are used if an explicit value is not provided by the user.
+@@ -995,6 +996,7 @@
+ const L2TP_API_PPP_PROFILE_DEFAULT_MULTILINK = 0;
+ const L2TP_API_PPP_PROFILE_DEFAULT_PROXY_ARP = 0;
+ const L2TP_API_PPP_PROFILE_DEFAULT_OPTIONSFILE = "";
++const L2TP_API_PPP_PROFILE_DEFAULT_CLIENTIP_AS_IPPARAM = 0;
+
+ enum l2tp_api_ppp_sync_mode {
+ L2TP_API_PPP_SYNCMODE_SYNC_ASYNC,
+@@ -1054,6 +1056,7 @@
+ optstring remote_name;
+ bool proxy_arp;
+ optstring optionsfile;
++ bool clientip_as_ipparam;
+ };
+
+ struct l2tp_api_ppp_profile_list_entry {
+diff -brau openl2tp-1.8.o/plugins/ppp_unix.c openl2tp-1.8/plugins/ppp_unix.c
+--- openl2tp-1.8.o/plugins/ppp_unix.c 2011-06-04 14:41:43.000000000 +0200
++++ openl2tp-1.8/plugins/ppp_unix.c 2011-06-04 22:11:54.000000000 +0200
+@@ -295,6 +295,13 @@
+ argv[arg++] = "sync";
+ }
+
++ /* Check if we should pass ipparam */
++ if (params->flags2 & L2TP_API_PPP_PROFILE_FLAG_CLIENTIP_AS_IPPARAM) {
++ argv[arg++] = "ipparam";
++ ip.s_addr = l2tp_tunnel_get_peer_addr(ppp->tunnel)->sin_addr.s_addr;
++ argv[arg++] = strdup(inet_ntoa(ip));
++ }
++
+ /* ppp auth options */
+ if ((params->flags2 & L2TP_API_PPP_PROFILE_FLAG_AUTH_REFUSE_EAP) &&
+ params->auth_refuse_eap) {
diff --git a/net-dialup/openl2tp/files/openl2tp-1.8-optionsfile.patch b/net-dialup/openl2tp/files/openl2tp-1.8-optionsfile.patch
new file mode 100644
index 0000000..45c209f
--- /dev/null
+++ b/net-dialup/openl2tp/files/openl2tp-1.8-optionsfile.patch
@@ -0,0 +1,306 @@
+diff -brau openl2tp-1.8.o/doc/openl2tp_rpc.4 openl2tp-1.8/doc/openl2tp_rpc.4
+--- openl2tp-1.8.o/doc/openl2tp_rpc.4 2010-11-09 16:50:58.000000000 +0200
++++ openl2tp-1.8/doc/openl2tp_rpc.4 2011-06-04 10:02:34.000000000 +0200
+@@ -774,6 +774,10 @@
+ .B local_ip_addr
+ The IP address to assign to the local end of the PPP link.
+ .TP
++.B optionsfile
++Passes a file parameter to the pppd daemon, allowing for loading a custom
++options file. See pppd(8) for more details.
++.TP
+ .B peer_ip_addr
+ The IP address to assign to the remote (peer) end of the PPP link.
+ .TP
+diff -brau openl2tp-1.8.o/l2tp_common.c openl2tp-1.8/l2tp_common.c
+--- openl2tp-1.8.o/l2tp_common.c 2008-01-08 19:23:51.000000000 +0200
++++ openl2tp-1.8/l2tp_common.c 2011-06-04 21:00:45.000000000 +0200
+@@ -938,6 +938,10 @@
+ }
+ len += fprintf(file, " multilink: %s, proxy arp: %s\n",
+ pp->multilink ? "YES" : "NO", pp->proxy_arp ? "YES" : "NO");
++ if (OPTSTRING_PTR(pp->optionsfile) != NULL) {
++ len += fprintf(file, " optionsfile: %s\n", OPTSTRING(pp->optionsfile));
++ }
++
+ len += fprintf(file, " IP parameters:-\n");
+ ip_to_string(&local_ip[0], pp->local_ip_addr.s_addr);
+ ip_to_string(&peer_ip[0], pp->peer_ip_addr.s_addr);
+diff -brau openl2tp-1.8.o/l2tp_config.c openl2tp-1.8/l2tp_config.c
+--- openl2tp-1.8.o/l2tp_config.c 2010-01-18 12:35:14.000000000 +0200
++++ openl2tp-1.8/l2tp_config.c 2011-06-04 11:43:03.000000000 +0200
+@@ -3123,6 +3123,7 @@
+ L2TP_PPP_ARGID_LOCAL_NAME,
+ L2TP_PPP_ARGID_REMOTE_NAME,
+ L2TP_PPP_ARGID_PROXY_ARP,
++ L2TP_PPP_ARGID_OPTIONSFILE,
+ } l2tp_ppp_arg_ids_t;
+
+ #undef ARG
+@@ -3187,7 +3188,8 @@
+ ARG(REMOTE_NAME, "remote_name", 0, string, "Name to assume for the remote peer for authentication purposes"), \
+ ARG(USE_AS_DEFAULT_ROUTE, "default_route", 0, bool, "Use link as default route"), \
+ ARG(MULTILINK, "multilink", 0, bool, "Enable PPP multilink connections."), \
+- ARG(PROXY_ARP, "proxy_arp", 0, bool, "Use proxy arp.")
++ ARG(PROXY_ARP, "proxy_arp", 0, bool, "Use proxy arp."), \
++ ARG(OPTIONSFILE, "optionsfile", 0, string, "ppp options file to use")
+
+
+ static struct cli_arg_entry l2tp_args_ppp_profile_create[] = {
+@@ -3267,6 +3269,7 @@
+ FLG(USE_AS_DEFAULT_ROUTE, "default_route", "Use link as default route"), \
+ FLG(MULTILINK, "multilink", "Enable PPP multilink connections."), \
+ FLG(PROXY_ARP, "proxy_arp", "Use proxy arp."),
++ FLG(OPTIONSFILE, "optionsfile", "ppp options file to use"),
+ { NULL, },
+ };
+
+@@ -3488,6 +3491,15 @@
+ msg->remote_name.valid = 1;
+ msg->flags2 |= L2TP_API_PPP_PROFILE_FLAG_REMOTE_NAME;
+ break;
++ case L2TP_PPP_ARGID_OPTIONSFILE:
++ OPTSTRING(msg->optionsfile) = strdup(arg_value);
++ if (OPTSTRING(msg->optionsfile) == NULL) {
++ result = -ENOMEM;
++ goto out;
++ }
++ msg->optionsfile.valid = 1;
++ msg->flags2 |= L2TP_API_PPP_PROFILE_FLAG_OPTIONSFILE;
++ break;
+ }
+
+ result = 0;
+@@ -3856,6 +3868,9 @@
+ case L2TP_PPP_ARGID_REMOTE_NAME:
+ msg.flags2 |= L2TP_API_PPP_PROFILE_FLAG_REMOTE_NAME;
+ break;
++ case L2TP_PPP_ARGID_OPTIONSFILE:
++ msg.flags2 |= L2TP_API_PPP_PROFILE_FLAG_OPTIONSFILE;
++ break;
+ }
+ } L2TP_ACT_END();
+
+@@ -4867,6 +4882,7 @@
+ L2TP_API_PPP_PROFILE_FLAG_LOCAL_NAME |
+ L2TP_API_PPP_PROFILE_FLAG_REMOTE_NAME |
+ L2TP_API_PPP_PROFILE_FLAG_PROXY_ARP |
++ L2TP_API_PPP_PROFILE_FLAG_OPTIONSFILE |
+ L2TP_API_PPP_PROFILE_FLAG_AUTH_NONE |
+ L2TP_API_PPP_PROFILE_FLAG_AUTH_REFUSE_EAP |
+ L2TP_API_PPP_PROFILE_FLAG_AUTH_REFUSE_MSCHAPV2 |
+@@ -5028,6 +5044,9 @@
+ if (cfg->flags2 & L2TP_API_PPP_PROFILE_FLAG_PROXY_ARP) {
+ fprintf(file, "\tproxy_arp=%s \\\n", Y_OR_N(cfg->proxy_arp));
+ }
++ if ((cfg->flags2 & L2TP_API_PPP_PROFILE_FLAG_OPTIONSFILE) && (OPTSTRING_PTR(cfg->optionsfile) != NULL)) {
++ fprintf(file, "\toptionsfile=%s \\\n", OPTSTRING_PTR(cfg->optionsfile));
++ }
+ fprintf(file, "\n");
+ }
+ }
+diff -brau openl2tp-1.8.o/l2tp_config_parse.y openl2tp-1.8/l2tp_config_parse.y
+--- openl2tp-1.8.o/l2tp_config_parse.y 2010-11-09 16:50:58.000000000 +0200
++++ openl2tp-1.8/l2tp_config_parse.y 2011-06-04 11:11:42.000000000 +0200
+@@ -154,6 +154,7 @@
+ %token QUOTEDSTRING
+ %token BOOL
+ %token IPADDRESS
++%token OPTIONSFILE
+
+ %token INITIAL_RCVD_LCP_CONFREQ
+ %token CALLING_NUMBER
+@@ -1167,6 +1168,18 @@
+ OPTSTRING(ppp_profile.remote_name) = $3.buf;
+ ppp_profile.remote_name.valid = 1;
+ }
++ | OPTIONSFILE EQUALS STRING
++ {
++ ppp_profile.flags2 |= L2TP_API_PPP_PROFILE_FLAG_OPTIONSFILE;
++ OPTSTRING(ppp_profile.optionsfile) = $3.buf;
++ ppp_profile.optionsfile.valid = 1;
++ }
++ | OPTIONSFILE EQUALS QUOTEDSTRING
++ {
++ ppp_profile.flags2 |= L2TP_API_PPP_PROFILE_FLAG_OPTIONSFILE;
++ OPTSTRING(ppp_profile.optionsfile) = $3.buf;
++ ppp_profile.optionsfile.valid = 1;
++ }
+ ;
+
+ tunnel_command
+diff -brau openl2tp-1.8.o/l2tp_config_token.l openl2tp-1.8/l2tp_config_token.l
+--- openl2tp-1.8.o/l2tp_config_token.l 2010-11-12 14:31:21.000000000 +0200
++++ openl2tp-1.8/l2tp_config_token.l 2011-06-04 11:08:31.000000000 +0200
+@@ -191,6 +191,7 @@
+ auth_eap { return(AUTH_EAP); }
+ auth_none { return(AUTH_NOAUTH); }
+ auth_peer { return(AUTH_PEER); }
++optionsfile { return(OPTIONSFILE); }
+
+ {ws} { }
+ {linecont} { lineno++; }
+diff -brau openl2tp-1.8.o/l2tp_ppp.c openl2tp-1.8/l2tp_ppp.c
+--- openl2tp-1.8.o/l2tp_ppp.c 2008-05-07 22:44:20.000000000 +0200
++++ openl2tp-1.8/l2tp_ppp.c 2011-06-04 16:08:25.000000000 +0200
+@@ -70,6 +70,7 @@
+ int auth_refuse_mschap:1;
+ int auth_refuse_mschapv2:1;
+ int auth_refuse_eap:1;
++ char *optionsfile;
+ };
+
+ static struct l2tp_ppp_profile *l2tp_ppp_defaults;
+@@ -241,6 +242,9 @@
+ if (msg->flags2 & L2TP_API_PPP_PROFILE_FLAG_REMOTE_NAME) {
+ L2TP_SET_OPTSTRING_VAR(profile, remote_name);
+ }
++ if (msg->flags2 & L2TP_API_PPP_PROFILE_FLAG_OPTIONSFILE) {
++ L2TP_SET_OPTSTRING_VAR(profile, optionsfile);
++ }
+
+ out:
+ return result;
+@@ -346,6 +350,14 @@
+ }
+ }
+
++ if (l2tp_ppp_defaults->optionsfile != NULL) {
++ profile->optionsfile = strdup(l2tp_ppp_defaults->optionsfile);
++ if (profile->optionsfile == NULL) {
++ *result = -ENOMEM;
++ goto err;
++ }
++ }
++
+ /* Override defaults by user-supplied params */
+ *result = l2tp_ppp_profile_modify(&msg, profile);
+
+@@ -379,6 +391,24 @@
+ *result = -ENOMEM;
+ goto out;
+ err:
++ if (profile->radius_hint != NULL) {
++ free(profile->radius_hint);
++ }
++ if (profile->ip_pool_name != NULL) {
++ free(profile->ip_pool_name);
++ }
++ if (profile->profile_name != NULL) {
++ free(profile->profile_name);
++ }
++ if (profile->local_name != NULL) {
++ free(profile->local_name);
++ }
++ if (profile->remote_name != NULL) {
++ free(profile->remote_name);
++ }
++ if (profile->optionsfile != NULL) {
++ free(profile->optionsfile);
++ }
+ free(profile);
+ goto out;
+ }
+@@ -430,6 +460,9 @@
+ if (profile->remote_name != NULL) {
+ free(profile->remote_name);
+ }
++ if (profile->optionsfile != NULL) {
++ free(profile->optionsfile);
++ }
+ USL_POISON_MEMORY(profile, 0xe5, sizeof(*profile));
+ free(profile);
+ *result = 0;
+@@ -578,6 +611,14 @@
+ }
+ result->remote_name.valid = 1;
+ }
++ if (profile->optionsfile != NULL) {
++ OPTSTRING(result->optionsfile) = strdup(profile->optionsfile);
++ if (OPTSTRING(result->optionsfile) == NULL) {
++ result->result_code = -ENOMEM;
++ goto out;
++ }
++ result->optionsfile.valid = 1;
++ }
+
+ out:
+ L2TP_DEBUG(L2TP_API, "%s: flags=%x/%x result=%d", __func__, result->flags, result->flags2, result->result_code);
+@@ -598,6 +639,9 @@
+ if (OPTSTRING_PTR(msg->remote_name) != NULL) {
+ free(OPTSTRING(msg->remote_name));
+ }
++ if (OPTSTRING_PTR(msg->optionsfile) != NULL) {
++ free(OPTSTRING(msg->optionsfile));
++ }
+ if (msg->profile_name != NULL) {
+ free(msg->profile_name);
+ }
+@@ -843,6 +887,12 @@
+ }
+ profile->remote_name = NULL;
+ }
++ if (msg.flags2 & L2TP_API_PPP_PROFILE_FLAG_OPTIONSFILE) {
++ if (profile->optionsfile != NULL) {
++ free(profile->optionsfile);
++ }
++ profile->optionsfile = NULL;
++ }
+
+ /* Clear all requested flags */
+ profile->flags &= ~(msg.flags);
+@@ -937,6 +987,12 @@
+ }
+ l2tp_ppp_defaults->local_name = NULL;
+ l2tp_ppp_defaults->remote_name = NULL;
++ if (strlen(L2TP_API_PPP_PROFILE_DEFAULT_OPTIONSFILE) > 0) {
++ l2tp_ppp_defaults->optionsfile = strdup(L2TP_API_PPP_PROFILE_DEFAULT_OPTIONSFILE);
++ if (l2tp_ppp_defaults->optionsfile == NULL) {
++ goto nomem;
++ }
++ }
+
+ USL_LIST_HEAD_INIT(&l2tp_ppp_defaults->list);
+ usl_list_add(&l2tp_ppp_defaults->list, &l2tp_ppp_profile_list);
+diff -brau openl2tp-1.8.o/l2tp_rpc.x openl2tp-1.8/l2tp_rpc.x
+--- openl2tp-1.8.o/l2tp_rpc.x 2010-11-04 18:30:36.000000000 +0200
++++ openl2tp-1.8/l2tp_rpc.x 2011-06-04 11:06:08.000000000 +0200
+@@ -946,6 +946,7 @@
+ const L2TP_API_PPP_PROFILE_FLAG_AUTH_REFUSE_CHAP = 65536;
+ const L2TP_API_PPP_PROFILE_FLAG_AUTH_REFUSE_PAP = 131072;
+ const L2TP_API_PPP_PROFILE_FLAG_AUTH_PEER = 262144;
++const L2TP_API_PPP_PROFILE_FLAG_OPTIONSFILE = 524288;
+
+ /* Default values for PPP profile attributes.
+ * These are used if an explicit value is not provided by the user.
+@@ -993,6 +994,7 @@
+ const L2TP_API_PPP_PROFILE_DEFAULT_USE_AS_DEFAULT_ROUTE = 0;
+ const L2TP_API_PPP_PROFILE_DEFAULT_MULTILINK = 0;
+ const L2TP_API_PPP_PROFILE_DEFAULT_PROXY_ARP = 0;
++const L2TP_API_PPP_PROFILE_DEFAULT_OPTIONSFILE = "";
+
+ enum l2tp_api_ppp_sync_mode {
+ L2TP_API_PPP_SYNCMODE_SYNC_ASYNC,
+@@ -1051,6 +1053,7 @@
+ optstring local_name;
+ optstring remote_name;
+ bool proxy_arp;
++ optstring optionsfile;
+ };
+
+ struct l2tp_api_ppp_profile_list_entry {
+diff -brau openl2tp-1.8.o/plugins/ppp_unix.c openl2tp-1.8/plugins/ppp_unix.c
+--- openl2tp-1.8.o/plugins/ppp_unix.c 2010-11-22 16:03:48.000000000 +0200
++++ openl2tp-1.8/plugins/ppp_unix.c 2011-06-04 14:41:43.000000000 +0200
+@@ -282,6 +282,11 @@
+ }
+ }
+
++ if ((params->flags2 & L2TP_API_PPP_PROFILE_FLAG_OPTIONSFILE) && (OPTSTRING_PTR(params->optionsfile) != NULL)) {
++ argv[arg++] = "file";
++ argv[arg++] = strdup(OPTSTRING(params->optionsfile));
++ }
++
+ /* By default, use sync mode */
+ if (!((params->flags & L2TP_API_PPP_PROFILE_FLAG_SYNC_MODE) &&
+ (params->sync_mode == L2TP_API_PPP_SYNCMODE_ASYNC))) {
diff --git a/net-dialup/openl2tp/files/openl2tp-1.8-parallelbuild.patch b/net-dialup/openl2tp/files/openl2tp-1.8-parallelbuild.patch
new file mode 100644
index 0000000..994a485
--- /dev/null
+++ b/net-dialup/openl2tp/files/openl2tp-1.8-parallelbuild.patch
@@ -0,0 +1,21 @@
+diff -rau openl2tp-1.8.o/Makefile openl2tp-1.8/Makefile
+--- openl2tp-1.8.o/Makefile 2011-06-03 18:21:09.000000000 +0200
++++ openl2tp-1.8/Makefile 2011-06-03 18:54:43.000000000 +0200
+@@ -197,7 +197,7 @@
+
+ .PHONY: $(SUBDIRS:%=subdir-%)
+
+-$(SUBDIRS:%=subdir-%): FORCE
++$(SUBDIRS:%=subdir-%): FORCE generated-files
+ $(MAKE) -C $(@:subdir-%=%) $(MFLAGS) EXTRA_CFLAGS="$(CPPFLAGS)"
+
+ ifeq ($(L2TP_FEATURE_LOCAL_CONF_FILE),y)
+@@ -271,7 +271,7 @@
+ l2tpconfig: $(L2TPCONFIG_SRCS.o)
+ $(CC) $(LDFLAGS) -o $@ $^ $(LDFLAGS.l2tpconfig)
+
+-%.o: %.c
++%.o: %.c generated-files
+ $(CC) -c $(CFLAGS) $< -o $@
+
+ l2tp_options.h: FORCE
diff --git a/net-dialup/openl2tp/files/openl2tp-1.8-pppd-2.patch b/net-dialup/openl2tp/files/openl2tp-1.8-pppd-2.patch
new file mode 100644
index 0000000..5d32656
--- /dev/null
+++ b/net-dialup/openl2tp/files/openl2tp-1.8-pppd-2.patch
@@ -0,0 +1,12 @@
+diff -Nrau openl2tp-1.8.o/Makefile openl2tp-1.8/Makefile
+--- openl2tp-1.8.o/Makefile 2011-06-03 17:45:24.000000000 +0200
++++ openl2tp-1.8/Makefile 2011-06-03 17:52:22.000000000 +0200
+@@ -55,7 +55,7 @@
+ # in the pppd subdirectory of the compiler's default search path
+ # (e.g. /usr/include/pppd). but can be pointed to another directory if
+ # desired.
+-PPPD_VERSION= 2.4.5
++#PPPD_VERSION= 2.4.5
+ # PPPD_INCDIR= /usr/include/pppd
+ # PPPD_LIBDIR= $(SYS_LIBDIR)/pppd/$(PPPD_VERSION)
+
diff --git a/net-dialup/openl2tp/files/openl2tp-1.8-setkey.patch b/net-dialup/openl2tp/files/openl2tp-1.8-setkey.patch
new file mode 100644
index 0000000..d7b9e06
--- /dev/null
+++ b/net-dialup/openl2tp/files/openl2tp-1.8-setkey.patch
@@ -0,0 +1,12 @@
+diff -brau openl2tp-1.8.o/plugins/ipsec.c openl2tp-1.8/plugins/ipsec.c
+--- openl2tp-1.8.o/plugins/ipsec.c 2010-01-18 11:00:08.000000000 +0200
++++ openl2tp-1.8/plugins/ipsec.c 2011-06-05 11:00:28.000000000 +0200
+@@ -31,7 +31,7 @@
+ #include "usl.h"
+ #include "l2tp_private.h"
+
+-#define IPSEC_SETKEY_CMD "/sbin/setkey"
++#define IPSEC_SETKEY_CMD "/usr/sbin/setkey"
+ #define IPSEC_SETKEY_FILE "/tmp/openl2tpd-tmp"
+ #define IPSEC_SETKEY_ACTION IPSEC_SETKEY_CMD " -f " IPSEC_SETKEY_FILE
+
diff --git a/net-dialup/openl2tp/openl2tp-1.8-r3.ebuild b/net-dialup/openl2tp/openl2tp-1.8-r3.ebuild
new file mode 100644
index 0000000..beac3f3
--- /dev/null
+++ b/net-dialup/openl2tp/openl2tp-1.8-r3.ebuild
@@ -0,0 +1,126 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=4
+
+inherit base eutils linux-info
+
+DESCRIPTION="Userspace tools for kernel L2TP implementation."
+HOMEPAGE="http://openl2tp.sourceforge.net"
+SRC_URI="mirror://sourceforge/openl2tp/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="+client doc +examples pppd rpc server -stats"
+
+REQUIRED_USE="|| ( client server )"
+
+CDEPEND="net-dialup/ppp
+ sys-libs/readline
+ "
+DEPEND="${CDEPEND}
+ sys-devel/bison
+ sys-devel/flex
+ "
+RDEPEND="${CDEPEND}
+ rpc? ( || (
+ net-nds/rpcbind
+ net-nds/portmap
+ ) )"
+
+CONFIG_CHECK="~PPPOL2TP"
+
+PATCHES=(
+ "${FILESDIR}/${P}-werror.patch"
+ "${FILESDIR}/${P}-ldflags.patch"
+ "${FILESDIR}/${P}-pppd-2.patch"
+ "${FILESDIR}/${P}-man.patch"
+ "${FILESDIR}/${P}-l2tpconfig.patch"
+ "${FILESDIR}/${P}-parallelbuild.patch"
+ "${FILESDIR}/${P}-optionsfile.patch"
+ "${FILESDIR}/${P}-clientip_as_ipparam.patch"
+ "${FILESDIR}/${P}-setkey.patch"
+)
+
+src_configure() {
+ myconf="" # not local, should be used at src_compile()
+
+ use client || myconf+="L2TP_FEATURE_LAC_SUPPORT=n \
+ L2TP_FEATURE_LAIC_SUPPORT=n \
+ L2TP_FEATURE_LAOC_SUPPORT=n "
+
+ use server || myconf+="L2TP_FEATURE_LNS_SUPPORT=n \
+ L2TP_FEATURE_LNIC_SUPPORT=n \
+ L2TP_FEATURE_LNOC_SUPPORT=n "
+
+ use rpc || myconf+="L2TP_FEATURE_RPC_MANAGEMENT=n "
+
+ use stats && myconf+="L2TP_FEATURE_LOCAL_STAT_FILE=y "
+
+ # pppd plugin is only needed for pppd < 2.4.5
+ unset PPPD_SUBDIR
+ if use pppd; then
+ export PPPD_VERSION=$( gawk '{
+ if ($2=="VERSION") {
+ gsub("\"","",$3);
+ print $3
+ }
+ }' /usr/include/pppd/patchlevel.h ) || die "gawk failed"
+ einfo "Building for pppd version $PPPD_VERSION"
+ fi
+}
+
+src_compile() {
+ # upstream use OPT_CFLAGS for optimizations
+ export OPT_CFLAGS=${CFLAGS}
+ emake ${myconf} || die "emake failed"
+}
+
+src_install() {
+ emake ${myconf} DESTDIR="${D}" install || die "emake install failed"
+ dodoc CHANGES INSTALL README
+
+ if use examples; then
+ dodoc doc/*.c
+ fi
+
+ if use doc; then
+ dodoc doc/*.txt doc/README.event_sock "${FILESDIR}"/openl2tpd.conf.sample
+ newdoc plugins/README README.plugins
+ use pppd && newdoc pppd/README README.pppd
+ docinto ipsec
+ dodoc ipsec/*
+ fi
+
+ newinitd "${FILESDIR}"/openl2tpd.initd openl2tpd
+ # init.d script is quite different for RPC and non-RPC versions.
+ use rpc || sed -i s/userpc=\"yes\"/userpc=\"no\"/ "${D}/etc/init.d/openl2tpd" || die "sed failed"
+ newconfd "${FILESDIR}"/openl2tpd.confd openl2tpd
+}
+
+pkg_postinst() {
+ if use rpc; then
+ ewarn
+ ewarn "RPC control does not provide any auth checks for control connection."
+ ewarn "Unless you need this you should disable it, for reference:"
+ ewarn "http://forums.openl2tp.org/viewtopic.php?f=4&t=41"
+ ewarn
+ ewarn "Therefore DO NOT USE RPC IN INSECURE ENVIRONMENTS!"
+ else
+ ewarn
+ ewarn "Without RPC support you won't be able to use l2tpconfig."
+ ewarn "Please read http://forums.openl2tp.org/viewtopic.php?f=4&t=41"
+ ewarn "for more information about the security risk before enabling."
+ ewarn
+ ewarn "If you are using numerical strings (e.g. login name containing only"
+ ewarn "digits) or special characters in password, please use double quotes"
+ ewarn "to enclose them."
+ fi
+ if use stats; then
+ ewarn
+ ewarn "To enable status files openl2tpd must be started with -S option."
+ ewarn "Upstream warns about runtime overhead with status files enabled."
+ fi
+}