dhcp: don't re-read DHCP client ID from configuration file for dhclient

Why would we do this? The configuration file we are reading back was
written by NetworkManager in the first place.

Maybe when assuming a connection after restart, this information could
be interesting. It however is not actually relevant.

Note how nm_dhcp_client_get_client_id() has only very few callers.

  - nm_device_spawn_iface_helper() in 'nm-device.c'. In this case,
    we either should use the client-id which we used when starting
    DHCP, or none at all.

  - ip4_start() in 'nm-dhcp-dhclient.c', but this is before starting
    DHCP client and before it was re-read from configuration file.

  - in "src/dhcp/nm-dhcp-systemd.c", but this has no effect for
    the dhclient plugin.

(cherry picked from commit 5411fb0cc6)
This commit is contained in:
Thomas Haller 2018-10-24 15:16:35 +02:00
parent 3b8d882658
commit a6095fd043
4 changed files with 2 additions and 40 deletions

View file

@ -1066,7 +1066,7 @@ nm_dhcp_client_class_init (NMDhcpClientClass *client_class)
g_signal_new (NM_DHCP_CLIENT_SIGNAL_STATE_CHANGED,
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (NMDhcpClientClass, state_changed),
0,
NULL, NULL, NULL,
G_TYPE_NONE, 4, G_TYPE_UINT, G_TYPE_OBJECT, G_TYPE_HASH_TABLE, G_TYPE_STRING);
@ -1074,7 +1074,7 @@ nm_dhcp_client_class_init (NMDhcpClientClass *client_class)
g_signal_new (NM_DHCP_CLIENT_SIGNAL_PREFIX_DELEGATED,
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (NMDhcpClientClass, state_changed),
0,
NULL, NULL, NULL,
G_TYPE_NONE, 1, G_TYPE_POINTER);
}

View file

@ -103,12 +103,6 @@ typedef struct {
* returned.
*/
GBytes *(*get_duid) (NMDhcpClient *self);
/* Signals */
void (*state_changed) (NMDhcpClient *self,
NMDhcpState state,
GObject *ip_config,
GHashTable *options);
} NMDhcpClientClass;
GType nm_dhcp_client_get_type (void);

View file

@ -624,24 +624,6 @@ stop (NMDhcpClient *client, gboolean release, GBytes *duid)
}
}
static void
state_changed (NMDhcpClient *client,
NMDhcpState state,
GObject *ip_config,
GHashTable *options)
{
NMDhcpDhclientPrivate *priv = NM_DHCP_DHCLIENT_GET_PRIVATE ((NMDhcpDhclient *) client);
gs_unref_bytes GBytes *client_id = NULL;
if (nm_dhcp_client_get_client_id (client))
return;
if (state != NM_DHCP_STATE_BOUND)
return;
client_id = nm_dhcp_dhclient_get_client_id_from_config_file (priv->conf_file);
nm_dhcp_client_set_client_id (client, client_id);
}
static GBytes *
get_duid (NMDhcpClient *client)
{
@ -742,7 +724,6 @@ nm_dhcp_dhclient_class_init (NMDhcpDhclientClass *dhclient_class)
client_class->ip6_start = ip6_start;
client_class->stop = stop;
client_class->get_duid = get_duid;
client_class->state_changed = state_changed;
}
const NMDhcpClientFactory _nm_dhcp_client_factory_dhclient = {

View file

@ -216,18 +216,6 @@ stop (NMDhcpClient *client, gboolean release, GBytes *duid)
}
}
static void
state_changed (NMDhcpClient *client,
NMDhcpState state,
GObject *ip_config,
GHashTable *options)
{
if (nm_dhcp_client_get_client_id (client))
return;
if (state != NM_DHCP_STATE_BOUND)
return;
}
/*****************************************************************************/
static void
@ -270,7 +258,6 @@ nm_dhcp_dhcpcanon_class_init (NMDhcpDhcpcanonClass *dhcpcanon_class)
client_class->ip4_start = ip4_start;
client_class->ip6_start = ip6_start;
client_class->stop = stop;
client_class->state_changed = state_changed;
}
const NMDhcpClientFactory _nm_dhcp_client_factory_dhcpcanon = {