Skip to content

holo-interface: restore IP addresses after interface state changes#104

Open
Shbinging wants to merge 1 commit into
holo-routing:masterfrom
Shbinging:fix_ip_address_restore_bug
Open

holo-interface: restore IP addresses after interface state changes#104
Shbinging wants to merge 1 commit into
holo-routing:masterfrom
Shbinging:fix_ip_address_restore_bug

Conversation

@Shbinging

Copy link
Copy Markdown
Contributor

Fix two bugs that caused configured IP addresses to not be restored when interface state changes:

  1. Interface delete/add (RTM_DELLINK -> RTM_NEWLINK):
    • Clear ifindex in remove() when Owner::SYSTEM is removed
    • Update ifindex_tree correctly when interface reappears
  2. Interface down/up (without RTM_DELLINK):
    • Check configured addresses against system addresses on every RTM_NEWLINK, before the early return check
    • Reinstall any missing configured addresses The root cause was that holo-interface relied on ifindex.is_none() to trigger address installation, but this condition was not met in scenarios where addresses were removed by the kernel without the interface being deleted.

@Shbinging

Copy link
Copy Markdown
Contributor Author

CLOSES #105

Fix two bugs that caused configured IP addresses to not be restored
when interface state changes:
1. Interface delete/add (RTM_DELLINK -> RTM_NEWLINK):
   - Clear ifindex in remove() when Owner::SYSTEM is removed
   - Update ifindex_tree correctly when interface reappears
2. Interface down/up (without RTM_DELLINK):
   - Check configured addresses against system addresses on every
     RTM_NEWLINK, before the early return check
   - Reinstall any missing configured addresses
The root cause was that holo-interface relied on ifindex.is_none()
to trigger address installation, but this condition was not met in
scenarios where addresses were removed by the kernel without the
interface being deleted.

Signed-off-by: Bing Shui <bingshui@smail.nju.edu.cn>
@Shbinging Shbinging force-pushed the fix_ip_address_restore_bug branch from d69e9f6 to 6c4139c Compare January 6, 2026 10:19
Comment thread holo-interface/src/interface.rs Outdated
iface.ifindex = Some(ifindex);

let iface = &self.arena[iface_idx];
iface.apply_config(ifindex, netlink_tx, self);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why remove iface.apply_config() from here? We definitely want to apply pre-existing MTU, admin status and VLAN config to newly created interfaces.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants