Skip to content

Old IP addresses are not removed from the interface #91

@j-chmielewski

Description

@j-chmielewski

Affected implementations: FreeBSD, userspace.

When network-address list is modified and address is deleted, wireguard-rs leaves that address on the interface instead of removing it.

Steps to reproduce:

  • Configure network with multiple addresses
  • Wait for gateway to apply the configuration
  • Remove one address from the configuration
  • Wait for gateway to apply the configuration

Expected behavior
Gateway should unassign any address that’s been removed from its configuration.

Actual behavior
The deleted address remains assigned to the interface.

Relevant code:
Linux implementation does this before adding IPs:

...
        // flush all IP addresses
        debug!(
            "Flushing all existing IP addresses from interface {} before assigning a new one",
            self.ifname
        );
        netlink::flush_interface(&self.ifname)?;
...

FreeBSD and userspace don't, and add new IP's immediately:

    fn configure_interface(
        &self,
        config: &InterfaceConfiguration,
    ) -> Result<(), WireguardInterfaceError> {
        debug!(
            "Configuring interface {} with config: {config:?}",
            self.ifname
        );

        // Assign IP address to the interface.
        for address in &config.addresses {
            self.assign_address(address)?;
        }
...

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status

    Ready to release

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions