diff options
| author | Iain Lane <iain.lane@canonical.com> | 2018-10-03 09:30:23 +0100 |
|---|---|---|
| committer | Iain Lane <iain.lane@canonical.com> | 2018-10-03 09:33:16 +0100 |
| commit | 898733d427e7b640bab0ea0fa578b3224102fde2 (patch) | |
| tree | 91c16e4d9d2c363858d1c9ea8a937e0f2c25373a /src/dhcp | |
| parent | 9ba7891e6e49755ef4f3c9e3ef424a9ef06cf58c (diff) | |
| parent | eca0cfe89a2a7ec88abe9c03075160f46b338137 (diff) | |
Merge tag 'debian/1.12.4-1' into cosmic
network-manager Debian release 1.12.4-1
Diffstat (limited to 'src/dhcp')
| -rw-r--r-- | src/dhcp/nm-dhcp-client.c | 33 | ||||
| -rw-r--r-- | src/dhcp/nm-dhcp-client.h | 4 | ||||
| -rw-r--r-- | src/dhcp/nm-dhcp-dhclient.c | 8 |
3 files changed, 38 insertions, 7 deletions
diff --git a/src/dhcp/nm-dhcp-client.c b/src/dhcp/nm-dhcp-client.c index 360bd367..e53c8d87 100644 --- a/src/dhcp/nm-dhcp-client.c +++ b/src/dhcp/nm-dhcp-client.c @@ -51,7 +51,7 @@ enum { static guint signals[LAST_SIGNAL] = { 0 }; -NM_GOBJECT_PROPERTIES_DEFINE_BASE ( +NM_GOBJECT_PROPERTIES_DEFINE (NMDhcpClient, PROP_ADDR_FAMILY, PROP_FLAGS, PROP_HWADDR, @@ -163,6 +163,17 @@ nm_dhcp_client_get_route_table (NMDhcpClient *self) return NM_DHCP_CLIENT_GET_PRIVATE (self)->route_table; } +void +nm_dhcp_client_set_route_table (NMDhcpClient *self, guint32 route_table) +{ + NMDhcpClientPrivate *priv = NM_DHCP_CLIENT_GET_PRIVATE (self); + + if (route_table != priv->route_table) { + priv->route_table = route_table; + _notify (self, PROP_ROUTE_TABLE); + } +} + guint32 nm_dhcp_client_get_route_metric (NMDhcpClient *self) { @@ -171,6 +182,17 @@ nm_dhcp_client_get_route_metric (NMDhcpClient *self) return NM_DHCP_CLIENT_GET_PRIVATE (self)->route_metric; } +void +nm_dhcp_client_set_route_metric (NMDhcpClient *self, guint32 route_metric) +{ + NMDhcpClientPrivate *priv = NM_DHCP_CLIENT_GET_PRIVATE (self); + + if (route_metric != priv->route_metric) { + priv->route_metric = route_metric; + _notify (self, PROP_ROUTE_METRIC); + } +} + guint32 nm_dhcp_client_get_timeout (NMDhcpClient *self) { @@ -834,6 +856,9 @@ get_property (GObject *object, guint prop_id, case PROP_ROUTE_METRIC: g_value_set_uint (value, priv->route_metric); break; + case PROP_ROUTE_TABLE: + g_value_set_uint (value, priv->route_table); + break; case PROP_TIMEOUT: g_value_set_uint (value, priv->timeout); break; @@ -889,11 +914,9 @@ set_property (GObject *object, guint prop_id, priv->uuid = g_value_dup_string (value); break; case PROP_ROUTE_TABLE: - /* construct-only */ priv->route_table = g_value_get_uint (value); break; case PROP_ROUTE_METRIC: - /* construct-only */ priv->route_metric = g_value_get_uint (value); break; case PROP_TIMEOUT: @@ -1002,13 +1025,13 @@ nm_dhcp_client_class_init (NMDhcpClientClass *client_class) obj_properties[PROP_ROUTE_TABLE] = g_param_spec_uint (NM_DHCP_CLIENT_ROUTE_TABLE, "", "", 0, G_MAXUINT32, RT_TABLE_MAIN, - G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY | + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); obj_properties[PROP_ROUTE_METRIC] = g_param_spec_uint (NM_DHCP_CLIENT_ROUTE_METRIC, "", "", 0, G_MAXUINT32, 0, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); obj_properties[PROP_TIMEOUT] = diff --git a/src/dhcp/nm-dhcp-client.h b/src/dhcp/nm-dhcp-client.h index f3d0b7d1..4c196045 100644 --- a/src/dhcp/nm-dhcp-client.h +++ b/src/dhcp/nm-dhcp-client.h @@ -131,8 +131,12 @@ GBytes *nm_dhcp_client_get_hw_addr (NMDhcpClient *self); guint32 nm_dhcp_client_get_route_table (NMDhcpClient *self); +void nm_dhcp_client_set_route_table (NMDhcpClient *self, guint32 route_table); + guint32 nm_dhcp_client_get_route_metric (NMDhcpClient *self); +void nm_dhcp_client_set_route_metric (NMDhcpClient *self, guint32 route_metric); + guint32 nm_dhcp_client_get_timeout (NMDhcpClient *self); GBytes *nm_dhcp_client_get_client_id (NMDhcpClient *self); diff --git a/src/dhcp/nm-dhcp-dhclient.c b/src/dhcp/nm-dhcp-dhclient.c index 3bd14ebe..bf93c831 100644 --- a/src/dhcp/nm-dhcp-dhclient.c +++ b/src/dhcp/nm-dhcp-dhclient.c @@ -374,11 +374,15 @@ dhclient_start (NMDhcpClient *client, if (g_file_copy (src, dst, G_FILE_COPY_OVERWRITE, NULL, NULL, NULL, &error)) { /* Success; use the preferred leasefile path */ g_free (priv->lease_file); - priv->lease_file = g_strdup (g_file_get_path (dst)); + priv->lease_file = g_file_get_path (dst); } else { + gs_free char *s_path = NULL; + gs_free char *d_path = NULL; + /* Failure; just use the existing leasefile */ _LOGW ("failed to copy leasefile %s to %s: %s", - g_file_get_path (src), g_file_get_path (dst), + (s_path = g_file_get_path (src)), + (d_path = g_file_get_path (dst)), error->message); g_clear_error (&error); } |