Files
openwrt/package/network
Guy Godfroy ecd9120f04 wireguard-tools: contain a refused peer value to its line
wg's config parser refuses the whole configuration for one bad value,
so since the ucode rewrite a peer section holding one value the parser
refuses (an endpoint hostname that does not resolve, a malformed
preshared key, a keepalive that is not a number) takes the whole
interface down, and netifd's retry keeps it down until the section is
fixed (#24511).

This checks each peer value against wg's own grammar while the
configuration is built, and a refused one costs its line instead of the
tunnel: an endpoint that does not resolve omits its Endpoint= line (the
peer stays installed and reachable inbound, and wg fills the endpoint in
from the first authenticated handshake, as the watchdog already relies
on), a malformed preshared key or a keepalive that is neither 0-65535
nor off omits its line, and a public_key that is not a WireGuard key
skips the peer. Every refusal is logged with the interface, the peer's
uci section and public key, and the refused value, so the operator can
find the offending section; a peer section without a public_key is
skipped and logged too. The preshared key warning stays valueless,
because a key is a secret. The happy path is unchanged: one atomic
syncconf, peer removals included. PKG_RELEASE is bumped so users on
main receive it.

Reviewer questions, answered:
- a malformed PresharedKey omits its line only, the peer keeps running
  without it, an optional value fails open on its line rather than
  closed on the peer;
- AllowedIPs entries stay unvalidated here, wg remains the judge,
  because a false omission would cost routes;
- endpoint names resolve through nslookup at each setup, ucode has no
  getaddrinfo and wg set cannot run from the handler without touching
  the live interface.

Fixes #24511.

Assisted-by: OpenCode:mistral-large-4-0
Signed-off-by: Guy Godfroy <guy.godfroy@gugod.fr>
Link: https://github.com/openwrt/openwrt/pull/26543
Signed-off-by: Robert Marko <robimarko@gmail.com>
2026-11-18 19:30:19 +01:00
..