summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorKanogin Alex2016-01-17 18:46:34 +0300
committerKanogin Alex2016-01-17 18:46:34 +0300
commit16e6e97b7f695931da39bf259b6f5946a21b9d04 (patch)
treef501e8b0ff85f19b27a7d4578b707bceebb83db2
downloadaur-16e6e97b7f695931da39bf259b6f5946a21b9d04.tar.gz
Initial commit
-rw-r--r--.SRCINFO77
-rw-r--r--PKGBUILD103
-rw-r--r--chap-secrets4
-rw-r--r--example-client.openl2tpd.conf30
-rw-r--r--example-server-radius.openl2tpd.conf28
-rw-r--r--example-server.openl2tpd.conf36
-rw-r--r--example-server.options.openl2tpd23
-rw-r--r--gcc-4.6.patch32
-rw-r--r--gentoo-openl2tp-1.8-clientip_as_ipparam.patch217
-rw-r--r--gentoo-openl2tp-1.8-l2tpconfig.patch15
-rw-r--r--gentoo-openl2tp-1.8-ldflags.patch73
-rw-r--r--gentoo-openl2tp-1.8-man.patch40
-rw-r--r--gentoo-openl2tp-1.8-optionsfile.patch306
-rw-r--r--gentoo-openl2tp-1.8-parallelbuild.patch21
-rw-r--r--gentoo-openl2tp-1.8-pppd-2.patch12
-rw-r--r--gentoo-openl2tp-1.8-setkey.patch12
-rw-r--r--gentoo-openl2tp-1.8-werror.patch36
-rw-r--r--openl2tp.service14
-rw-r--r--openl2tpd-conf.d17
-rw-r--r--openl2tpd.conf32
20 files changed, 1128 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 00000000000..2b2ae118caa
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,77 @@
+# Generated by mksrcinfo v8
+# Sun Jan 17 15:21:00 UTC 2016
+pkgbase = openl2tp
+ pkgdesc = L2TP client / server, written by Katalix Systems specifically for Linux
+ pkgver = 1.8
+ pkgrel = 5
+ url = http://opensource.katalix.com/openl2tp
+ arch = i686
+ arch = x86_64
+ license = GPL
+ makedepends = linux-headers
+ depends = rpcbind
+ depends = ppp
+ options = !emptydirs
+ backup = etc/conf.d/openl2tpd
+ backup = etc/ppp/chap-secrets
+ backup = etc/openl2tpd.conf
+ source = http://downloads.sourceforge.net/openl2tp/openl2tp-1.8.tar.gz
+ source = gcc-4.6.patch
+ source = openl2tp.service
+ source = openl2tpd-conf.d
+ source = openl2tpd.conf
+ source = chap-secrets
+ source = example-client.openl2tpd.conf
+ source = example-server.openl2tpd.conf
+ source = example-server.options.openl2tpd
+ source = example-server-radius.openl2tpd.conf
+ source = gentoo-openl2tp-1.8-clientip_as_ipparam.patch
+ source = gentoo-openl2tp-1.8-l2tpconfig.patch
+ source = gentoo-openl2tp-1.8-ldflags.patch
+ source = gentoo-openl2tp-1.8-man.patch
+ source = gentoo-openl2tp-1.8-optionsfile.patch
+ source = gentoo-openl2tp-1.8-parallelbuild.patch
+ source = gentoo-openl2tp-1.8-pppd-2.patch
+ source = gentoo-openl2tp-1.8-setkey.patch
+ source = gentoo-openl2tp-1.8-werror.patch
+ md5sums = e3d08dedfb9e6a9a1e24f6766f6dadd0
+ md5sums = 63e674724d0ae4265b86e776827969e1
+ md5sums = bc2d1231a2f1ba2eb05b366b12902edf
+ md5sums = 38e0f4201f830bd59dabf38dbab6362a
+ md5sums = 456f1b54f7fb5ec252f1b6e3afdb8bdb
+ md5sums = adac6f133fc0179eee15f824b3a98922
+ md5sums = dc3a2575cc50804a511d59367599b6e4
+ md5sums = 78e4804574ca808a2d76b1febe8eed08
+ md5sums = 4e555341660d3d0339e841496cb3a523
+ md5sums = cf6874fdb3f51c91af24b23e2ee91a10
+ md5sums = 6a331fbbe53bb626dba96ac34a30eaa8
+ md5sums = 32d617bf5b67bf4c2a49e1506978ae9a
+ md5sums = 141edbc2b561db0a3ceef18131feadcd
+ md5sums = 3731bccb386b411686a61177cc09cae4
+ md5sums = e20d5f9638e01cedc087690ad259a6d9
+ md5sums = e37d2a3ac90892417e9d9ef43feac04a
+ md5sums = 98022e549a9cfeb1d0ed49a625fb27b8
+ md5sums = ecfd33e3996effeca405d1537ef0a501
+ md5sums = ba89cd4e86627295d3ee678d29162ee3
+ sha1sums = 314a8bb70f9f06bac840200fac0916e80d8d06b3
+ sha1sums = c6827b31e51514f4c6e2e4a4acd54f20a52d3e96
+ sha1sums = 391e19f89b745a4905d25576a7a4a15b4afb3826
+ sha1sums = d14fae7f00c09dc1e59b602b44e3d9e7eeb8ae1b
+ sha1sums = 2d1b72244376779df14bb9d893b1309cc2007215
+ sha1sums = 7cb284b5b8b4dc34455e691f9ecfded9c55d5e42
+ sha1sums = 540606a185775d86137faff790bc54b905a297e0
+ sha1sums = b0c4f5ab3c07856330d26233f96764c15bfe81c3
+ sha1sums = 623226089304af33e871663f02e2ddfa8f5c9f57
+ sha1sums = bf3df235f895cde5cd0963473c08f5cc4cf2726c
+ sha1sums = 687d561ba6c4494d685d429a8b76f24512d28227
+ sha1sums = e116771492724db3543e5cfb35bd88b4812aeebe
+ sha1sums = 53cb621f6488f6b96f5c2747629c23e2d43cb3aa
+ sha1sums = 4f1a05616a3f4faf4cc75ff5e2a64e4329cf1d15
+ sha1sums = 1a61d1d06d19f48f1c75aa58acf774c6d5f3175f
+ sha1sums = 3abd6ae04e6e3e5e24950a4becfbdf784767e75c
+ sha1sums = 079569092e1517540af7b13edb3ef1163629784e
+ sha1sums = 2cc3a2f49b6b4d141b22d946d4f229a4e9b2c8c3
+ sha1sums = c7e36dbe97a8c4fff199cb6a769fa7bb17f6bfc4
+
+pkgname = openl2tp
+
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 00000000000..b9ed4034f4e
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,103 @@
+# Maintainer: Kanogin Alex <alex at 5252 dot ru>
+# Contributor: Aleksey Frolov <atommixz at gmail dotcom>
+# Contributor: Orivej Desh <smpuj at bk dotru>
+
+pkgname=openl2tp
+pkgver=1.8
+pkgrel=5
+pkgdesc="L2TP client / server, written by Katalix Systems specifically for Linux"
+arch=(i686 x86_64)
+url="http://opensource.katalix.com/openl2tp"
+license=("GPL")
+backup=('etc/conf.d/openl2tpd'
+ 'etc/ppp/chap-secrets'
+ 'etc/openl2tpd.conf')
+depends=('rpcbind'
+ 'ppp')
+makedepends=('linux-headers')
+source=(http://downloads.sourceforge.net/$pkgname/$pkgname-$pkgver.tar.gz
+ gcc-4.6.patch
+ openl2tp.service
+ openl2tpd-conf.d
+ openl2tpd.conf
+ chap-secrets
+ example-client.openl2tpd.conf
+ example-server.openl2tpd.conf
+ example-server.options.openl2tpd
+ example-server-radius.openl2tpd.conf
+ gentoo-openl2tp-1.8-clientip_as_ipparam.patch
+ gentoo-openl2tp-1.8-l2tpconfig.patch
+ gentoo-openl2tp-1.8-ldflags.patch
+ gentoo-openl2tp-1.8-man.patch
+ gentoo-openl2tp-1.8-optionsfile.patch
+ gentoo-openl2tp-1.8-parallelbuild.patch
+ gentoo-openl2tp-1.8-pppd-2.patch
+ gentoo-openl2tp-1.8-setkey.patch
+ gentoo-openl2tp-1.8-werror.patch)
+options=(!emptydirs)
+
+build() {
+ cd "$pkgname-$pkgver"
+
+ sed -i -e 's|-Werror||' Makefile
+ sed -i -e 's|source|build|' Makefile
+ sed -i -e 's|/usr/sbin|/usr/bin|' Makefile
+ patch -p2 < ../../gcc-4.6.patch
+
+ make
+}
+
+package() {
+ cd "$pkgname-$pkgver"
+
+ make \
+ SYS_LIBDIR=/usr/lib \
+ DESTDIR=${pkgdir} \
+ install
+
+ install -Dm644 ../openl2tpd-conf.d "$pkgdir"/etc/conf.d/openl2tpd
+ install -Dm644 ../openl2tp.service "$pkgdir"/etc/systemd/system/openl2tp.service
+ install -Dm644 LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
+ install -Dm644 ../chap-secrets "$pkgdir"/etc/ppp/chap-secrets
+ install -Dm644 ../openl2tpd.conf "$pkgdir"/etc/openl2tpd.conf
+}
+
+md5sums=('e3d08dedfb9e6a9a1e24f6766f6dadd0'
+ '63e674724d0ae4265b86e776827969e1'
+ 'bc2d1231a2f1ba2eb05b366b12902edf'
+ '38e0f4201f830bd59dabf38dbab6362a'
+ '456f1b54f7fb5ec252f1b6e3afdb8bdb'
+ 'adac6f133fc0179eee15f824b3a98922'
+ 'dc3a2575cc50804a511d59367599b6e4'
+ '78e4804574ca808a2d76b1febe8eed08'
+ '4e555341660d3d0339e841496cb3a523'
+ 'cf6874fdb3f51c91af24b23e2ee91a10'
+ '6a331fbbe53bb626dba96ac34a30eaa8'
+ '32d617bf5b67bf4c2a49e1506978ae9a'
+ '141edbc2b561db0a3ceef18131feadcd'
+ '3731bccb386b411686a61177cc09cae4'
+ 'e20d5f9638e01cedc087690ad259a6d9'
+ 'e37d2a3ac90892417e9d9ef43feac04a'
+ '98022e549a9cfeb1d0ed49a625fb27b8'
+ 'ecfd33e3996effeca405d1537ef0a501'
+ 'ba89cd4e86627295d3ee678d29162ee3')
+sha1sums=('314a8bb70f9f06bac840200fac0916e80d8d06b3'
+ 'c6827b31e51514f4c6e2e4a4acd54f20a52d3e96'
+ '391e19f89b745a4905d25576a7a4a15b4afb3826'
+ 'd14fae7f00c09dc1e59b602b44e3d9e7eeb8ae1b'
+ '2d1b72244376779df14bb9d893b1309cc2007215'
+ '7cb284b5b8b4dc34455e691f9ecfded9c55d5e42'
+ '540606a185775d86137faff790bc54b905a297e0'
+ 'b0c4f5ab3c07856330d26233f96764c15bfe81c3'
+ '623226089304af33e871663f02e2ddfa8f5c9f57'
+ 'bf3df235f895cde5cd0963473c08f5cc4cf2726c'
+ '687d561ba6c4494d685d429a8b76f24512d28227'
+ 'e116771492724db3543e5cfb35bd88b4812aeebe'
+ '53cb621f6488f6b96f5c2747629c23e2d43cb3aa'
+ '4f1a05616a3f4faf4cc75ff5e2a64e4329cf1d15'
+ '1a61d1d06d19f48f1c75aa58acf774c6d5f3175f'
+ '3abd6ae04e6e3e5e24950a4becfbdf784767e75c'
+ '079569092e1517540af7b13edb3ef1163629784e'
+ '2cc3a2f49b6b4d141b22d946d4f229a4e9b2c8c3'
+ 'c7e36dbe97a8c4fff199cb6a769fa7bb17f6bfc4')
+
diff --git a/chap-secrets b/chap-secrets
new file mode 100644
index 00000000000..29eacd0cea3
--- /dev/null
+++ b/chap-secrets
@@ -0,0 +1,4 @@
+# Secrets for authentication using CHAP
+# client server secret IP addresses
+
+089-USER-NAME * PASSWORD *
diff --git a/example-client.openl2tpd.conf b/example-client.openl2tpd.conf
new file mode 100644
index 00000000000..6ead75a6296
--- /dev/null
+++ b/example-client.openl2tpd.conf
@@ -0,0 +1,30 @@
+system modify \
+ deny_remote_tunnel_creates=yes \
+ tunnel_establish_timeout=60 \
+ session_establish_timeout=0 \
+ tunnel_persist_pend_timeout=60 \
+ session_persist_pend_timeout=60
+
+ppp profile modify \
+ profile_name=default \
+ mtu=1460 \
+ mru=1460 \
+ auth_peer=no \
+ auth_pap=no \
+ auth_eap=no \
+ auth_mschapv1=no \
+ lcp_echo_interval=10 \
+ lcp_echo_failure_count=3 \
+ default_route=yes
+
+tunnel create \
+ tunnel_name=campus \
+ dest_ipaddr=my.l2tp.provider \
+ use_udp_checksums=off \
+ persist=yes
+
+session create \
+ tunnel_name=campus \
+ session_name=campus \
+ use_sequence_numbers=no \
+ user_name=my_user_name
diff --git a/example-server-radius.openl2tpd.conf b/example-server-radius.openl2tpd.conf
new file mode 100644
index 00000000000..e666fdec610
--- /dev/null
+++ b/example-server-radius.openl2tpd.conf
@@ -0,0 +1,28 @@
+ppp profile modify \
+ profile_name=default \
+ local_ipaddr=10.7.2.16 \
+ auth_eap=no \
+ auth_mschapv1=yes \
+ auth_mschapv2=yes \
+ use_radius=yes \
+ ipcp_retransmit_interval=1 \
+ lcp_retransmit_interval=1 \
+ lcp_echo_interval=5 \
+ chap_max_challenge=3 \
+ chap_restart=1 \
+ idle_timeout=0 \
+ max_connect_time=0 \
+ mtu=1460 \
+ mru=1460 \
+ radius_hint=/etc/radiusclient/radiusclient.conf
+
+tunnel profile modify \
+ profile_name=default \
+ src_ipaddr=10.50.0.16 \
+ retry_timeout=1 \
+ use_udp_checksums=no \
+ our_udp_port=1701
+
+session profile modify \
+ profile_name=default \
+ use_sequence_numbers=no
diff --git a/example-server.openl2tpd.conf b/example-server.openl2tpd.conf
new file mode 100644
index 00000000000..e960e14e1a3
--- /dev/null
+++ b/example-server.openl2tpd.conf
@@ -0,0 +1,36 @@
+system modify \
+ deny_remote_tunnel_creates=no \
+ tunnel_establish_timeout=60 \
+ session_establish_timeout=0 \
+ tunnel_persist_pend_timeout=60 \
+ session_persist_pend_timeout=60
+
+ppp profile modify profile_name=default \
+ optionsfile=/etc/ppp/options.openl2tpd \
+ local_ipaddr=172.16.17.1 \
+ lcp_echo_interval=10 \
+ lcp_echo_failure_count=3 \
+ auth_eap=no \
+ auth_pap=no \
+ auth_none=no \
+ auth_chap=yes \
+ auth_mschapv1=no \
+ auth_mschapv2=yes
+
+session profile create profile_name=peer1 \
+ ppp_profile_name=peer1
+
+ppp profile create profile_name=peer1 \
+ optionsfile=/etc/ppp/options.openl2tpd \
+ auth_none=no \
+ auth_pap=no \
+ auth_chap=yes \
+ auth_mschapv1=no \
+ auth_mschapv2=yes \
+ auth_peer=no \
+ dns_ipaddr_pri=172.16.17.1 \
+ local_ipaddr=172.16.17.1 \
+ remote_ipaddr=172.16.17.6 # ipaddr of peer1
+
+tunnel profile modify profile_name=default \
+ our_udp_port=1701
diff --git a/example-server.options.openl2tpd b/example-server.options.openl2tpd
new file mode 100644
index 00000000000..411956fab1a
--- /dev/null
+++ b/example-server.options.openl2tpd
@@ -0,0 +1,23 @@
+# usually placed at /etc/ppp/options.openl2tpd
+name host
+auth
+plugin pppol2tp.so
+refuse-mschap
+require-mschap-v2
+hide-password
+ipcp-accept-local
+ipcp-accept-remote
+lcp-echo-interval 15
+lcp-echo-failure 4
+ms-dns 172.16.17.1
+netmask 255.255.255.0
+nodefaultroute
+proxyarp
+crtscts
+noccp
+nobsdcomp
+nodeflate
+noaccomp
+nopcomp
+novj
+lock
diff --git a/gcc-4.6.patch b/gcc-4.6.patch
new file mode 100644
index 00000000000..48e7575d4bb
--- /dev/null
+++ b/gcc-4.6.patch
@@ -0,0 +1,32 @@
+diff -Naur src/openl2tp-1.8/usl/usl_timer.c src/openl2tp-1.8-fixed/usl/usl_timer.c
+--- src/openl2tp-1.8/usl/usl_timer.c 2011-07-04 23:04:55.000000000 +0400
++++ src/openl2tp-1.8-fixed/usl/usl_timer.c 2011-07-04 23:08:01.000000000 +0400
+@@ -88,14 +88,13 @@
+ */
+ void usl_timer_tick(void)
+ {
+- int result;
+ char msg = '\0';
+
+ usl_tick++;
+
+ if (!usl_tick_pending) {
+ usl_tick_pending = 1;
+- result = write(usl_tick_pipe[1], &msg, sizeof(msg));
++ write(usl_tick_pipe[1], &msg, sizeof(msg));
+ }
+ }
+
+@@ -112,11 +111,10 @@
+ struct usl_ord_list_head *tmp;
+ struct usl_list_head *iwalk;
+ struct usl_list_head *itmp;
+- int result;
+ char msg;
+ USL_LIST_HEAD(expire_list);
+
+- result = usl_fd_read(usl_tick_pipe[0], &msg, sizeof(msg));
++ usl_fd_read(usl_tick_pipe[0], &msg, sizeof(msg));
+ usl_tick_pending = 0;
+
+ usl_list_for_each(walk, tmp, &usl_timer_list) {
diff --git a/gentoo-openl2tp-1.8-clientip_as_ipparam.patch b/gentoo-openl2tp-1.8-clientip_as_ipparam.patch
new file mode 100644
index 00000000000..fcea3d110f5
--- /dev/null
+++ b/gentoo-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/gentoo-openl2tp-1.8-l2tpconfig.patch b/gentoo-openl2tp-1.8-l2tpconfig.patch
new file mode 100644
index 00000000000..bf1644c9a14
--- /dev/null
+++ b/gentoo-openl2tp-1.8-l2tpconfig.patch
@@ -0,0 +1,15 @@
+diff -Naur openl2tp-1.7.man//Makefile openl2tp-1.7/Makefile
+--- openl2tp-1.7.man//Makefile 2010-09-05 11:02:18.000000000 +0400
++++ openl2tp-1.7/Makefile 2010-09-05 12:25:51.694863508 +0400
+@@ -314,9 +314,9 @@
+ $(INSTALL) openl2tpd $(DESTDIR)/usr/sbin
+
+ install-app:
+- $(INSTALL) -d $(DESTDIR)/usr/bin
++ $(INSTALL) -d $(DESTDIR)/usr/sbin
+ ifeq ($(L2TP_FEATURE_RPC_MANAGEMENT),y)
+- $(INSTALL) l2tpconfig $(DESTDIR)/usr/bin
++ $(INSTALL) -m 0500 l2tpconfig $(DESTDIR)/usr/sbin
+ endif
+ $(INSTALL) -d $(DESTDIR)$(SYS_LIBDIR)/openl2tp
+ $(INSTALL) -m 0644 l2tp_rpc.x $(DESTDIR)$(SYS_LIBDIR)/openl2tp/l2tp_rpc.x
diff --git a/gentoo-openl2tp-1.8-ldflags.patch b/gentoo-openl2tp-1.8-ldflags.patch
new file mode 100644
index 00000000000..7d1efffae92
--- /dev/null
+++ b/gentoo-openl2tp-1.8-ldflags.patch
@@ -0,0 +1,73 @@
+diff -Naur openl2tp-1.8.werror/Makefile openl2tp-1.8/Makefile
+--- openl2tp-1.8.werror/Makefile 2010-11-28 17:18:02.000000000 +0300
++++ openl2tp-1.8/Makefile 2010-11-28 17:22:27.950475976 +0300
+@@ -266,10 +266,10 @@
+ etags $(wildcard *.c) $(wildcard *.h)
+
+ openl2tpd: $(L2TPD_SRCS.o)
+- $(CC) -o $@ $^ $(LDFLAGS.l2tpd)
++ $(CC) $(LDFLAGS) -o $@ $^ $(LDFLAGS.l2tpd)
+
+ l2tpconfig: $(L2TPCONFIG_SRCS.o)
+- $(CC) -o $@ $^ $(LDFLAGS.l2tpconfig)
++ $(CC) $(LDFLAGS) -o $@ $^ $(LDFLAGS.l2tpconfig)
+
+ %.o: %.c
+ $(CC) -c $(CFLAGS) $< -o $@
+diff -Naur openl2tp-1.8.werror/cli/Makefile openl2tp-1.8/cli/Makefile
+--- openl2tp-1.8.werror/cli/Makefile 2010-11-28 17:18:27.000000000 +0300
++++ openl2tp-1.8/cli/Makefile 2010-11-28 17:22:27.950475976 +0300
+@@ -19,7 +19,7 @@
+ $(AR) rus $@ $^
+
+ cli_test: $(CLI_SRCS_TEST.o) libcli.a
+- $(CC) -o $@ $(CLI_SRCS_TEST.o) $(LDFLAGS.cli_test)
++ $(CC) $(LDFLAGS) -o $@ $(CLI_SRCS_TEST.o) $(LDFLAGS.cli_test)
+
+ clean:
+ $(RM) $(CLI_SRCS.o) $(CLI_SRCS_TEST.o) libcli.a cli_test $(wildcard *.d)
+diff -Naur openl2tp-1.8.werror/plugins/Makefile openl2tp-1.8/plugins/Makefile
+--- openl2tp-1.8.werror/plugins/Makefile 2010-11-22 17:05:29.000000000 +0300
++++ openl2tp-1.8/plugins/Makefile 2010-11-28 17:22:27.950475976 +0300
+@@ -1,7 +1,7 @@
+ CFLAGS := $(CFLAGS.optimize) -MMD -Wall \
+ -isystem ../include \
+ -I. -I.. -I../usl -fPIC $(EXTRA_CFLAGS)
+-LDFLAGS := -shared
++LDFLAGS.plugins := -shared
+
+ PLUGINS.c:= ppp_unix.c ppp_null.c ipsec.c event_sock.c
+
+@@ -21,7 +21,7 @@
+ $(RM) $(PLUGINS.so) $(wildcard *.o) $(wildcard *.d) $(SRC.generated)
+
+ %.so: %.c
+- $(CC) -o $@ $(LDFLAGS) $(CFLAGS) $<
++ $(CC) $(LDFLAGS) -o $@ $(LDFLAGS.plugins) $(CFLAGS) $<
+
+ install: all
+ $(INSTALL) -d $(DESTDIR)$(SYS_LIBDIR)/openl2tp
+diff -Naur openl2tp-1.8.werror/test/Makefile openl2tp-1.8/test/Makefile
+--- openl2tp-1.8.werror/test/Makefile 2007-05-28 18:28:53.000000000 +0400
++++ openl2tp-1.8/test/Makefile 2010-11-28 17:25:52.871882050 +0300
+@@ -3,7 +3,7 @@
+ all: pppd_dummy
+
+ pppd_dummy: pppd_dummy.c
+- $(CC) -o $@ $<
++ $(CC) $(LDFLAGS) -o $@ $<
+
+ clean:
+ -$(RM) pppd_dummy
+diff -Naur openl2tp-1.8.werror/usl/Makefile openl2tp-1.8/usl/Makefile
+--- openl2tp-1.8.werror/usl/Makefile 2010-11-28 17:18:15.000000000 +0300
++++ openl2tp-1.8/usl/Makefile 2010-11-28 17:22:27.950475976 +0300
+@@ -26,7 +26,7 @@
+ $(AR) rus $@ $^
+
+ usl_test: $(USL_SRCS_TEST.o) libusl.a
+- $(CC) -o $@ $(USL_SRCS_TEST.o) $(LDFLAGS.usl_test)
++ $(CC) $(LDFLAGS) -o $@ $(USL_SRCS_TEST.o) $(LDFLAGS.usl_test)
+
+ clean:
+ -$(RM) $(USL_SRCS.o) $(USL_SRCS_TEST.o) libusl.a usl_test $(wildcard *.d)
diff --git a/gentoo-openl2tp-1.8-man.patch b/gentoo-openl2tp-1.8-man.patch
new file mode 100644
index 00000000000..5375e169585
--- /dev/null
+++ b/gentoo-openl2tp-1.8-man.patch
@@ -0,0 +1,40 @@
+diff -Naur openl2tp-1.7.pppd/doc/Makefile openl2tp-1.7/doc/Makefile
+--- openl2tp-1.7.pppd/doc/Makefile 2007-05-28 19:53:38.000000000 +0400
++++ openl2tp-1.7/doc/Makefile 2010-07-31 18:21:56.163449838 +0400
+@@ -11,29 +11,24 @@
+ MANSRC+= $(MANSRC.5)
+ endif
+
+-all: $(MANSRC:%=%.gz)
+-
+-%.gz: %
+- gzip --best -c $< > $@
++all: $(MANSRC)
+
+ clean:
+- -$(RM) $(MANSRC:%=%.gz)
++ -$(RM) $(MANSRC)
+
+ install: all
+ $(INSTALL) -d $(DESTDIR)/usr/share/man/man1
+-ifeq ($(L2TP_FEATURE_RPC_MANAGEMENT),y)
+- $(INSTALL) $(MANSRC.1:%=%.gz) $(DESTDIR)/usr/share/man/man1
++ $(INSTALL) $(MANSRC.1) $(DESTDIR)/usr/share/man/man1
+-endif
+ $(INSTALL) -d $(DESTDIR)/usr/share/man/man4
+- $(INSTALL) $(MANSRC.4:%=%.gz) $(DESTDIR)/usr/share/man/man4
++ $(INSTALL) $(MANSRC.4) $(DESTDIR)/usr/share/man/man4
+ ifeq ($(L2TP_FEATURE_LOCAL_CONF_FILE),y)
+ $(INSTALL) -d $(DESTDIR)/usr/share/man/man5
+- $(INSTALL) $(MANSRC.5:%=%.gz) $(DESTDIR)/usr/share/man/man5
++ $(INSTALL) $(MANSRC.5) $(DESTDIR)/usr/share/man/man5
+ endif
+ $(INSTALL) -d $(DESTDIR)/usr/share/man/man7
+- $(INSTALL) $(MANSRC.7:%=%.gz) $(DESTDIR)/usr/share/man/man7
++ $(INSTALL) $(MANSRC.7) $(DESTDIR)/usr/share/man/man7
+ $(INSTALL) -d $(DESTDIR)/usr/share/man/man8
+- $(INSTALL) $(MANSRC.8:%=%.gz) $(DESTDIR)/usr/share/man/man8
++ $(INSTALL) $(MANSRC.8) $(DESTDIR)/usr/share/man/man8
+
+ TAGS:
+
diff --git a/gentoo-openl2tp-1.8-optionsfile.patch b/gentoo-openl2tp-1.8-optionsfile.patch
new file mode 100644
index 00000000000..45c209fc775
--- /dev/null
+++ b/gentoo-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/gentoo-openl2tp-1.8-parallelbuild.patch b/gentoo-openl2tp-1.8-parallelbuild.patch
new file mode 100644
index 00000000000..994a48505e9
--- /dev/null
+++ b/gentoo-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/gentoo-openl2tp-1.8-pppd-2.patch b/gentoo-openl2tp-1.8-pppd-2.patch
new file mode 100644
index 00000000000..5d326562c41
--- /dev/null
+++ b/gentoo-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/gentoo-openl2tp-1.8-setkey.patch b/gentoo-openl2tp-1.8-setkey.patch
new file mode 100644
index 00000000000..d7b9e068182
--- /dev/null
+++ b/gentoo-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/gentoo-openl2tp-1.8-werror.patch b/gentoo-openl2tp-1.8-werror.patch
new file mode 100644
index 00000000000..d36447dfe96
--- /dev/null
+++ b/gentoo-openl2tp-1.8-werror.patch
@@ -0,0 +1,36 @@
+diff -Naur openl2tp-1.8.orig/Makefile openl2tp-1.8/Makefile
+--- openl2tp-1.8.orig/Makefile 2010-11-22 12:47:26.000000000 +0300
++++ openl2tp-1.8/Makefile 2010-11-28 17:18:02.547651027 +0300
+@@ -154,7 +154,7 @@
+
+ CPPFLAGS= $(CPPFLAGS.l2tptest) $(CPPFLAGS-y)
+ CFLAGS= -I. -Iusl -Icli -isystem include \
+- -MMD -Wall -Werror -Wno-strict-aliasing \
++ -MMD -Wall -Wno-strict-aliasing \
+ $(CPPFLAGS) $(CPPFLAGS.dmalloc) \
+ -DSYS_LIBDIR=$(SYS_LIBDIR)
+ LDFLAGS.l2tpd= -Wl,-E -L. -Lusl -lusl -ldl $(LIBS.dmalloc) -lc
+diff -Naur openl2tp-1.8.orig/cli/Makefile openl2tp-1.8/cli/Makefile
+--- openl2tp-1.8.orig/cli/Makefile 2010-11-12 15:28:47.000000000 +0300
++++ openl2tp-1.8/cli/Makefile 2010-11-28 17:18:27.707453102 +0300
+@@ -7,7 +7,7 @@
+
+ LDFLAGS.cli_test= -L.. -L. $(READLINE_LDFLAGS) -lcli -lusl -lreadline -lcurses -lc
+
+-CFLAGS= $(CFLAGS.optimize) -MMD -Wall -Werror -I.. $(READLINE_CFLAGS)
++CFLAGS= $(CFLAGS.optimize) -MMD -Wall -I.. $(READLINE_CFLAGS)
+
+ .PHONY: all test clean
+
+diff -Naur openl2tp-1.8.orig/usl/Makefile openl2tp-1.8/usl/Makefile
+--- openl2tp-1.8.orig/usl/Makefile 2010-11-04 19:27:08.000000000 +0300
++++ openl2tp-1.8/usl/Makefile 2010-11-28 17:18:15.615816682 +0300
+@@ -14,7 +14,7 @@
+ endif
+
+ CPPFLAGS+= $(CFLAGS.optimize) -g
+-CFLAGS= -I. -MMD -Wall -Werror -Wno-strict-aliasing $(CPPFLAGS) $(CPPFLAGS.dmalloc)
++CFLAGS= -I. -MMD -Wall -Wno-strict-aliasing $(CPPFLAGS) $(CPPFLAGS.dmalloc)
+
+ .PHONY: all test clean
+
diff --git a/openl2tp.service b/openl2tp.service
new file mode 100644
index 00000000000..5bc028313ba
--- /dev/null
+++ b/openl2tp.service
@@ -0,0 +1,14 @@
+[Unit]
+Description=The open L2TP implementation
+After=network.target remote-fs.target nss-lookup.target rpcbind.target
+Requires=rpcbind.service
+
+[Service]
+Type=forking
+PIDFile=/run/openl2tpd.pid
+EnvironmentFile=/etc/conf.d/openl2tpd
+ExecStartPre=/usr/bin/modprobe -q l2tp_ppp
+ExecStart=/usr/bin/openl2tpd $OPENL2TPDARGS
+
+[Install]
+WantedBy=multi-user.target
diff --git a/openl2tpd-conf.d b/openl2tpd-conf.d
new file mode 100644
index 00000000000..9d57348380e
--- /dev/null
+++ b/openl2tpd-conf.d
@@ -0,0 +1,17 @@
+# Settings for the OpenL2TP daemon.
+# OPENL2TPDARGS= : any extra command-line startup arguments for crond
+# -R - allow remote management using RPC
+# -d nnn - set debug trace mask to nnn
+# -L log-facility - set syslog facility (default LOG_DAEMON)
+#
+# OPENL2TPD_CONFIG_FILE= : a file containing L2TP config that
+# is loaded when openl2tpd starts up.
+
+# Use ipsec.so plugin for IPSec setups.
+#OPENL2TPDARGS="-p ipsec.so"
+OPENL2TPDARGS=
+
+# Config file to load at openl2tpd startup
+OPENL2TPD_CONFIG_FILE=
+
+
diff --git a/openl2tpd.conf b/openl2tpd.conf
new file mode 100644
index 00000000000..56dee75fcce
--- /dev/null
+++ b/openl2tpd.conf
@@ -0,0 +1,32 @@
+system modify \
+ deny_remote_tunnel_creates=yes \
+ tunnel_establish_timeout=60 \
+ session_establish_timeout=30 \
+ tunnel_persist_pend_timeout=60 \
+ session_persist_pend_timeout=60
+
+peer profile modify profile_name=default lac_lns=lac
+
+ppp profile modify \
+ profile_name=default \
+ mtu=1460 \
+ mru=1460 \
+ auth_none=no \
+ auth_pap=no \
+ auth_eap=no \
+ proxy_arp=no \
+ auth_mschapv1=no \
+ auth_mschapv2=yes \
+ lcp_echo_interval=10 \
+ lcp_echo_failure_count=3 \
+ default_route=yes
+
+tunnel create \
+ tunnel_name=beeline \
+ dest_ipaddr=tp.internet.beeline.ru \
+ persist=yes
+
+session create \
+ tunnel_name=beeline \
+ session_name=beeline \
+ user_name="089-USER-NAME"