[pve-devel] [PATCH pve-network] network: add|del_fdb: fix learning check
Alexandre Derumier
aderumier at odiso.com
Mon Nov 21 10:54:04 CET 2022
ovs port don't have sysfs path
"/sys/class/net/$iface/brport/learning"
We need to check if the value is undef too
Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
src/PVE/Network.pm | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/PVE/Network.pm b/src/PVE/Network.pm
index 26d8cb1..d1d2e5e 100644
--- a/src/PVE/Network.pm
+++ b/src/PVE/Network.pm
@@ -300,7 +300,7 @@ sub add_bridge_fdb {
my ($iface, $mac) = @_;
my $learning = PVE::Tools::file_read_firstline("/sys/class/net/$iface/brport/learning");
- return if $learning;
+ return if !defined($learning) || $learning == 1;
my ($vmid, $devid) = &$parse_tap_device_name($iface, 1);
return if !defined($vmid);
@@ -320,7 +320,7 @@ sub del_bridge_fdb {
my ($iface, $mac) = @_;
my $learning = PVE::Tools::file_read_firstline("/sys/class/net/$iface/brport/learning");
- return if $learning;
+ return if !defined($learning) || $learning == 1;
my ($vmid, $devid) = &$parse_tap_device_name($iface, 1);
return if !defined($vmid);
--
2.30.2
More information about the pve-devel
mailing list