[client] Don't overwrite allowed IPs when updating the wg peer's endpoint address (#2578)

This will fix broken routes on routing clients when upgrading/downgrading from/to relayed connections.
This commit is contained in:
Viktor Liu 2024-09-11 16:05:13 +02:00 committed by GitHub
parent f43a0a0177
commit 50ebbe482e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 4 deletions

View File

@ -57,7 +57,8 @@ func (c *wgKernelConfigurer) updatePeer(peerKey string, allowedIps string, keepA
}
peer := wgtypes.PeerConfig{
PublicKey: peerKeyParsed,
ReplaceAllowedIPs: true,
ReplaceAllowedIPs: false,
// don't replace allowed ips, wg will handle duplicated peer IP
AllowedIPs: []net.IPNet{*ipNet},
PersistentKeepaliveInterval: &keepAlive,
Endpoint: endpoint,

View File

@ -65,7 +65,8 @@ func (c *wgUSPConfigurer) updatePeer(peerKey string, allowedIps string, keepAliv
}
peer := wgtypes.PeerConfig{
PublicKey: peerKeyParsed,
ReplaceAllowedIPs: true,
ReplaceAllowedIPs: false,
// don't replace allowed ips, wg will handle duplicated peer IP
AllowedIPs: []net.IPNet{*ipNet},
PersistentKeepaliveInterval: &keepAlive,
PresharedKey: preSharedKey,