rdisc: don't log error message when failing to create NDP socket
Let the caller do that, he already logs an ERR level message. Just combine the messages.
This commit is contained in:
@@ -5584,6 +5584,7 @@ addrconf6_start (NMDevice *self, NMSettingIP6ConfigPrivacy use_tempaddr)
|
|||||||
NMConnection *connection;
|
NMConnection *connection;
|
||||||
NMActStageReturn ret;
|
NMActStageReturn ret;
|
||||||
NMSettingIP6Config *s_ip6 = NULL;
|
NMSettingIP6Config *s_ip6 = NULL;
|
||||||
|
GError *error = NULL;
|
||||||
|
|
||||||
connection = nm_device_get_applied_connection (self);
|
connection = nm_device_get_applied_connection (self);
|
||||||
g_assert (connection);
|
g_assert (connection);
|
||||||
@@ -5600,9 +5601,11 @@ addrconf6_start (NMDevice *self, NMSettingIP6ConfigPrivacy use_tempaddr)
|
|||||||
priv->rdisc = nm_lndp_rdisc_new (nm_device_get_ip_ifindex (self),
|
priv->rdisc = nm_lndp_rdisc_new (nm_device_get_ip_ifindex (self),
|
||||||
nm_device_get_ip_iface (self),
|
nm_device_get_ip_iface (self),
|
||||||
nm_connection_get_uuid (connection),
|
nm_connection_get_uuid (connection),
|
||||||
nm_setting_ip6_config_get_addr_gen_mode (s_ip6));
|
nm_setting_ip6_config_get_addr_gen_mode (s_ip6),
|
||||||
|
&error);
|
||||||
if (!priv->rdisc) {
|
if (!priv->rdisc) {
|
||||||
_LOGE (LOGD_IP6, "addrconf6: failed to start router discovery");
|
_LOGE (LOGD_IP6, "addrconf6: failed to start router discovery: %s", error->message);
|
||||||
|
g_error_free (error);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -475,7 +475,7 @@ main (int argc, char *argv[])
|
|||||||
if (global_opt.slaac) {
|
if (global_opt.slaac) {
|
||||||
nm_platform_link_set_user_ipv6ll_enabled (NM_PLATFORM_GET, ifindex, TRUE);
|
nm_platform_link_set_user_ipv6ll_enabled (NM_PLATFORM_GET, ifindex, TRUE);
|
||||||
|
|
||||||
rdisc = nm_lndp_rdisc_new (ifindex, global_opt.ifname, global_opt.uuid, global_opt.addr_gen_mode);
|
rdisc = nm_lndp_rdisc_new (ifindex, global_opt.ifname, global_opt.uuid, global_opt.addr_gen_mode, NULL);
|
||||||
g_assert (rdisc);
|
g_assert (rdisc);
|
||||||
|
|
||||||
if (iid)
|
if (iid)
|
||||||
|
@@ -297,11 +297,17 @@ ipv6_sysctl_get (const char *ifname, const char *property, gint32 defval)
|
|||||||
}
|
}
|
||||||
|
|
||||||
NMRDisc *
|
NMRDisc *
|
||||||
nm_lndp_rdisc_new (int ifindex, const char *ifname, const char *uuid, NMSettingIP6ConfigAddrGenMode addr_gen_mode)
|
nm_lndp_rdisc_new (int ifindex,
|
||||||
|
const char *ifname,
|
||||||
|
const char *uuid,
|
||||||
|
NMSettingIP6ConfigAddrGenMode addr_gen_mode,
|
||||||
|
GError **error)
|
||||||
{
|
{
|
||||||
NMRDisc *rdisc;
|
NMRDisc *rdisc;
|
||||||
NMLNDPRDiscPrivate *priv;
|
NMLNDPRDiscPrivate *priv;
|
||||||
int error;
|
int errsv;
|
||||||
|
|
||||||
|
g_return_val_if_fail (!error || !*error, NULL);
|
||||||
|
|
||||||
rdisc = g_object_new (NM_TYPE_LNDP_RDISC, NULL);
|
rdisc = g_object_new (NM_TYPE_LNDP_RDISC, NULL);
|
||||||
|
|
||||||
@@ -318,9 +324,12 @@ nm_lndp_rdisc_new (int ifindex, const char *ifname, const char *uuid, NMSettingI
|
|||||||
NM_RDISC_RTR_SOLICITATION_INTERVAL_DEFAULT);
|
NM_RDISC_RTR_SOLICITATION_INTERVAL_DEFAULT);
|
||||||
|
|
||||||
priv = NM_LNDP_RDISC_GET_PRIVATE (rdisc);
|
priv = NM_LNDP_RDISC_GET_PRIVATE (rdisc);
|
||||||
error = ndp_open (&priv->ndp);
|
errsv = ndp_open (&priv->ndp);
|
||||||
if (error != 0) {
|
if (errsv != 0) {
|
||||||
_LOGD ("error creating socket for NDP; errno=%d", -error);
|
errsv = errsv > 0 ? errsv : -errsv;
|
||||||
|
g_set_error (error, NM_UTILS_ERROR, NM_UTILS_ERROR_UNKNOWN,
|
||||||
|
"failure creating libndp socket: %s (%d)",
|
||||||
|
g_strerror (errsv), errsv);
|
||||||
g_object_unref (rdisc);
|
g_object_unref (rdisc);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@@ -44,6 +44,10 @@ typedef struct {
|
|||||||
|
|
||||||
GType nm_lndp_rdisc_get_type (void);
|
GType nm_lndp_rdisc_get_type (void);
|
||||||
|
|
||||||
NMRDisc *nm_lndp_rdisc_new (int ifindex, const char *ifname, const char *uuid, NMSettingIP6ConfigAddrGenMode addr_gen_mode);
|
NMRDisc *nm_lndp_rdisc_new (int ifindex,
|
||||||
|
const char *ifname,
|
||||||
|
const char *uuid,
|
||||||
|
NMSettingIP6ConfigAddrGenMode addr_gen_mode,
|
||||||
|
GError **error);
|
||||||
|
|
||||||
#endif /* __NETWORKMANAGER_LNDP_RDISC_H__ */
|
#endif /* __NETWORKMANAGER_LNDP_RDISC_H__ */
|
||||||
|
@@ -41,6 +41,7 @@ main (int argc, char **argv)
|
|||||||
int ifindex = 1;
|
int ifindex = 1;
|
||||||
const char *ifname;
|
const char *ifname;
|
||||||
NMUtilsIPv6IfaceId iid = { };
|
NMUtilsIPv6IfaceId iid = { };
|
||||||
|
GError *error = NULL;
|
||||||
|
|
||||||
nmtst_init_with_logging (&argc, &argv, NULL, "DEFAULT");
|
nmtst_init_with_logging (&argc, &argv, NULL, "DEFAULT");
|
||||||
|
|
||||||
@@ -64,9 +65,11 @@ main (int argc, char **argv)
|
|||||||
rdisc = nm_lndp_rdisc_new (ifindex,
|
rdisc = nm_lndp_rdisc_new (ifindex,
|
||||||
ifname,
|
ifname,
|
||||||
"8ce666e8-d34d-4fb1-b858-f15a7al28086",
|
"8ce666e8-d34d-4fb1-b858-f15a7al28086",
|
||||||
NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_EUI64);
|
NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_EUI64,
|
||||||
|
&error);
|
||||||
if (!rdisc) {
|
if (!rdisc) {
|
||||||
g_print ("Failed to create NMRDisc instance\n");
|
g_print ("Failed to create NMRDisc instance: %s\n", error->message);
|
||||||
|
g_error_free (error);
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user