mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-06-21 15:48:34 +02:00
systemd: add siaddr to lease options
This is so that we end up with a next-server option analogous to what
dhclient helper sends us. Dracut uses this for networked boots.
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/329
(cherry picked from commit e475ac7567)
This commit is contained in:
parent
e1acd336bb
commit
68841b76a6
3 changed files with 11 additions and 0 deletions
|
|
@ -180,6 +180,7 @@ const NMDhcpOption _nm_dhcp_option_dhcp4_options[] = {
|
|||
/* Internal values */
|
||||
REQ (NM_DHCP_OPTION_DHCP4_NM_IP_ADDRESS, "ip_address", FALSE ),
|
||||
REQ (NM_DHCP_OPTION_DHCP4_NM_EXPIRY, "expiry", FALSE ),
|
||||
REQ (NM_DHCP_OPTION_DHCP4_NM_NEXT_SERVER, "next_server", FALSE ),
|
||||
|
||||
{ 0 }
|
||||
};
|
||||
|
|
|
|||
|
|
@ -164,6 +164,7 @@ typedef enum {
|
|||
/* Internal values */
|
||||
NM_DHCP_OPTION_DHCP4_NM_IP_ADDRESS = 1024,
|
||||
NM_DHCP_OPTION_DHCP4_NM_EXPIRY = 1025,
|
||||
NM_DHCP_OPTION_DHCP4_NM_NEXT_SERVER = 1026,
|
||||
} NMDhcpOptionDhcp4Options;
|
||||
|
||||
typedef enum {
|
||||
|
|
|
|||
|
|
@ -119,6 +119,7 @@ lease_to_ip4_config (NMDedupMultiIndex *multi_idx,
|
|||
gint64 ts_time = time (NULL);
|
||||
struct in_addr a_address;
|
||||
struct in_addr a_netmask;
|
||||
struct in_addr a_next_server;
|
||||
struct in_addr server_id;
|
||||
struct in_addr broadcast;
|
||||
const struct in_addr *a_router;
|
||||
|
|
@ -178,6 +179,14 @@ lease_to_ip4_config (NMDedupMultiIndex *multi_idx,
|
|||
NM_DHCP_OPTION_DHCP4_NM_EXPIRY,
|
||||
(guint64) (ts_time + a_lifetime));
|
||||
|
||||
if (sd_dhcp_lease_get_next_server (lease, &a_next_server) == 0) {
|
||||
nm_utils_inet4_ntop (a_next_server.s_addr, addr_str);
|
||||
nm_dhcp_option_add_option (options,
|
||||
_nm_dhcp_option_dhcp4_options,
|
||||
NM_DHCP_OPTION_DHCP4_NM_NEXT_SERVER,
|
||||
addr_str);
|
||||
}
|
||||
|
||||
nm_ip4_config_add_address (ip4_config,
|
||||
&((const NMPlatformIP4Address) {
|
||||
.address = a_address.s_addr,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue