Commit d5043ae4 authored by Thomas Haller's avatar Thomas Haller

device: merge branch 'th/dhcp-error-reason'

https://github.com/NetworkManager/NetworkManager/pull/199

(cherry picked from commit a83aa2da)
parents d3ba511c a4c3ebed
......@@ -480,6 +480,19 @@ _nm_g_slice_free_fcn_define (16)
/*****************************************************************************/
static inline int
nm_errno (int errsv)
{
/* several API returns negative errno values as errors. Normalize
* negative values to positive values.
*
* As a special case, map G_MININT to G_MAXINT. If you care about the
* distinction, then check for G_MININT before. */
return errsv >= 0
? errsv
: ((errsv == G_MININT) ? G_MAXINT : -errsv);
}
/**
* NMUtilsError:
* @NM_UTILS_ERROR_UNKNOWN: unknown or unclassified error
......@@ -542,6 +555,14 @@ nm_utils_error_set_literal (GError **error, int error_code, const char *literal)
#define nm_utils_error_set(error, error_code, ...) \
g_set_error ((error), NM_UTILS_ERROR, error_code, __VA_ARGS__)
#define nm_utils_error_set_errno(error, errsv, fmt, ...) \
g_set_error ((error), \
NM_UTILS_ERROR, \
NM_UTILS_ERROR_UNKNOWN, \
fmt, \
##__VA_ARGS__, \
g_strerror (nm_errno (errsv)))
/*****************************************************************************/
gboolean nm_g_object_set_property (GObject *object,
......
......@@ -7561,6 +7561,7 @@ dhcp4_start (NMDevice *self)
gs_unref_bytes GBytes *hwaddr = NULL;
gs_unref_bytes GBytes *client_id = NULL;
NMConnection *connection;
GError *error = NULL;
connection = nm_device_get_applied_connection (self);
g_return_val_if_fail (connection, FALSE);
......@@ -7591,10 +7592,14 @@ dhcp4_start (NMDevice *self)
client_id,
get_dhcp_timeout (self, AF_INET),
priv->dhcp_anycast_address,
NULL);
NULL,
&error);
if (!priv->dhcp4.client)
if (!priv->dhcp4.client) {
_LOGW (LOGD_DHCP4, "failure to start DHCP: %s", error->message);
g_clear_error (&error);
return NM_ACT_STAGE_RETURN_FAILURE;
}
priv->dhcp4.state_sigid = g_signal_connect (priv->dhcp4.client,
NM_DHCP_CLIENT_SIGNAL_STATE_CHANGED,
......@@ -8396,6 +8401,7 @@ dhcp6_start_with_link_ready (NMDevice *self, NMConnection *connection)
gs_unref_bytes GBytes *hwaddr = NULL;
gs_unref_bytes GBytes *duid = NULL;
gboolean enforce_duid = FALSE;
GError *error = NULL;
const NMPlatformIP6Address *ll_addr = NULL;
......@@ -8435,23 +8441,29 @@ dhcp6_start_with_link_ready (NMDevice *self, NMConnection *connection)
priv->dhcp_anycast_address,
(priv->dhcp6.mode == NM_NDISC_DHCP_LEVEL_OTHERCONF) ? TRUE : FALSE,
nm_setting_ip6_config_get_ip6_privacy (NM_SETTING_IP6_CONFIG (s_ip6)),
priv->dhcp6.needed_prefixes);
if (priv->dhcp6.client) {
priv->dhcp6.state_sigid = g_signal_connect (priv->dhcp6.client,
NM_DHCP_CLIENT_SIGNAL_STATE_CHANGED,
G_CALLBACK (dhcp6_state_changed),
self);
priv->dhcp6.prefix_sigid = g_signal_connect (priv->dhcp6.client,
NM_DHCP_CLIENT_SIGNAL_PREFIX_DELEGATED,
G_CALLBACK (dhcp6_prefix_delegated),
self);
priv->dhcp6.needed_prefixes,
&error);
if (!priv->dhcp6.client) {
_LOGW (LOGD_DHCP6, "failure to start DHCPv6: %s", error->message);
g_clear_error (&error);
if (nm_device_sys_iface_state_is_external_or_assume (self))
priv->dhcp6.was_active = TRUE;
return FALSE;
}
priv->dhcp6.state_sigid = g_signal_connect (priv->dhcp6.client,
NM_DHCP_CLIENT_SIGNAL_STATE_CHANGED,
G_CALLBACK (dhcp6_state_changed),
self);
priv->dhcp6.prefix_sigid = g_signal_connect (priv->dhcp6.client,
NM_DHCP_CLIENT_SIGNAL_PREFIX_DELEGATED,
G_CALLBACK (dhcp6_prefix_delegated),
self);
if (nm_device_sys_iface_state_is_external_or_assume (self))
priv->dhcp6.was_active = TRUE;
return !!priv->dhcp6.client;
return TRUE;
}
static gboolean
......
......@@ -510,7 +510,8 @@ nm_dhcp_client_start_ip4 (NMDhcpClient *self,
GBytes *client_id,
const char *dhcp_anycast_addr,
const char *hostname,
const char *last_ip4_address)
const char *last_ip4_address,
GError **error)
{
NMDhcpClientPrivate *priv;
......@@ -531,7 +532,10 @@ nm_dhcp_client_start_ip4 (NMDhcpClient *self,
g_clear_pointer (&priv->hostname, g_free);
priv->hostname = g_strdup (hostname);
return NM_DHCP_CLIENT_GET_CLASS (self)->ip4_start (self, dhcp_anycast_addr, last_ip4_address);
return NM_DHCP_CLIENT_GET_CLASS (self)->ip4_start (self,
dhcp_anycast_addr,
last_ip4_address,
error);
}
static GBytes *
......@@ -548,7 +552,8 @@ nm_dhcp_client_start_ip6 (NMDhcpClient *self,
const struct in6_addr *ll_addr,
const char *hostname,
NMSettingIP6ConfigPrivacy privacy,
guint needed_prefixes)
guint needed_prefixes,
GError **error)
{
NMDhcpClientPrivate *priv;
gs_free char *str = NULL;
......@@ -584,7 +589,8 @@ nm_dhcp_client_start_ip6 (NMDhcpClient *self,
ll_addr,
privacy,
priv->duid,
needed_prefixes);
needed_prefixes,
error);
}
void
......
......@@ -76,18 +76,18 @@ typedef enum {
typedef struct {
GObjectClass parent;
/* Methods */
gboolean (*ip4_start) (NMDhcpClient *self,
const char *anycast_addr,
const char *last_ip4_address);
const char *last_ip4_address,
GError **error);
gboolean (*ip6_start) (NMDhcpClient *self,
const char *anycast_addr,
const struct in6_addr *ll_addr,
NMSettingIP6ConfigPrivacy privacy,
GBytes *duid,
guint needed_prefixes);
guint needed_prefixes,
GError **error);
void (*stop) (NMDhcpClient *self,
gboolean release,
......@@ -151,7 +151,8 @@ gboolean nm_dhcp_client_start_ip4 (NMDhcpClient *self,
GBytes *client_id,
const char *dhcp_anycast_addr,
const char *hostname,
const char *last_ip4_address);
const char *last_ip4_address,
GError **error);
gboolean nm_dhcp_client_start_ip6 (NMDhcpClient *self,
GBytes *client_id,
......@@ -160,7 +161,8 @@ gboolean nm_dhcp_client_start_ip6 (NMDhcpClient *self,
const struct in6_addr *ll_addr,
const char *hostname,
NMSettingIP6ConfigPrivacy privacy,
guint needed_prefixes);
guint needed_prefixes,
GError **error);
void nm_dhcp_client_stop (NMDhcpClient *self, gboolean release);
......
This diff is collapsed.
......@@ -82,28 +82,36 @@ dhcpcanon_start (NMDhcpClient *client,
GBytes *duid,
gboolean release,
pid_t *out_pid,
int prefixes)
guint needed_prefixes,
GError **error)
{
NMDhcpDhcpcanon *self = NM_DHCP_DHCPCANON (client);
NMDhcpDhcpcanonPrivate *priv = NM_DHCP_DHCPCANON_GET_PRIVATE (self);
GPtrArray *argv = NULL;
gs_unref_ptrarray GPtrArray *argv = NULL;
pid_t pid;
GError *error = NULL;
const char *iface, *system_bus_address, *dhcpcanon_path = NULL;
char *binary_name, *cmd_str, *pid_file = NULL, *system_bus_address_env = NULL;
gs_free_error GError *local = NULL;
const char *iface;
const char *system_bus_address;
const char *dhcpcanon_path;
gs_free char *binary_name = NULL;
gs_free char *pid_file = NULL;
gs_free char *system_bus_address_env = NULL;
int addr_family;
g_return_val_if_fail (priv->pid_file == NULL, FALSE);
g_return_val_if_fail (!priv->pid_file, FALSE);
iface = nm_dhcp_client_get_iface (client);
addr_family = nm_dhcp_client_get_addr_family (client);
dhcpcanon_path = nm_dhcp_dhcpcanon_get_path ();
_LOGD ("dhcpcanon_path: %s", dhcpcanon_path);
if (!dhcpcanon_path) {
_LOGW ("dhcpcanon could not be found");
nm_utils_error_set_literal (error, NM_UTILS_ERROR_UNKNOWN, "dhcpcanon binary not found");
return FALSE;
}
_LOGD ("dhcpcanon_path: %s", dhcpcanon_path);
pid_file = g_strdup_printf (RUNSTATEDIR "/dhcpcanon%c-%s.pid",
nm_utils_addr_family_to_char (addr_family),
iface);
......@@ -112,7 +120,6 @@ dhcpcanon_start (NMDhcpClient *client,
/* Kill any existing dhcpcanon from the pidfile */
binary_name = g_path_get_basename (dhcpcanon_path);
nm_dhcp_client_stop_existing (pid_file, binary_name);
g_free (binary_name);
argv = g_ptr_array_new ();
g_ptr_array_add (argv, (gpointer) dhcpcanon_path);
......@@ -120,10 +127,8 @@ dhcpcanon_start (NMDhcpClient *client,
g_ptr_array_add (argv, (gpointer) "-sf"); /* Set script file */
g_ptr_array_add (argv, (gpointer) nm_dhcp_helper_path);
if (pid_file) {
g_ptr_array_add (argv, (gpointer) "-pf"); /* Set pid file */
g_ptr_array_add (argv, (gpointer) pid_file);
}
g_ptr_array_add (argv, (gpointer) "-pf"); /* Set pid file */
g_ptr_array_add (argv, (gpointer) pid_file);
if (priv->conf_file) {
g_ptr_array_add (argv, (gpointer) "-cf"); /* Set interface config file */
......@@ -144,33 +149,43 @@ dhcpcanon_start (NMDhcpClient *client,
g_ptr_array_add (argv, (gpointer) iface);
g_ptr_array_add (argv, NULL);
cmd_str = g_strjoinv (" ", (char **) argv->pdata);
g_free (cmd_str);
if (g_spawn_async (NULL, (char **) argv->pdata, NULL,
G_SPAWN_DO_NOT_REAP_CHILD | G_SPAWN_STDOUT_TO_DEV_NULL | G_SPAWN_STDERR_TO_DEV_NULL,
nm_utils_setpgid, NULL, &pid, &error)) {
g_assert (pid > 0);
_LOGI ("dhcpcanon started with pid %d", pid);
nm_dhcp_client_watch_child (client, pid);
priv->pid_file = pid_file;
} else {
_LOGW ("dhcpcanon failed to start: '%s'", error->message);
g_error_free (error);
g_free (pid_file);
if (!g_spawn_async (NULL,
(char **) argv->pdata,
NULL,
G_SPAWN_DO_NOT_REAP_CHILD
| G_SPAWN_STDOUT_TO_DEV_NULL
| G_SPAWN_STDERR_TO_DEV_NULL,
nm_utils_setpgid,
NULL,
&pid,
&local)) {
nm_utils_error_set (error,
NM_UTILS_ERROR_UNKNOWN,
"dhcpcanon failed to start: %s",
local->message);
return FALSE;
}
g_ptr_array_free (argv, TRUE);
g_free (system_bus_address_env);
return pid > 0 ? TRUE : FALSE;
nm_assert (pid > 0);
_LOGI ("dhcpcanon started with pid %d", pid);
nm_dhcp_client_watch_child (client, pid);
priv->pid_file = g_steal_pointer (&pid_file);
return TRUE;
}
static gboolean
ip4_start (NMDhcpClient *client, const char *dhcp_anycast_addr, const char *last_ip4_address)
ip4_start (NMDhcpClient *client,
const char *dhcp_anycast_addr,
const char *last_ip4_address,
GError **error)
{
gboolean success = FALSE;
success = dhcpcanon_start (client, NULL, NULL, FALSE, NULL, 0);
return success;
return dhcpcanon_start (client,
NULL,
NULL,
FALSE,
NULL,
0,
error);
}
static gboolean
......@@ -179,11 +194,10 @@ ip6_start (NMDhcpClient *client,
const struct in6_addr *ll_addr,
NMSettingIP6ConfigPrivacy privacy,
GBytes *duid,
guint needed_prefixes)
guint needed_prefixes,
GError **error)
{
NMDhcpDhcpcanon *self = NM_DHCP_DHCPCANON (client);
_LOGW ("the dhcpcd backend does not support IPv6");
nm_utils_error_set_literal (error, NM_UTILS_ERROR_UNKNOWN, "dhcpcanon plugin does not support IPv6");
return FALSE;
}
static void
......
......@@ -81,15 +81,21 @@ nm_dhcp_dhcpcd_get_path (void)
}
static gboolean
ip4_start (NMDhcpClient *client, const char *dhcp_anycast_addr, const char *last_ip4_address)
ip4_start (NMDhcpClient *client,
const char *dhcp_anycast_addr,
const char *last_ip4_address,
GError **error)
{
NMDhcpDhcpcd *self = NM_DHCP_DHCPCD (client);
NMDhcpDhcpcdPrivate *priv = NM_DHCP_DHCPCD_GET_PRIVATE (self);
GPtrArray *argv = NULL;
gs_unref_ptrarray GPtrArray *argv = NULL;
pid_t pid = -1;
GError *error = NULL;
char *pid_contents = NULL, *binary_name, *cmd_str;
const char *iface, *dhcpcd_path, *hostname;
GError *local = NULL;
gs_free char *cmd_str = NULL;
gs_free char *binary_name = NULL;
const char *iface;
const char *dhcpcd_path;
const char *hostname;
g_return_val_if_fail (priv->pid_file == NULL, FALSE);
......@@ -102,14 +108,13 @@ ip4_start (NMDhcpClient *client, const char *dhcp_anycast_addr, const char *last
dhcpcd_path = nm_dhcp_dhcpcd_get_path ();
if (!dhcpcd_path) {
_LOGW ("dhcpcd could not be found");
nm_utils_error_set_literal (error, NM_UTILS_ERROR_UNKNOWN, "dhcpcd binary not found");
return FALSE;
}
/* Kill any existing dhcpcd from the pidfile */
binary_name = g_path_get_basename (dhcpcd_path);
nm_dhcp_client_stop_existing (priv->pid_file, binary_name);
g_free (binary_name);
argv = g_ptr_array_new ();
g_ptr_array_add (argv, (gpointer) dhcpcd_path);
......@@ -153,24 +158,30 @@ ip4_start (NMDhcpClient *client, const char *dhcp_anycast_addr, const char *last
g_ptr_array_add (argv, (gpointer) iface);
g_ptr_array_add (argv, NULL);
cmd_str = g_strjoinv (" ", (char **) argv->pdata);
_LOGD ("running: %s", cmd_str);
g_free (cmd_str);
if (g_spawn_async (NULL, (char **) argv->pdata, NULL,
G_SPAWN_DO_NOT_REAP_CHILD | G_SPAWN_STDOUT_TO_DEV_NULL | G_SPAWN_STDERR_TO_DEV_NULL,
nm_utils_setpgid, NULL, &pid, &error)) {
g_assert (pid > 0);
_LOGI ("dhcpcd started with pid %d", pid);
nm_dhcp_client_watch_child (client, pid);
} else {
_LOGW ("dhcpcd failed to start, error: '%s'", error->message);
g_error_free (error);
_LOGD ("running: %s",
(cmd_str = g_strjoinv (" ", (char **) argv->pdata)));
if (!g_spawn_async (NULL,
(char **) argv->pdata, NULL,
G_SPAWN_DO_NOT_REAP_CHILD
| G_SPAWN_STDOUT_TO_DEV_NULL
| G_SPAWN_STDERR_TO_DEV_NULL,
nm_utils_setpgid,
NULL,
&pid,
&local)) {
nm_utils_error_set (error,
NM_UTILS_ERROR_UNKNOWN,
"dhcpcd failed to start: %s",
local->message);
g_error_free (local);
return FALSE;
}
g_free (pid_contents);
g_ptr_array_free (argv, TRUE);
return pid > 0 ? TRUE : FALSE;
nm_assert (pid > 0);
_LOGI ("dhcpcd started with pid %d", pid);
nm_dhcp_client_watch_child (client, pid);
return TRUE;
}
static gboolean
......@@ -179,11 +190,10 @@ ip6_start (NMDhcpClient *client,
const struct in6_addr *ll_addr,
NMSettingIP6ConfigPrivacy privacy,
GBytes *duid,
guint needed_prefixes)
guint needed_prefixes,
GError **error)
{
NMDhcpDhcpcd *self = NM_DHCP_DHCPCD (client);
_LOGW ("the dhcpcd backend does not support IPv6");
nm_utils_error_set_literal (error, NM_UTILS_ERROR_UNKNOWN, "dhcpcd plugin does not support IPv6");
return FALSE;
}
......
......@@ -172,22 +172,39 @@ client_start (NMDhcpManager *self,
gboolean info_only,
NMSettingIP6ConfigPrivacy privacy,
const char *last_ip4_address,
guint needed_prefixes)
guint needed_prefixes,
GError **error)
{
NMDhcpManagerPrivate *priv;
NMDhcpClient *client;
gboolean success = FALSE;
gsize hwaddr_len;
g_return_val_if_fail (self, NULL);
g_return_val_if_fail (NM_IS_DHCP_MANAGER (self), NULL);
g_return_val_if_fail (ifindex > 0, NULL);
g_return_val_if_fail (uuid != NULL, NULL);
g_return_val_if_fail (!dhcp_client_id || g_bytes_get_size (dhcp_client_id) >= 2, NULL);
g_return_val_if_fail (!error || !*error, NULL);
if (!hwaddr) {
nm_utils_error_set (error,
NM_UTILS_ERROR_UNKNOWN,
"missing MAC address");
return NULL;
}
hwaddr_len = g_bytes_get_size (hwaddr);
if ( hwaddr_len == 0
|| hwaddr_len > NM_UTILS_HWADDR_LEN_MAX) {
nm_utils_error_set (error,
NM_UTILS_ERROR_UNKNOWN,
"invalid MAC address");
g_return_val_if_reached (NULL) ;
}
priv = NM_DHCP_MANAGER_GET_PRIVATE (self);
if (!priv->client_factory)
return NULL;
nm_assert (priv->client_factory);
/* Kill any old client instance */
client = get_client_for_ifindex (self, addr_family, ifindex);
......@@ -216,10 +233,24 @@ client_start (NMDhcpManager *self,
c_list_link_tail (&priv->dhcp_client_lst_head, &client->dhcp_client_lst);
g_signal_connect (client, NM_DHCP_CLIENT_SIGNAL_STATE_CHANGED, G_CALLBACK (client_state_changed), self);
if (addr_family == AF_INET)
success = nm_dhcp_client_start_ip4 (client, dhcp_client_id, dhcp_anycast_addr, hostname, last_ip4_address);
else
success = nm_dhcp_client_start_ip6 (client, dhcp_client_id, enforce_duid, dhcp_anycast_addr, ipv6_ll_addr, hostname, privacy, needed_prefixes);
if (addr_family == AF_INET) {
success = nm_dhcp_client_start_ip4 (client,
dhcp_client_id,
dhcp_anycast_addr,
hostname,
last_ip4_address,
error);
} else {
success = nm_dhcp_client_start_ip6 (client,
dhcp_client_id,
enforce_duid,
dhcp_anycast_addr,
ipv6_ll_addr,
hostname,
privacy,
needed_prefixes,
error);
}
if (!success) {
remove_client_unref (self, client);
......@@ -245,7 +276,8 @@ nm_dhcp_manager_start_ip4 (NMDhcpManager *self,
GBytes *dhcp_client_id,
guint32 timeout,
const char *dhcp_anycast_addr,
const char *last_ip_address)
const char *last_ip_address,
GError **error)
{
NMDhcpManagerPrivate *priv;
const char *hostname = NULL;
......@@ -282,7 +314,7 @@ nm_dhcp_manager_start_ip4 (NMDhcpManager *self,
return client_start (self, AF_INET, multi_idx, iface, ifindex, hwaddr, uuid,
route_table, route_metric, NULL,
dhcp_client_id, 0, timeout, dhcp_anycast_addr, hostname,
use_fqdn, FALSE, 0, last_ip_address, 0);
use_fqdn, FALSE, 0, last_ip_address, 0, error);
}
/* Caller owns a reference to the NMDhcpClient on return */
......@@ -304,7 +336,8 @@ nm_dhcp_manager_start_ip6 (NMDhcpManager *self,
const char *dhcp_anycast_addr,
gboolean info_only,
NMSettingIP6ConfigPrivacy privacy,
guint needed_prefixes)
guint needed_prefixes,
GError **error)
{
NMDhcpManagerPrivate *priv;
const char *hostname = NULL;
......@@ -319,7 +352,7 @@ nm_dhcp_manager_start_ip6 (NMDhcpManager *self,
return client_start (self, AF_INET6, multi_idx, iface, ifindex, hwaddr, uuid,
route_table, route_metric, ll_addr, duid, enforce_duid,
timeout, dhcp_anycast_addr, hostname, TRUE, info_only,
privacy, NULL, needed_prefixes);
privacy, NULL, needed_prefixes, error);
}
void
......@@ -409,7 +442,7 @@ nm_dhcp_manager_init (NMDhcpManager *self)
}
}
nm_assert (client_factory);
g_return_if_fail (client_factory);
nm_log_info (LOGD_DHCP, "dhcp-init: Using DHCP client '%s'", client_factory->name);
......
......@@ -59,7 +59,8 @@ NMDhcpClient * nm_dhcp_manager_start_ip4 (NMDhcpManager *manager,
GBytes *dhcp_client_id,
guint32 timeout,
const char *dhcp_anycast_addr,
const char *last_ip_address);
const char *last_ip_address,
GError **error);
NMDhcpClient * nm_dhcp_manager_start_ip6 (NMDhcpManager *manager,
struct _NMDedupMultiIndex *multi_idx,
......@@ -78,7 +79,8 @@ NMDhcpClient * nm_dhcp_manager_start_ip6 (NMDhcpManager *manager,
const char *dhcp_anycast_addr,
gboolean info_only,
NMSettingIP6ConfigPrivacy privacy,
guint needed_prefixes);
guint needed_prefixes,
GError **error);
/* For testing only */
extern const char* nm_dhcp_helper_path;
......
......@@ -567,7 +567,10 @@ get_arp_type (GBytes *hwaddr)
}
static gboolean
ip4_start (NMDhcpClient *client, const char *dhcp_anycast_addr, const char *last_ip4_address)
ip4_start (NMDhcpClient *client,
const char *dhcp_anycast_addr,
const char *last_ip4_address,
GError **error)
{
NMDhcpSystemd *self = NM_DHCP_SYSTEMD (client);
NMDhcpSystemdPrivate *priv = NM_DHCP_SYSTEMD_GET_PRIVATE (self);
......@@ -590,7 +593,7 @@ ip4_start (NMDhcpClient *client, const char *dhcp_anycast_addr, const char *last
r = sd_dhcp_client_new (&priv->client4, FALSE);
if (r < 0) {
_LOGW ("failed to create client (%d)", r);
nm_utils_error_set_errno (error, r, "failed to create dhcp-client: %s");
return FALSE;
}
......@@ -598,8 +601,8 @@ ip4_start (NMDhcpClient *client, const char *dhcp_anycast_addr, const char *last
r = sd_dhcp_client_attach_event (priv->client4, NULL, 0);
if (r < 0) {
_LOGW ("failed to attach event (%d)", r);
goto error;
nm_utils_error_set_errno (error, r, "failed to attach event: %s");
goto errout;
}
hwaddr = nm_dhcp_client_get_hw_addr (client);
......@@ -613,21 +616,21 @@ ip4_start (NMDhcpClient *client, const char *dhcp_anycast_addr, const char *last
len,
get_arp_type (hwaddr));
if (r < 0) {
_LOGW ("failed to set MAC address (%d)", r);
goto error;
nm_utils_error_set_errno (error, r, "failed to set MAC address: %s");
goto errout;
}
}
r = sd_dhcp_client_set_ifindex (priv->client4, nm_dhcp_client_get_ifindex (client));
if (r < 0) {
_LOGW ("failed to set ififindex (%d)", r);
goto error;
nm_utils_error_set_errno (error, r, "failed to set ifindex: %s");
goto errout;
}
r = sd_dhcp_client_set_callback (priv->client4, dhcp_event_cb, client);
if (r < 0) {
_LOGW ("failed to set callback (%d)", r);
goto error;
nm_utils_error_set_errno (error, r, "failed to set callback: %s");
goto errout;
}
dhcp_lease_load (&lease, priv->lease_file);
......@@ -640,8 +643,8 @@ ip4_start (NMDhcpClient *client, const char *dhcp_anycast_addr, const char *last
if (last_addr.s_addr) {
r = sd_dhcp_client_set_request_address (priv->client4, &last_addr);
if (r < 0) {
_LOGW ("failed to set last IPv4 address (%d)", r);