diff options
-rw-r--r-- | src/core/dhcp/nm-dhcp-nettools.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/core/dhcp/nm-dhcp-nettools.c b/src/core/dhcp/nm-dhcp-nettools.c index d1451a5319..ae1aeadfa4 100644 --- a/src/core/dhcp/nm-dhcp-nettools.c +++ b/src/core/dhcp/nm-dhcp-nettools.c @@ -517,6 +517,38 @@ lease_parse_address_list(NDhcp4ClientLease * lease, } 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, GHashTable * options, @@ -974,6 +1006,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); |