From: Yu Watanabe Date: Wed, 24 Apr 2019 22:39:04 +0000 (+0200) Subject: network: fix ListenPort= in [WireGuard] section X-Git-Tag: v243-rc1~526^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F12382%2Fhead;p=thirdparty%2Fsystemd.git network: fix ListenPort= in [WireGuard] section This fixes a bug introduced by f1368a333e5e08575f0b45dfe41e936b106a8627. Fixes #12377. --- diff --git a/src/network/netdev/wireguard.c b/src/network/netdev/wireguard.c index f3084c0773f..5ebc5dfed84 100644 --- a/src/network/netdev/wireguard.c +++ b/src/network/netdev/wireguard.c @@ -452,22 +452,23 @@ int config_parse_wireguard_listen_port( void *userdata) { uint16_t *s = data; - uint16_t port = 0; int r; assert(rvalue); assert(data); - if (!streq(rvalue, "auto")) { - r = parse_ip_port(rvalue, s); - if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, - "Invalid port specification, ignoring assignment: %s", rvalue); - return 0; - } + if (isempty(rvalue) || streq(rvalue, "auto")) { + *s = 0; + return 0; + } + + r = parse_ip_port(rvalue, s); + if (r < 0) { + log_syntax(unit, LOG_ERR, filename, line, r, + "Invalid port specification, ignoring assignment: %s", rvalue); + return 0; } - *s = port; return 0; }