Skip to main content

Building OpenWRT with OpenL2TP

This is just a quick dump of the process of building current git of OpenWRT for OpenL2TP. Complete blog post about OpenL2TP on OpenWRT 2.4 will be available later.

Kernel

Patched pppol2tp.c, removed NULL assignment to nonexistent iptables structure.

After reflash:

root@OpenWrt:/lib/modules/2.4.37.5# insmod pppol2tp
insmod: unresolved symbol udp_prot

udp_prot is exported only when

#if defined (CONFIG_IPV6_MODULE)
  || defined (CONFIG_KHTTPD)
  || defined (CONFIG_KHTTPD_MODULE)
  || defined (CONFIG_IP_SCTP_MODULE)

Selected CONFIG_IPV6_MODULE

IPV6 Module is not installed then, but symbol is exported.

root@OpenWrt:/etc/init.d# openl2tpd -R -f -D
Start, trace_flags=00000000 (debug enabled)
OpenL2TP V1.6, (c) Copyright 2004,2005,2006,2007,2008 Katalix Systems Ltd.
Loading plugin /usr/lib/openl2tp/ppp_unix.so, version V1.5
no entry for l2tp in /etc/services and -u not used
Cleaning up before exiting
Unloading plugin /usr/lib/openl2tp/ppp_unix.so

So, either /etc/services need to be tweaked (HEY, they are empty)! or -u 1701 must be given.

Disable httpd service:

/etc/init.d/httpd disable

Debugging OpenL2TP:

l2tp> tunnel create dest_ipaddr=10.0.0.24 tunnel_name=vpn2
l2tp> session create tunnel_name=vpn2 user_name=xxx@internet.beeline.ua user_password=yyy

pppd 2.4.4 started as

pppd debug kdebug 7 noipdefault sync nodetach user xxx@internet.beeline.ua \
password yyy local noauth noaccomp nopcomp nobsdcomp \
nodeflate nopredictor1 novj novjccomp noendpoint nomp noproxyarp \
plugin pppol2tp.so plugin openl2tp.so pppol2tp 18 pppol2tp_tunnel_id 57957 \
pppol2tp_session_id 9843 pppol2tp_debug_mask 15

dies with

: unrecognized option 'nomp'

Reason: openwrt/package/ppp/patches/200-makefile.patch sets HAVE_MULTILINK disabled despite:

# Linux distributions: Please leave multilink ENABLED in your builds

noendpoint is supported, so we remove nomp thing

: Plugin pppol2tp.so is for pppd version 2.4.5, this is 2.4.4

Reason: INCLUDE_DIR is set in OpenL2TP and it points to system include dir

Changing the Makefile to override INCLUDE DIR as well in openwrt/feeds/packages/net/openl2tp/Makefile

ARGHHHH!!!:

Plugin pppol2tp.so loaded.
Plugin openl2tp.so loaded.
PPPoL2TP kernel driver not installed

Reason: incorrect #define for 2.4 kernel

Session is now OK

See also: