summaryrefslogtreecommitdiff
path: root/src/libsystemd-network
diff options
context:
space:
mode:
authorSusant Sahani <145210+ssahani@users.noreply.github.com>2018-01-20 05:12:45 +0530
committerYu Watanabe <watanabe.yu+github@gmail.com>2018-01-20 08:42:45 +0900
commit8cdc46e7bad6bb8b1fd34b5ad9d95894e0b6b4eb (patch)
treec2df7884a6283c32c29e8d1aa0b76e941fe2a040 /src/libsystemd-network
parentc3de717e5121167fd9e744e0712dbd09d79233bc (diff)
downloadsystemd-8cdc46e7bad6bb8b1fd34b5ad9d95894e0b6b4eb.tar.gz
networkd: ignore Static Routes option when Classless Static Routes is given (#7807)
When the DHCP server returns both a Classless Static Routes option and a Static Routes option, the DHCP client MUST ignore the Static Routes option. Closes #7792
Diffstat (limited to 'src/libsystemd-network')
-rw-r--r--src/libsystemd-network/dhcp-lease-internal.h2
-rw-r--r--src/libsystemd-network/sd-dhcp-lease.c2
2 files changed, 4 insertions, 0 deletions
diff --git a/src/libsystemd-network/dhcp-lease-internal.h b/src/libsystemd-network/dhcp-lease-internal.h
index ac5cc47efd..65c182f48b 100644
--- a/src/libsystemd-network/dhcp-lease-internal.h
+++ b/src/libsystemd-network/dhcp-lease-internal.h
@@ -34,6 +34,8 @@ struct sd_dhcp_route {
struct in_addr dst_addr;
struct in_addr gw_addr;
unsigned char dst_prefixlen;
+
+ uint8_t option;
};
struct sd_dhcp_raw_option {
diff --git a/src/libsystemd-network/sd-dhcp-lease.c b/src/libsystemd-network/sd-dhcp-lease.c
index 78b8e058b4..2e88e39878 100644
--- a/src/libsystemd-network/sd-dhcp-lease.c
+++ b/src/libsystemd-network/sd-dhcp-lease.c
@@ -471,6 +471,7 @@ static int lease_parse_routes(
struct sd_dhcp_route *route = *routes + *routes_size;
int r;
+ route->option = SD_DHCP_OPTION_STATIC_ROUTE;
r = in4_addr_default_prefixlen((struct in_addr*) option, &route->dst_prefixlen);
if (r < 0) {
log_debug("Failed to determine destination prefix length from class based IP, ignoring");
@@ -514,6 +515,7 @@ static int lease_parse_classless_routes(
return -ENOMEM;
route = *routes + *routes_size;
+ route->option = SD_DHCP_OPTION_CLASSLESS_STATIC_ROUTE;
dst_octets = (*option == 0 ? 0 : ((*option - 1) / 8) + 1);
route->dst_prefixlen = *option;