Skip to content

net: Ensure deterministic interface enumeration order#12967

Open
copybara-service[bot] wants to merge 1 commit intomasterfrom
test/cl900761342
Open

net: Ensure deterministic interface enumeration order#12967
copybara-service[bot] wants to merge 1 commit intomasterfrom
test/cl900761342

Conversation

@copybara-service
Copy link
Copy Markdown

@copybara-service copybara-service Bot commented Apr 17, 2026

net: Ensure deterministic interface enumeration order

Go map iteration randomness causes network interface enumeration (getifaddrs, RTM_GETADDR, RTM_GETLINK, /proc/net/*, SIOCGIFCONF) to return nondeterministic order, breaking applications like asciidoctor that expect stable ordering across repeated calls.

Since gVisor allocates NIC IDs monotonically (like Linux ifindex), sorting by NICID is equivalent to registration order. Add InterfaceIDs() to inet.Stack so all consumer paths iterate in deterministic ascending-ID order without ad-hoc sorting at each call site.

FUTURE_COPYBARA_INTEGRATE_REVIEW=#12949 from tanyifeng:net-interface-order 4594355

@copybara-service copybara-service Bot added the exported Issue was exported automatically label Apr 17, 2026
@copybara-service copybara-service Bot force-pushed the test/cl900761342 branch 9 times, most recently from 54e38d8 to bd932a0 Compare April 23, 2026 18:22
Go map iteration randomness causes network interface enumeration (getifaddrs, RTM_GETADDR, RTM_GETLINK, /proc/net/*, SIOCGIFCONF) to return nondeterministic order, breaking applications like asciidoctor that expect stable ordering across repeated calls.

Since gVisor allocates NIC IDs monotonically (like Linux ifindex), sorting by NICID is equivalent to registration order. Add InterfaceIDs() to inet.Stack so all consumer paths iterate in deterministic ascending-ID order without ad-hoc sorting at each call site.

FUTURE_COPYBARA_INTEGRATE_REVIEW=#12949 from tanyifeng:net-interface-order 4594355
PiperOrigin-RevId: 900761342
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

exported Issue was exported automatically

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant