diff options
author | Christian Breunig <christian@breunig.cc> | 2024-07-23 19:03:07 +0200 |
---|---|---|
committer | Mergify <37929162+mergify[bot]@users.noreply.github.com> | 2024-07-24 23:52:13 +0000 |
commit | 92740091d793114504feeacc210360220cae9e08 (patch) | |
tree | 1944a1cf105f72a17d34216643b2596917e093b3 /python/vyos/ifconfig/l2tpv3.py | |
parent | 8fa7de187c32d0fcc08e2c86d0e297ed8288077e (diff) | |
download | vyos-1x-92740091d793114504feeacc210360220cae9e08.tar.gz vyos-1x-92740091d793114504feeacc210360220cae9e08.zip |
interface: T6592: remove interface from conntrack ct_iface_map on deletion
We always have had stale interface entries in the ct_iface_map of nftables/
conntrack for any interface that once belonged to a VRF.
This commit will always clean the nftables interface map when the interface
is deleted from the system.
(cherry picked from commit 17c12bde5c6f314311e7524842fd1ddc254009b4)
Diffstat (limited to 'python/vyos/ifconfig/l2tpv3.py')
-rw-r--r-- | python/vyos/ifconfig/l2tpv3.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/python/vyos/ifconfig/l2tpv3.py b/python/vyos/ifconfig/l2tpv3.py index 85a89ef8b..c1f2803ee 100644 --- a/python/vyos/ifconfig/l2tpv3.py +++ b/python/vyos/ifconfig/l2tpv3.py @@ -90,9 +90,17 @@ class L2TPv3If(Interface): """ if self.exists(self.ifname): - # interface is always A/D down. It needs to be enabled explicitly self.set_admin_state('down') + # remove all assigned IP addresses from interface - this is a bit redundant + # as the kernel will remove all addresses on interface deletion + self.flush_addrs() + + # remove interface from conntrack VRF interface map, here explicitly and do not + # rely on the base class implementation as the interface will + # vanish as soon as the l2tp session is deleted + self._del_interface_from_ct_iface_map() + if {'tunnel_id', 'session_id'} <= set(self.config): cmd = 'ip l2tp del session tunnel_id {tunnel_id}' cmd += ' session_id {session_id}' @@ -101,3 +109,5 @@ class L2TPv3If(Interface): if 'tunnel_id' in self.config: cmd = 'ip l2tp del tunnel tunnel_id {tunnel_id}' self._cmd(cmd.format(**self.config)) + + # No need to call the baseclass as the interface is now already gone |