Commit 3dc2cef
committed
Fix UnboundLocalError for dhcp_addr in get_adapter_addresses
When a network adapter has DHCP_ENABLED and IPV6_ENABLED flags set
but not IPV4_ENABLED, the dhcp_addr variable is never assigned before
being referenced in the IPv6 check condition, causing:
UnboundLocalError: cannot access local variable 'dhcp_addr'
This occurs on cloud VMs with vDPA/SR-IOV networking where the
adapter may have IPv6 link-local addressing (DHCP enabled) but
static IPv4 configuration (no IPV4_ENABLED flag).
Fix by initializing dhcp_addr to None before the conditional
assignments.
Signed-off-by: Max Makarov <maxpain@linux.com>1 parent d63509f commit 3dc2cef
1 file changed
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
120 | 120 | | |
121 | 121 | | |
122 | 122 | | |
| 123 | + | |
123 | 124 | | |
124 | 125 | | |
125 | 126 | | |
| |||
0 commit comments