diff options
author | Himbeer <himbeer@disroot.org> | 2024-08-20 19:23:00 +0200 |
---|---|---|
committer | Himbeer <himbeer@disroot.org> | 2024-08-20 19:23:00 +0200 |
commit | e17b5e0037fef6c9f0de07576407bf5d28052d00 (patch) | |
tree | b576d67fe36c642f48cb9eb17fe30b435fee5133 /src | |
parent | 8adc27c63a48263a341668fd59487a549b5179e7 (diff) |
Fix link deconfiguration failing with AddrInUse
Diffstat (limited to 'src')
-rw-r--r-- | src/main.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/main.rs b/src/main.rs index bb84f02..bc60d81 100644 --- a/src/main.rs +++ b/src/main.rs @@ -93,7 +93,7 @@ fn configure_link( addr4: Ipv4Addr, addr6: Ipv6Addr, ) -> Result<()> { - unconfigure_link(connection, ifname)?; + unconfigure_link(connection, ifname, port)?; println!("[info] unconfig {}", ifname); DeviceUpdate::new() @@ -109,12 +109,12 @@ fn configure_link( Ok(()) } -fn unconfigure_link(connection: &Connection, ifname: &str) -> Result<()> { +fn unconfigure_link(connection: &Connection, ifname: &str, port: u16) -> Result<()> { connection.address_flush(String::from(ifname))?; DeviceUpdate::new() .replace_peers() - .set_listen_port(PORT) + .set_listen_port(port) .unset_fwmark() .unset_private_key() .unset_public_key() |