summaryrefslogtreecommitdiffstats
path: root/src/network/networkd-route-nexthop.c
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2024-01-12 07:29:11 +0100
committerYu Watanabe <watanabe.yu+github@gmail.com>2024-01-12 08:03:37 +0100
commitffad01c81e8c73c2ba0c81e2c14b7221ea08cf02 (patch)
treefe8f39f458f634eb9561546ecad0aaa75d945b40 /src/network/networkd-route-nexthop.c
parentnetwork/route-nexthop: make GatewayOnLink= support an empty string (diff)
downloadsystemd-ffad01c81e8c73c2ba0c81e2c14b7221ea08cf02.tar.xz
systemd-ffad01c81e8c73c2ba0c81e2c14b7221ea08cf02.zip
network/route-nexthop: always reset gateway address when _dhcp or friends is specified to Gateway=
Just for safety.
Diffstat (limited to '')
-rw-r--r--src/network/networkd-route-nexthop.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/network/networkd-route-nexthop.c b/src/network/networkd-route-nexthop.c
index c1b191b3ef..f1d81f2014 100644
--- a/src/network/networkd-route-nexthop.c
+++ b/src/network/networkd-route-nexthop.c
@@ -62,20 +62,24 @@ int config_parse_gateway(
if (streq(rvalue, "_dhcp")) {
route->gateway_from_dhcp_or_ra = true;
+ route->gw_family = AF_UNSPEC;
+ route->gw = IN_ADDR_NULL;
TAKE_PTR(route);
return 0;
}
if (streq(rvalue, "_dhcp4")) {
- route->gw_family = AF_INET;
route->gateway_from_dhcp_or_ra = true;
+ route->gw_family = AF_INET;
+ route->gw = IN_ADDR_NULL;
TAKE_PTR(route);
return 0;
}
if (streq(rvalue, "_ipv6ra")) {
- route->gw_family = AF_INET6;
route->gateway_from_dhcp_or_ra = true;
+ route->gw_family = AF_INET6;
+ route->gw = IN_ADDR_NULL;
TAKE_PTR(route);
return 0;
}