commit:     1e14262524d65918ed6d1d13f2abd87b2f11425b
Author:     Sergey Popov <admin <AT> pinkbyte <DOT> ru>
AuthorDate: Tue Jan 24 14:10:36 2017 +0000
Commit:     Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
CommitDate: Tue Jan 24 14:10:36 2017 +0000
URL:        https://gitweb.gentoo.org/proj/netifrc.git/commit/?id=1e142625

Check for L2TP support in kernel

 net/l2tp.sh | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/net/l2tp.sh b/net/l2tp.sh
index 5efb535..dec1986 100644
--- a/net/l2tp.sh
+++ b/net/l2tp.sh
@@ -32,6 +32,10 @@ _l2tp_eval_props() {
 }
 
 _is_l2tp() {
+       # Check for L2TP support in kernel
+       ip l2tp show session &>/dev/null
+       [ $? -ne 0 ] && return 1
+
        eval "$(ip l2tp show session | \
                awk "match(\$0, /^Session ([0-9]+) in tunnel ([0-9]+)\$/, ret) 
{sid=ret[1]; tid=ret[2]} 
                match(\$0, /^[ ]*interface name: ${IFACE}\$/) {print 
\"session_id=\"sid\";tunnel_id=\"tid; exit}")"

Reply via email to