diff options
author | Thomas Haller <thaller@redhat.com> | 2018-12-14 11:10:57 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2019-02-18 13:34:22 +0100 |
commit | f8862395e8f802e4106a07ceaaf02b6a1faa5a6d (patch) | |
tree | 74cf06148c05d2a59c7571c726fcbc41a3e8cfeb /src/libsystemd-network/dhcp-lease-internal.h | |
parent | c24b68216222156a45c5a8a918e7a44c144e9555 (diff) | |
download | systemd-f8862395e8f802e4106a07ceaaf02b6a1faa5a6d.tar.gz systemd-f8862395e8f802e4106a07ceaaf02b6a1faa5a6d.tar.bz2 systemd-f8862395e8f802e4106a07ceaaf02b6a1faa5a6d.zip |
dhcp: handle multiple addresses for "Router" (option 3) in DHCP library
The Router DHCP option may contain a list of one or more
routers ([1]). Extend the API of sd_dhcp_lease to return a
list instead of only the first.
Note that networkd still only uses the first router (if present).
Aside from extending the internal API of the DHCP client, there
is almost no change in behavior. The only visible difference in
behavior is that the "ROUTER" variable in the lease file is now a
list of addresses.
Note how RFC 2132 does not define certain IP addresses as invalid for the
router option. Still, previously sd_dhcp_lease_get_router() would never
return a "0.0.0.0" address. In fact, the previous API could not
differenciate whether no router option was present, whether it
was invalid, or whether its first router was "0.0.0.0". No longer let
the DHCP client library impose additional restrictions that are not
part of RFC. Instead, the caller should handle this. The patch does
that, and networkd only consideres the first router entry if it is not
"0.0.0.0".
[1] https://tools.ietf.org/html/rfc2132#section-3.5
Diffstat (limited to 'src/libsystemd-network/dhcp-lease-internal.h')
-rw-r--r-- | src/libsystemd-network/dhcp-lease-internal.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/libsystemd-network/dhcp-lease-internal.h b/src/libsystemd-network/dhcp-lease-internal.h index 9d245a9059..122042ab58 100644 --- a/src/libsystemd-network/dhcp-lease-internal.h +++ b/src/libsystemd-network/dhcp-lease-internal.h @@ -41,7 +41,6 @@ struct sd_dhcp_lease { /* each 0 if unset */ be32_t address; be32_t server_address; - be32_t router; be32_t next_server; bool have_subnet_mask; @@ -50,6 +49,9 @@ struct sd_dhcp_lease { bool have_broadcast; be32_t broadcast; + struct in_addr *router; + size_t router_size; + struct in_addr *dns; size_t dns_size; |