diff --git a/src/dhcp/nm-dhcp-nettools.c b/src/dhcp/nm-dhcp-nettools.c index 7b4e4605d8..3d51addc14 100644 --- a/src/dhcp/nm-dhcp-nettools.c +++ b/src/dhcp/nm-dhcp-nettools.c @@ -518,6 +518,38 @@ lease_parse_address_list(NDhcp4ClientLease * lease, nm_dhcp_option_add_option(options, _nm_dhcp_option_dhcp4_options, option, str->str); } +static void +lease_parse_server_id(NDhcp4ClientLease *lease, NMIP4Config *ip4_config, GHashTable *options) +{ + struct in_addr addr; + char addr_str[NM_UTILS_INET_ADDRSTRLEN]; + + if (n_dhcp4_client_lease_get_server_identifier(lease, &addr)) + return; + + _nm_utils_inet4_ntop(addr.s_addr, addr_str); + nm_dhcp_option_add_option(options, + _nm_dhcp_option_dhcp4_options, + NM_DHCP_OPTION_DHCP4_SERVER_ID, + addr_str); +} + +static void +lease_parse_broadcast(NDhcp4ClientLease *lease, NMIP4Config *ip4_config, GHashTable *options) +{ + struct in_addr addr; + char addr_str[NM_UTILS_INET_ADDRSTRLEN]; + + if (!lease_get_in_addr(lease, NM_DHCP_OPTION_DHCP4_BROADCAST, &addr)) + return; + + _nm_utils_inet4_ntop(addr.s_addr, addr_str); + nm_dhcp_option_add_option(options, + _nm_dhcp_option_dhcp4_options, + NM_DHCP_OPTION_DHCP4_BROADCAST, + addr_str); +} + static void lease_parse_routes(NDhcp4ClientLease *lease, NMIP4Config * ip4_config, @@ -976,6 +1008,8 @@ lease_to_ip4_config(NMDedupMultiIndex *multi_idx, if (!lease_parse_address(lease, ip4_config, options, error)) return NULL; + lease_parse_server_id(lease, ip4_config, options); + lease_parse_broadcast(lease, ip4_config, options); lease_parse_routes(lease, ip4_config, options, route_table, route_metric); lease_parse_address_list(lease, ip4_config, NM_DHCP_OPTION_DHCP4_DOMAIN_NAME_SERVER, options); lease_parse_domainname(lease, ip4_config, options);