mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-24 19:30:07 +01:00
dhcp/nettools: refactor parsing of DHCP lease (root-path)
This commit is contained in:
parent
eb16cb6563
commit
f2885cdf02
1 changed files with 8 additions and 20 deletions
|
|
@ -805,25 +805,6 @@ lease_parse_search_domains(NDhcp4ClientLease *lease, NMIP4Config *ip4_config, GH
|
|||
str->str);
|
||||
}
|
||||
|
||||
static void
|
||||
lease_parse_root_path(NDhcp4ClientLease *lease, GHashTable *options)
|
||||
{
|
||||
nm_auto_free_gstring GString *str = NULL;
|
||||
uint8_t * data;
|
||||
size_t n_data;
|
||||
int r;
|
||||
|
||||
r = n_dhcp4_client_lease_query(lease, NM_DHCP_OPTION_DHCP4_ROOT_PATH, &data, &n_data);
|
||||
if (r)
|
||||
return;
|
||||
|
||||
str = g_string_new_len((char *) data, n_data);
|
||||
nm_dhcp_option_add_option(options,
|
||||
_nm_dhcp_option_dhcp4_options,
|
||||
NM_DHCP_OPTION_DHCP4_ROOT_PATH,
|
||||
str->str);
|
||||
}
|
||||
|
||||
static void
|
||||
lease_parse_nis_domain(NDhcp4ClientLease *lease, NMIP4Config *ip4_config, GHashTable *options)
|
||||
{
|
||||
|
|
@ -945,7 +926,14 @@ lease_to_ip4_config(NMDedupMultiIndex *multi_idx,
|
|||
}
|
||||
|
||||
lease_parse_ntps(lease, options);
|
||||
lease_parse_root_path(lease, options);
|
||||
|
||||
r = n_dhcp4_client_lease_query(lease, NM_DHCP_OPTION_DHCP4_ROOT_PATH, &l_data, &l_data_len);
|
||||
if (r == 0) {
|
||||
nm_dhcp_option_add_option(options,
|
||||
_nm_dhcp_option_dhcp4_options,
|
||||
NM_DHCP_OPTION_DHCP4_ROOT_PATH,
|
||||
g_strndup((char *) l_data, l_data_len));
|
||||
}
|
||||
|
||||
r = n_dhcp4_client_lease_query(lease,
|
||||
NM_DHCP_OPTION_DHCP4_PRIVATE_PROXY_AUTODISCOVERY,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue