Skip to content

Commit

Permalink
Fix bridge/bond/member linking
Browse files Browse the repository at this point in the history
  • Loading branch information
signal-09 committed Sep 10, 2024
1 parent 7ff0cef commit 5ce0728
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions iproute4mac/ifconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,7 @@ def __init__(self, text):
# "num_rx_queues": 1,
# "gso_max_size": 65536,
# "gso_max_segs": 65535,
"addr_info": None, # async __update__ with self._get_addr_info()
"addr_info": self._get_addr_info(),
}

def __update__(self):
Expand All @@ -575,7 +575,6 @@ def __update__(self):
"link": self._get_link(),
"master": self._get_master(),
"linkinfo": self._get_linkinfo(),
"addr_info": self._get_addr_info(),
}
)

Expand All @@ -587,8 +586,8 @@ def _get_link(self):
return None

def _get_master(self):
if self._ifconfig.link:
return self._ifconfig.link.name
if self.link:
return self.link.name
return None

def _get_info_kind(self):
Expand Down Expand Up @@ -649,14 +648,13 @@ def _get_info_data(self):
# "nf_call_iptables": 0,
# "nf_call_ip6tables": 0,
# "nf_call_arptables": 0,
"ipfilter": self._ifconfig["bridge"]["ipfilter"] != "disabled",
}
)
return info_data if info_data else None

def _get_info_slave_kind(self):
if self._ifconfig.link:
return self._ifconfig.link._get_info_kind()
if self.link:
return self.link._get_info_kind()
return None

def _get_info_slave_data(self):
Expand Down Expand Up @@ -864,13 +862,10 @@ def _link_interfaces(self):
if member is None:
continue
if isinstance(member, str):
member = self.lookup("ifname", member)
interface._ifconfig["bond"][index] = member
member.link = interface
self.lookup("ifname", member).link = interface
if interface._ifconfig.get("bridge"):
for member in interface._ifconfig["bridge"].get("member", []):
if isinstance(member["interface"], str):
member["interface"] = self.lookup("ifname", member["interface"])
member["interface"].link = interface
self.lookup("ifname", member["interface"]).link = interface
for interface in self._interfaces:
interface.__update__()

0 comments on commit 5ce0728

Please sign in to comment.