Skip to content

Comments

fix(test): use all IPv4 interfaces in test_disable_interface_cache#435

Open
keepsimple1 wants to merge 10 commits intomainfrom
fix-test
Open

fix(test): use all IPv4 interfaces in test_disable_interface_cache#435
keepsimple1 wants to merge 10 commits intomainfrom
fix-test

Conversation

@keepsimple1
Copy link
Owner

@keepsimple1 keepsimple1 commented Feb 19, 2026

This is to fix issue #432 .

Problem

In test_disable_interface_cache, we only disable the first IPv4 address returned. On a host with multiple IPv4 addresses, it is possible that the service record is received again via another IPv4 address (loopback enabled or even on the same subnet) and hence resolve the service instance again.

Changes

  • In the test, disable all IPv4 addresses on the host except the localhost loopback address, hence remove the cache on all IPv4 interfaces.
  • In enum IfKind, clarify the semantics of Addr(IpAddr): looks up the interface for IPv4 or IPv6, not strictly limit to a particular address.
  • Added two new variants of IfKind: IndexV4 and IndexV6. When disable_interface is called using IfKind::Addr(ipv4_addr), the result is to disable an interface just like using IndexV4(if_index).
  • If all IPv4 addresses are removed from an interface (disabled for IPv4), even the interface still in my_intfs due to IPv6, we remove all IPv4 address records in the cache under that interface.
  • Added a check in handle_read: if a IPv4 packet is received on an interface, but the interface has no IPv4 addresses, we will drop the packet.

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.

1 participant