Skip to content

Commit

Permalink
properly exclude internal ifaces in get_nic_names
Browse files Browse the repository at this point in the history
  • Loading branch information
yocalebo committed Jul 29, 2024
1 parent 6914266 commit 19e23ba
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/middlewared/middlewared/plugins/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -1922,9 +1922,9 @@ def ip_in_use(self, choices):
@private
def get_nic_names(self) -> set:
"""Get network interface names excluding internal interfaces"""
res, ignore = set(), set(self.middleware.call_sync('interface.internal_interfaces'))
res, ignore = set(), tuple(self.middleware.call_sync('interface.internal_interfaces'))
with scandir('/sys/class/net/') as nics:
for nic in filter(lambda x: x.is_symlink() and x.name not in ignore, nics):
for nic in filter(lambda x: x.is_symlink() and not x.name.startswith(ignore), nics):
res.add(nic.name)

return res
Expand Down

0 comments on commit 19e23ba

Please sign in to comment.