mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager
synced 2024-09-06 17:14:02 +00:00
dhcp: store the device type for logging
Arguably, a kernel link is needed for DHCP and so the interface name univocally identifies a device (for example, the OVS interface). But for consistency and clarity, store the device type to be used for logging.
This commit is contained in:
parent
749ebef0d9
commit
cb423ae7ac
|
@ -10676,6 +10676,7 @@ _dev_ipdhcpx_start(NMDevice *self, int addr_family)
|
|||
.addr_family = AF_INET,
|
||||
.l3cfg = nm_device_get_l3cfg(self),
|
||||
.iface = nm_device_get_ip_iface(self),
|
||||
.iface_type_log = nm_device_get_type_desc_for_log(self),
|
||||
.uuid = nm_connection_get_uuid(connection),
|
||||
.hwaddr = hwaddr,
|
||||
.bcast_hwaddr = bcast_hwaddr,
|
||||
|
@ -10713,6 +10714,7 @@ _dev_ipdhcpx_start(NMDevice *self, int addr_family)
|
|||
.addr_family = AF_INET6,
|
||||
.l3cfg = nm_device_get_l3cfg(self),
|
||||
.iface = nm_device_get_ip_iface(self),
|
||||
.iface_type_log = nm_device_get_type_desc_for_log(self),
|
||||
.uuid = nm_connection_get_uuid(connection),
|
||||
.send_hostname = nm_setting_ip_config_get_dhcp_send_hostname(s_ip),
|
||||
.hostname = nm_setting_ip_config_get_dhcp_hostname(s_ip),
|
||||
|
|
|
@ -196,6 +196,14 @@ nm_dhcp_client_get_iface(NMDhcpClient *self)
|
|||
return priv->config.iface;
|
||||
}
|
||||
|
||||
const char *
|
||||
nm_dhcp_client_get_iface_type_for_log(NMDhcpClient *self)
|
||||
{
|
||||
NMDhcpClientPrivate *priv = NM_DHCP_CLIENT_GET_PRIVATE(self);
|
||||
|
||||
return priv->config.iface_type_log;
|
||||
}
|
||||
|
||||
NMDedupMultiIndex *
|
||||
nm_dhcp_client_get_multi_idx(NMDhcpClient *self)
|
||||
{
|
||||
|
@ -1823,6 +1831,7 @@ config_init(NMDhcpClientConfig *config, const NMDhcpClientConfig *src)
|
|||
nm_g_bytes_ref(config->client_id);
|
||||
|
||||
config->iface = g_strdup(config->iface);
|
||||
config->iface_type_log = g_strdup(config->iface_type_log);
|
||||
config->uuid = g_strdup(config->uuid);
|
||||
config->anycast_address = g_strdup(config->anycast_address);
|
||||
config->hostname = g_strdup(config->hostname);
|
||||
|
@ -1885,6 +1894,7 @@ config_clear(NMDhcpClientConfig *config)
|
|||
nm_clear_pointer(&config->client_id, g_bytes_unref);
|
||||
|
||||
nm_clear_g_free((gpointer *) &config->iface);
|
||||
nm_clear_g_free((gpointer *) &config->iface_type_log);
|
||||
nm_clear_g_free((gpointer *) &config->uuid);
|
||||
nm_clear_g_free((gpointer *) &config->anycast_address);
|
||||
nm_clear_g_free((gpointer *) &config->hostname);
|
||||
|
|
|
@ -103,6 +103,10 @@ typedef struct {
|
|||
|
||||
const char *iface;
|
||||
|
||||
/* Interface type for logging; only set for some devices whose names can be
|
||||
* ambiguous. */
|
||||
const char *iface_type_log;
|
||||
|
||||
/* The hardware address */
|
||||
GBytes *hwaddr;
|
||||
|
||||
|
@ -264,6 +268,7 @@ gboolean nm_dhcp_client_server_id_is_rejected(NMDhcpClient *self, gconstpointer
|
|||
|
||||
int nm_dhcp_client_get_addr_family(NMDhcpClient *self);
|
||||
const char *nm_dhcp_client_get_iface(NMDhcpClient *self);
|
||||
const char *nm_dhcp_client_get_iface_type_for_log(NMDhcpClient *self);
|
||||
NMDedupMultiIndex *nm_dhcp_client_get_multi_idx(NMDhcpClient *self);
|
||||
int nm_dhcp_client_get_ifindex(NMDhcpClient *self);
|
||||
|
||||
|
|
Loading…
Reference in a new issue