mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-03-01 03:20:34 +01:00
dhcp: minor cleanup in config_init()
(cherry picked from commit 600467b96f)
This commit is contained in:
parent
38b8fdb75c
commit
97241b277a
1 changed files with 16 additions and 12 deletions
|
|
@ -1039,21 +1039,25 @@ nm_dhcp_client_server_id_is_rejected(NMDhcpClient *self, gconstpointer addr)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static void
|
||||
config_init(NMDhcpClientConfig *config, const NMDhcpClientConfig *src)
|
||||
{
|
||||
nm_assert(config);
|
||||
nm_assert(src);
|
||||
nm_assert(config != src);
|
||||
|
||||
*config = *src;
|
||||
|
||||
/* We must not return before un-aliasing all pointers in @config! */
|
||||
|
||||
g_object_ref(config->l3cfg);
|
||||
|
||||
if (config->hwaddr)
|
||||
g_bytes_ref(config->hwaddr);
|
||||
if (config->bcast_hwaddr)
|
||||
g_bytes_ref(config->bcast_hwaddr);
|
||||
if (config->vendor_class_identifier)
|
||||
g_bytes_ref(config->vendor_class_identifier);
|
||||
if (config->client_id)
|
||||
g_bytes_ref(config->client_id);
|
||||
nm_g_bytes_ref(config->hwaddr);
|
||||
nm_g_bytes_ref(config->bcast_hwaddr);
|
||||
nm_g_bytes_ref(config->vendor_class_identifier);
|
||||
nm_g_bytes_ref(config->client_id);
|
||||
|
||||
config->iface = g_strdup(config->iface);
|
||||
config->uuid = g_strdup(config->uuid);
|
||||
|
|
@ -1063,14 +1067,12 @@ config_init(NMDhcpClientConfig *config, const NMDhcpClientConfig *src)
|
|||
|
||||
config->reject_servers = (const char *const *) nm_strv_dup(config->reject_servers, -1, TRUE);
|
||||
|
||||
if (config->addr_family == AF_INET) {
|
||||
if (NM_IS_IPv4(config->addr_family))
|
||||
config->v4.last_address = g_strdup(config->v4.last_address);
|
||||
} else if (config->addr_family == AF_INET6) {
|
||||
else {
|
||||
config->hwaddr = NULL;
|
||||
config->bcast_hwaddr = NULL;
|
||||
config->use_fqdn = TRUE;
|
||||
} else {
|
||||
nm_assert_not_reached();
|
||||
}
|
||||
|
||||
if (!config->hostname && config->send_hostname) {
|
||||
|
|
@ -1130,6 +1132,8 @@ config_clear(NMDhcpClientConfig *config)
|
|||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
int
|
||||
nm_dhcp_client_get_addr_family(NMDhcpClient *self)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue