Commit Graph
1 Commits
Author SHA1 Message Date
unixroandGitHub c4cbbdb51b fix: addPeers uses OverridePeerSettings for DNS and AllowedIPs fallback (#1310)
* fix: addPeers uses OverridePeerSettings for DNS and AllowedIPs fallback

When adding a peer via the API without explicit DNS or endpoint_allowed_ip
values, the endpoint fell back directly to global wg-dashboard.ini defaults,
ignoring any per-configuration OverridePeerSettings. This caused new peers to
be stored with the wrong DNS and AllowedIPs in the database even when the
configuration had overrides set.

Resolve by fetching the configuration's OverridePeerSettings before the global
defaults. The priority is now: request body → OverridePeerSettings → global
default. The existing config lookup that happened later in the function is
removed as it is now done earlier.

Note: downloadPeer already applied OverridePeerSettings at download time, so
client configs were correct; only the stored peer data was affected.

* fix: addPeers applies OverridePeerSettings for MTU and PersistentKeepalive

Extend the peer-settings priority chain (request body → OverridePeerSettings
→ global default) to MTU and PersistentKeepalive, matching the same pattern
already applied to DNS and EndpointAllowedIPs.

* style: align addPeers OverridePeerSettings fallback with project code style
2026-10-28 15:01:12 +01:00