This is a backport of:
8516622 ("fix #7153: iproute2: consider bonds as physical bridge ports")

the needed changes were moving the code into PVE/Network.pm
(PVE/IPRoute2.pm got created in PVE 9.0) and adapting the method
declaration to pre v5.36 behavior (not signatured subs).

minimally tested with a reproducer based on the report in #7181.

Signed-off-by: Stoiko Ivanov <[email protected]>
---
 src/PVE/Network.pm | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/src/PVE/Network.pm b/src/PVE/Network.pm
index 9a8449a..7961eb0 100644
--- a/src/PVE/Network.pm
+++ b/src/PVE/Network.pm
@@ -970,7 +970,8 @@ sub get_physical_bridge_ports {
     $ip_links = ip_link_details() if !defined($ip_links);
 
     return grep {
-        ip_link_is_physical($ip_links->{$_}) && $ip_links->{$_}->{master} eq 
$bridge
+        (ip_link_is_physical($ip_links->{$_}) || 
ip_link_is_bond($ip_links->{$_}))
+            && defined($ip_links->{$_}->{master}) && $ip_links->{$_}->{master} 
eq $bridge
     } keys $ip_links->%*;
 }
 
@@ -999,6 +1000,15 @@ sub ip_link_is_physical {
         && (!defined($ip_link->{linkinfo}) || 
!defined($ip_link->{linkinfo}->{info_kind}));
 }
 
+sub ip_link_is_bond {
+    my ($ip_link) = @_;
+    return
+        $ip_link->{link_type} eq 'ether'
+        && defined($ip_link->{linkinfo})
+        && defined($ip_link->{linkinfo}->{info_kind})
+        && $ip_link->{linkinfo}->{info_kind} eq 'bond';
+}
+
 sub altname_mapping {
     my ($ip_links) = @_;
 
-- 
2.47.3



_______________________________________________
pve-devel mailing list
[email protected]
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to