Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NAS-130314 / 24.10 / properly exclude internal ifaces in get_nic_names #14101

Merged
merged 1 commit into from
Jul 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading