refactor(net): centralize interface address mutations - #2243
Conversation
Introduce a typed, RTNL-protected address mutation core that commits interface addresses, connected routes, and the router compatibility projection under one smoltcp lock. Capacity failures now roll back without exposing partial state, and runtime callers can no longer bypass the centralized path. Route rtnetlink and the one-shot DHCP client through the core, preserve Linux 6.6 address identity and notification semantics, and keep construction-only initialization explicitly separated from published-interface mutations. Add focused dunitest coverage for duplicate, replace, delete, parser, invalid-address, multi-address data-plane, route ownership, and capacity rollback behavior. Signed-off-by: longjin <longjin@dragonos.org>
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1d21a52819
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Track in-kernel address leases with opaque generations so DHCP cannot delete a userspace-recreated address after a cross-event ABA. Persist Linux IFA_LABEL metadata across dumps, notifications, deletes, replaces, and interface renames, including length and empty-label semantics. Share canonical smoltcp route projections across address and rtnetlink owners, retain them until the final logical owner disappears, and isolate DHCP default-route updates from userspace defaults. Extend dunitest coverage for both owner orders, full-table rollback and sharing, alias labels, canonical prefixes, same-subnet addresses, and failed route replacement atomicity. Signed-off-by: longjin <longjin@dragonos.org>
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 36ea7c59db
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Preserve raw IFA_LABEL payloads until the address-family adapter can apply the matching Linux policy. Validate IPv4 labels before address and interface processing, retain explicit empty labels for deletion matching, and omit empty labels from rtnetlink output. Ignore IFA_LABEL for IPv6 requests and notifications as Linux does. Extend rtnetlink address semantics coverage for empty and malformed IPv4 labels, error priority, IPv6 ignored labels, and attribute presence in dumps and notifications. Signed-off-by: longjin <longjin@dragonos.org>
|
@codex review |
|
Codex Review: Didn't find any major issues. Breezy! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Part of #2233.
Summary
Architecture
Runtime mutations require an
RtnlGuardand return typed outcomes. The core owns the single lock orderRTNL -> smoltcp interface -> router projection; notifications are emitted only after a successful commit. Construction-only initialization is restricted to interfaces that have not yet been published in a network namespace.This deliberately does not introduce a second address database, a generic transaction framework, route-owner metadata, or a full DHCP lease manager.
Validation
make fmtmake kernelrtnetlink_addr_semantics_test4/4 passedrtnetlink_route_semantics_test5/5 passedrtnetlink_serialization_semantics_test2/2 passedrtnetlink_permission_semantics_test8/8 passed10.0.2.15/24