control/utils: count a labelled IPv4 address toward its device and replace netifaces with pyroute2 #2236
Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
This drops link-scoped addresses for both families, but IPv4 addresses configured with scope link (for example, a 169.254.x.x address) do not require a scope ID. Such addresses now disappear from the NIC inventory, causing listener creation with verify_listener_ip enabled to return EADDRNOTAVAIL and subnet-based auto-listeners to miss them. Restrict the scope exclusion to IPv6.
<!-- ccr-overview-v2 -->
🟡 Changes recommended
The scope filter incorrectly excludes link-scoped IPv4 addresses from NIC inventory, causing verified listener creation to fail with EADDRNOTAVAIL and subnet-based auto-listeners to miss those addresses.
<details open>
<summary><strong>1 open issue</strong></summary>
</details>
<sub>Review effort: Balanced</sub>
<!-- ccr-overview-v2 -->
🟢 Approval recommended
No active review issues are identified for the listener IP validation changes.
No open issues 🎉
<details>
<summary><strong>1 resolved since last review</strong></summary>
</details>
<sub>Review effort: Balanced</sub>
Kefu 🖖
link.get("IFLA_ADDRESS", "") is not always a string. pyroute2 0.9 types IFLA_ADDRESS as l2addr, which only decodes a 6-byte MAC. On a shorter/longer hardware addresses that decode fails and get() returns the raw netlink bytes. See here
fields = [('value', '=6s')]
Those bytes are stored as NIC.mac_address (the annotation at line 922 says str) and later used as a Prometheus label in subsystem_listener_iface_info.
Perhaps it is a good idea to normalize the raw netlink attribute get() returns when l2addr cannot decode it to string?
def _link_address(raw) -> str:
"""Return a hardware address as colon-separated hex.
pyroute2 0.9 decodes a 6-byte MAC to a string. A shorter/longer addresses
fails that decode and get() returns the netlink attribute, header included.
"""
...
nics[link["index"]] = NIC(device_name, _link_address(link.get("IFLA_ADDRESS", "")))
Approved these changes.
@baum thanks for pointing this out. indeed. added the helper to normalize the addresses to str as suggested.
<!-- ccr-overview-v2 -->
🔵 Needs a closer look
The netlink backend affects listener validation, automatic selection, and metrics, requiring privileged-container testing with pyroute2 0.9.7, including gateway worker-thread use while the fatal SIGCHLD handler is installed.
No open issues 🎉
<sub>Review effort: Balanced</sub>
<!-- ccr-overview-v2 -->
🔵 Needs a closer look
The netlink migration requires validation of the locked pyroute2 version in the unavailable Ceph/SPDK container, including gRPC-worker use and interaction with the gateway’s SIGCHLD handler.
No open issues 🎉
<sub>Review effort: Balanced</sub>
<!-- ccr-overview-v2 -->
🟢 Approval recommended
There are no active review issues for the listener IP validation change.
No open issues 🎉
<sub>Review effort: Balanced</sub>
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
@baum hello, do we need more testing before landing this PR?
@baum hello, do we need more testing before landing this PR?
@tchaikov it looks ok for merge
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
baum
tchaikov
getifaddrs()names an IPv4 address that has a label, such as one added with "ip addr add ... label eth0:vip", after the label. NICS took "eth0:vip" for a device, so verify_ip_address() read /sys/class/net/eth0:vip/operstate, found nothing and treated the address as down. With verify_listener_ip set, a listener on that address failed with EADDRNOTAVAIL.In this changeset,
1. we fold each label's addresses into the device named before the colon in label
2. switch from
netifacestopyroute2.