Page MenuHomePhabricator

Removing an L2TPv3 interface causes an iproute2 error output to appear
Closed, ResolvedPublicBUG


If you remove an L2TPv3 interface, commit shows an iproute2 error but succeeds.

vyos@vyos# delete interfaces l2tpv3 
vyos@vyos# commit
[ interfaces l2tpv3 l2tpeth0 ]
Unknown command: 11
Usage: ip l2tp add tunnel
          remote ADDR local ADDR
          tunnel_id ID peer_tunnel_id ID
          [ encap { ip | udp } ]
          [ udp_sport PORT ] [ udp_dport PORT ]
Usage: ip l2tp add session [ name NAME ]
          tunnel_id ID
          session_id ID peer_session_id ID
          [ cookie HEXSTR ] [ peer_cookie HEXSTR ]
          [ offset OFFSET ] [ peer_offset OFFSET ]
          [ l2spec_type L2SPEC ]
       ip l2tp del tunnel tunnel_id ID
       ip l2tp del session tunnel_id ID session_id ID
       ip l2tp show tunnel [ tunnel_id ID ]
       ip l2tp show session [ tunnel_id ID ] [ session_id ID ]

Where: NAME   := STRING
       ADDR   := { IP_ADDRESS | any }
       PORT   := { 0..65535 }
       ID     := { 1..4294967295 }
       HEXSTR := { 8 or 16 hex digits (4 / 8 bytes) }
       L2SPEC := { none | default }

Despite the threatening message, the bug is purely cosmetic since L2TPv3 interface actually gets successfully deleted.
The root cause is missing tunnel_id keyword in ip l2tp del command in the script.

  ip link set $VAR(@) down
  if [ -n "$VAR(./tunnel-id/@)" ] && [ -n "$VAR(./session-id/@)" ]; then
    ip l2tp del session tunnel_id $VAR(./tunnel-id/@) session_id $VAR(./session-id/@)
  if [ -n "$VAR(./tunnel-id/@)" ]; then
    ip l2tp del tunnel tunnel_id  $VAR(./tunnel-id/@)

The command inside the second conditional does its job fine, which raises a question whether the first part is redundant. The idea clearly was to remove sessions associated with tunnel before removing the tunnel, but I'm not sure if it really was ever needed. Perhaps L2TPv3 behaviour was different in 1.0.x times.


Difficulty level
Easy (less than an hour)
Why the issue appeared?
Will be filled on close
dmbaturin created this task.Nov 4 2017, 3:04 AM
dmbaturin closed this task as Resolved.Nov 13 2017, 8:24 AM
dmbaturin claimed this task.