network: fix ListenPort= in [WireGuard] section

This fixes a bug introduced by f1368a333e.

Fixes #12377.
This commit is contained in:
Yu Watanabe 2019-04-25 00:39:04 +02:00
parent 06895a1dda
commit a62b7bb79e

View file

@ -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;
}