diff options
author | Christian Breunig <christian@breunig.cc> | 2024-07-23 19:03:07 +0200 |
---|---|---|
committer | Christian Breunig <christian@breunig.cc> | 2024-07-25 19:29:12 +0200 |
commit | 6d60f88fef6edeb06a0efe1974c662f75c40640f (patch) | |
tree | 93699c6c1d44f9c02f2d65efc85e3e549c072ed8 /python/vyos/ifconfig/l2tpv3.py | |
parent | c73e89d7264f928db2ca44da1d885a96c125db48 (diff) | |
download | vyos-1x-6d60f88fef6edeb06a0efe1974c662f75c40640f.tar.gz vyos-1x-6d60f88fef6edeb06a0efe1974c662f75c40640f.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 |