mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-03 15:58:02 +02:00
core: merge branch 'th/avoid-wrong-warnings-rh1323571'
https://bugzilla.redhat.com/show_bug.cgi?id=1323571
This commit is contained in:
commit
6f31f87871
16 changed files with 272 additions and 187 deletions
|
|
@ -86,6 +86,30 @@ _nm_g_return_if_fail_warning (const char *log_domain,
|
|||
#define g_assertion_message_expr(domain, file, line, func, expr) \
|
||||
g_assertion_message_expr(domain, file, line, "<unknown-fcn>", (expr) ? "<dropped>" : NULL)
|
||||
|
||||
#undef g_return_val_if_reached
|
||||
#define g_return_val_if_reached(val) \
|
||||
G_STMT_START { \
|
||||
g_log (G_LOG_DOMAIN, \
|
||||
G_LOG_LEVEL_CRITICAL, \
|
||||
"file %s: line %d (%s): should not be reached", \
|
||||
__FILE__, \
|
||||
__LINE__, \
|
||||
"<dropped>"); \
|
||||
return (val); \
|
||||
} G_STMT_END
|
||||
|
||||
#undef g_return_if_reached
|
||||
#define g_return_if_reached() \
|
||||
G_STMT_START { \
|
||||
g_log (G_LOG_DOMAIN, \
|
||||
G_LOG_LEVEL_CRITICAL, \
|
||||
"file %s: line %d (%s): should not be reached", \
|
||||
__FILE__, \
|
||||
__LINE__, \
|
||||
"<dropped>"); \
|
||||
return; \
|
||||
} G_STMT_END
|
||||
|
||||
#define NM_ASSERT_G_RETURN_EXPR(expr) "<dropped>"
|
||||
#define NM_ASSERT_NO_MSG 1
|
||||
|
||||
|
|
|
|||
|
|
@ -540,6 +540,35 @@ nm_decode_version (guint version, guint *major, guint *minor, guint *micro) {
|
|||
}
|
||||
/*****************************************************************************/
|
||||
|
||||
/* if @str is NULL, return "(null)". Otherwise, allocate a buffer using
|
||||
* alloca() of size @bufsize and fill it with @str. @str will be quoted with
|
||||
* single quote, and in case @str is too long, the final quote will be '^'. */
|
||||
#define nm_strquote_a(bufsize, str) \
|
||||
({ \
|
||||
G_STATIC_ASSERT ((bufsize) >= 6); \
|
||||
const gsize _BUFSIZE = (bufsize); \
|
||||
const char *const _s = (str); \
|
||||
char *_r; \
|
||||
gsize _l; \
|
||||
gboolean _truncated; \
|
||||
\
|
||||
nm_assert (_BUFSIZE >= 6); \
|
||||
\
|
||||
if (_s) { \
|
||||
_l = strlen (_s) + 3; \
|
||||
if ((_truncated = (_BUFSIZE < _l))) \
|
||||
_l = _BUFSIZE; \
|
||||
\
|
||||
_r = g_alloca (_l); \
|
||||
_r[0] = '\''; \
|
||||
memcpy (&_r[1], _s, _l - 3); \
|
||||
_r[_l - 2] = _truncated ? '^' : '\''; \
|
||||
_r[_l - 1] = '\0'; \
|
||||
} else \
|
||||
_r = "(null)"; \
|
||||
_r; \
|
||||
})
|
||||
|
||||
#define nm_sprintf_buf(buf, format, ...) ({ \
|
||||
char * _buf = (buf); \
|
||||
\
|
||||
|
|
|
|||
|
|
@ -55,15 +55,15 @@
|
|||
#include "nm-device-logging.h"
|
||||
_LOG_DECLARE_SELF(NMDeviceEthernet);
|
||||
|
||||
G_DEFINE_TYPE (NMDeviceEthernet, nm_device_ethernet, NM_TYPE_DEVICE)
|
||||
|
||||
#define NM_DEVICE_ETHERNET_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_DEVICE_ETHERNET, NMDeviceEthernetPrivate))
|
||||
/*****************************************************************************/
|
||||
|
||||
#define WIRED_SECRETS_TRIES "wired-secrets-tries"
|
||||
|
||||
#define PPPOE_RECONNECT_DELAY 7
|
||||
#define PPPOE_ENCAP_OVERHEAD 8 /* 2 bytes for PPP, 6 for PPPoE */
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
typedef struct Supplicant {
|
||||
NMSupplicantManager *mgr;
|
||||
NMSupplicantInterface *iface;
|
||||
|
|
@ -91,7 +91,7 @@ typedef enum {
|
|||
DCB_WAIT_CARRIER_POSTCONFIG_UP,
|
||||
} DcbWait;
|
||||
|
||||
typedef struct {
|
||||
typedef struct _NMDeviceEthernetPrivate {
|
||||
guint32 speed;
|
||||
|
||||
Supplicant supplicant;
|
||||
|
|
@ -118,14 +118,29 @@ typedef struct {
|
|||
gulong dcb_carrier_id;
|
||||
} NMDeviceEthernetPrivate;
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
NM_GOBJECT_PROPERTIES_DEFINE (NMDeviceEthernet,
|
||||
PROP_SPEED,
|
||||
PROP_S390_SUBCHANNELS,
|
||||
);
|
||||
|
||||
LAST_PROP
|
||||
};
|
||||
/*****************************************************************************/
|
||||
|
||||
G_DEFINE_TYPE (NMDeviceEthernet, nm_device_ethernet, NM_TYPE_DEVICE)
|
||||
|
||||
#define NM_DEVICE_ETHERNET_GET_PRIVATE(self) \
|
||||
({ \
|
||||
/* preserve the const-ness of self. Unfortunately, that
|
||||
* way, @self cannot be a void pointer */ \
|
||||
typeof (self) _self = (self); \
|
||||
\
|
||||
/* Get compiler error if variable is of wrong type */ \
|
||||
_nm_unused const NMDeviceEthernet *_self2 = (_self); \
|
||||
\
|
||||
nm_assert (NM_IS_DEVICE_ETHERNET (_self)); \
|
||||
_self->_priv; \
|
||||
})
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static char *
|
||||
get_link_basename (const char *parent_path, const char *name, GError **error)
|
||||
|
|
@ -147,21 +162,29 @@ static void
|
|||
_update_s390_subchannels (NMDeviceEthernet *self)
|
||||
{
|
||||
NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE (self);
|
||||
GUdevDevice *dev;
|
||||
GUdevDevice *parent = NULL;
|
||||
const char *parent_path, *item, *driver;
|
||||
gs_unref_object GUdevDevice *dev = NULL;
|
||||
gs_unref_object GUdevDevice *parent = NULL;
|
||||
const char *parent_path, *item;
|
||||
int ifindex;
|
||||
GDir *dir;
|
||||
GError *error = NULL;
|
||||
|
||||
ifindex = nm_device_get_ifindex (NM_DEVICE (self));
|
||||
dev = (GUdevDevice *) nm_platform_link_get_udev_device (NM_PLATFORM_GET, ifindex);
|
||||
if (!dev) {
|
||||
_LOGW (LOGD_DEVICE | LOGD_HW, "failed to find device %d '%s' with udev",
|
||||
ifindex, nm_device_get_iface (NM_DEVICE (self)) ?: "(null)");
|
||||
goto out;
|
||||
if (priv->subchannels) {
|
||||
/* only read the subchannels once. For one, we don't expect them to change
|
||||
* on multiple invocations. Second, we didn't implement proper reloading.
|
||||
* Proper reloading might also be complicated, because the subchannels are
|
||||
* used to match on devices based on a device-spec. Thus, it's not clear
|
||||
* what it means to change afterwards. */
|
||||
return;
|
||||
}
|
||||
|
||||
ifindex = nm_device_get_ifindex ((NMDevice *) self);
|
||||
dev = (GUdevDevice *) nm_g_object_ref (nm_platform_link_get_udev_device (NM_PLATFORM_GET, ifindex));
|
||||
if (!dev) {
|
||||
/* we only call _update_s390_subchannels() when platform claims the device to be initialized.
|
||||
* Thus, we expect to successfully lookup a GUdevDevice. */
|
||||
g_return_if_reached ();
|
||||
}
|
||||
g_object_ref (dev);
|
||||
|
||||
/* Try for the "ccwgroup" parent */
|
||||
parent = g_udev_device_get_parent_with_subsystem (dev, "ccwgroup", NULL);
|
||||
|
|
@ -169,17 +192,17 @@ _update_s390_subchannels (NMDeviceEthernet *self)
|
|||
/* FIXME: whatever 'lcs' devices' subsystem is here... */
|
||||
if (!parent) {
|
||||
/* Not an s390 device */
|
||||
goto out;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
parent_path = g_udev_device_get_sysfs_path (parent);
|
||||
dir = g_dir_open (parent_path, 0, &error);
|
||||
if (!dir) {
|
||||
_LOGW (LOGD_DEVICE | LOGD_HW, "failed to open directory '%s': %s",
|
||||
_LOGW (LOGD_DEVICE | LOGD_HW, "update-s390: failed to open directory '%s': %s",
|
||||
parent_path, error->message);
|
||||
g_clear_error (&error);
|
||||
goto out;
|
||||
return;
|
||||
}
|
||||
|
||||
while ((item = g_dir_read_name (dir))) {
|
||||
|
|
@ -206,11 +229,11 @@ _update_s390_subchannels (NMDeviceEthernet *self)
|
|||
g_hash_table_insert (priv->s390_options, g_strdup (item), value);
|
||||
value = NULL;
|
||||
} else
|
||||
_LOGW (LOGD_DEVICE | LOGD_HW, "error reading %s", path);
|
||||
_LOGW (LOGD_DEVICE | LOGD_HW, "update-s390: error reading %s", path);
|
||||
}
|
||||
|
||||
if (error) {
|
||||
_LOGW (LOGD_DEVICE | LOGD_HW, "%s", error->message);
|
||||
_LOGW (LOGD_DEVICE | LOGD_HW, "update-s390: failed reading sysfs for %s (%s)", item, error->message);
|
||||
g_clear_error (&error);
|
||||
}
|
||||
}
|
||||
|
|
@ -235,42 +258,23 @@ _update_s390_subchannels (NMDeviceEthernet *self)
|
|||
priv->subchannels_dbus[2] = g_strdup (priv->subchan3);
|
||||
priv->subchannels_dbus[3] = NULL;
|
||||
|
||||
driver = nm_device_get_driver (NM_DEVICE (self));
|
||||
_LOGI (LOGD_DEVICE | LOGD_HW, "found s390 '%s' subchannels [%s]",
|
||||
driver ? driver : "(unknown driver)", priv->subchannels);
|
||||
_LOGI (LOGD_DEVICE | LOGD_HW, "update-s390: found s390 '%s' subchannels [%s]",
|
||||
nm_device_get_driver ((NMDevice *) self) ?: "(unknown driver)",
|
||||
priv->subchannels);
|
||||
|
||||
out:
|
||||
if (parent)
|
||||
g_object_unref (parent);
|
||||
if (dev)
|
||||
g_object_unref (dev);
|
||||
_notify (self, PROP_S390_SUBCHANNELS);
|
||||
}
|
||||
|
||||
static GObject*
|
||||
constructor (GType type,
|
||||
guint n_construct_params,
|
||||
GObjectConstructParam *construct_params)
|
||||
static void
|
||||
constructed (GObject *object)
|
||||
{
|
||||
GObject *object;
|
||||
const NMPlatformLink *pllink;
|
||||
|
||||
object = G_OBJECT_CLASS (nm_device_ethernet_parent_class)->constructor (type,
|
||||
n_construct_params,
|
||||
construct_params);
|
||||
if (object) {
|
||||
#ifndef G_DISABLE_ASSERT
|
||||
int ifindex = nm_device_get_ifindex (NM_DEVICE (object));
|
||||
NMLinkType link_type = nm_platform_link_get_type (NM_PLATFORM_GET, ifindex);
|
||||
G_OBJECT_CLASS (nm_device_ethernet_parent_class)->constructed (object);
|
||||
|
||||
g_assert ( link_type == NM_LINK_TYPE_ETHERNET
|
||||
|| link_type == NM_LINK_TYPE_VETH
|
||||
|| link_type == NM_LINK_TYPE_NONE);
|
||||
#endif
|
||||
|
||||
/* s390 stuff */
|
||||
_update_s390_subchannels (NM_DEVICE_ETHERNET (object));
|
||||
}
|
||||
|
||||
return object;
|
||||
pllink = nm_platform_link_get (NM_PLATFORM_GET, nm_device_get_ifindex ((NMDevice *) object));
|
||||
if (pllink && pllink->initialized)
|
||||
_update_s390_subchannels ((NMDeviceEthernet *) object);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -302,7 +306,11 @@ device_state_changed (NMDevice *device,
|
|||
static void
|
||||
nm_device_ethernet_init (NMDeviceEthernet *self)
|
||||
{
|
||||
NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE (self);
|
||||
NMDeviceEthernetPrivate *priv;
|
||||
|
||||
priv = G_TYPE_INSTANCE_GET_PRIVATE (self, NM_TYPE_DEVICE_ETHERNET, NMDeviceEthernetPrivate);
|
||||
self->_priv = priv;
|
||||
|
||||
priv->s390_options = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
|
||||
}
|
||||
|
||||
|
|
@ -934,7 +942,7 @@ pppoe_stage3_ip4_config_start (NMDeviceEthernet *self, NMDeviceStateReason *reas
|
|||
req = nm_device_get_act_request (NM_DEVICE (self));
|
||||
g_assert (req);
|
||||
|
||||
s_pppoe = (NMSettingPppoe *) nm_device_get_applied_setting (self, NM_TYPE_SETTING_PPPOE);
|
||||
s_pppoe = (NMSettingPppoe *) nm_device_get_applied_setting ((NMDevice *) self, NM_TYPE_SETTING_PPPOE);
|
||||
g_assert (s_pppoe);
|
||||
|
||||
priv->ppp_manager = nm_ppp_manager_new (nm_device_get_iface (NM_DEVICE (self)));
|
||||
|
|
@ -960,22 +968,6 @@ pppoe_stage3_ip4_config_start (NMDeviceEthernet *self, NMDeviceStateReason *reas
|
|||
|
||||
/****************************************************************/
|
||||
|
||||
static void
|
||||
dcb_timeout_cleanup (NMDevice *device)
|
||||
{
|
||||
NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE (device);
|
||||
|
||||
nm_clear_g_source (&priv->dcb_timeout_id);
|
||||
}
|
||||
|
||||
static void
|
||||
dcb_carrier_cleanup (NMDevice *device)
|
||||
{
|
||||
NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE (device);
|
||||
|
||||
nm_clear_g_signal_handler (device, &priv->dcb_carrier_id);
|
||||
}
|
||||
|
||||
static void dcb_state (NMDevice *device, gboolean timeout);
|
||||
|
||||
static gboolean
|
||||
|
|
@ -999,12 +991,12 @@ dcb_carrier_timeout (gpointer user_data)
|
|||
static gboolean
|
||||
dcb_configure (NMDevice *device)
|
||||
{
|
||||
NMDeviceEthernet *self = NM_DEVICE_ETHERNET (device);
|
||||
NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE (device);
|
||||
NMDeviceEthernet *self = (NMDeviceEthernet *) device;
|
||||
NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE (self);
|
||||
NMSettingDcb *s_dcb;
|
||||
GError *error = NULL;
|
||||
|
||||
dcb_timeout_cleanup (device);
|
||||
nm_clear_g_source (&priv->dcb_timeout_id);
|
||||
|
||||
s_dcb = (NMSettingDcb *) nm_device_get_applied_setting (device, NM_TYPE_SETTING_DCB);
|
||||
g_assert (s_dcb);
|
||||
|
|
@ -1031,7 +1023,7 @@ dcb_enable (NMDevice *device)
|
|||
NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE (self);
|
||||
GError *error = NULL;
|
||||
|
||||
dcb_timeout_cleanup (device);
|
||||
nm_clear_g_source (&priv->dcb_timeout_id);
|
||||
if (!nm_dcb_enable (nm_device_get_iface (device), TRUE, &error)) {
|
||||
_LOGW (LOGD_DCB, "Activation: (ethernet) failed to enable DCB/FCoE: %s",
|
||||
error->message);
|
||||
|
|
@ -1069,9 +1061,9 @@ dcb_state (NMDevice *device, gboolean timeout)
|
|||
case DCB_WAIT_CARRIER_PREENABLE_UP:
|
||||
if (timeout || carrier) {
|
||||
_LOGD (LOGD_DCB, "dcb_state() enabling DCB");
|
||||
dcb_timeout_cleanup (device);
|
||||
nm_clear_g_source (&priv->dcb_timeout_id);
|
||||
if (!dcb_enable (device)) {
|
||||
dcb_carrier_cleanup (device);
|
||||
nm_clear_g_signal_handler (device, &priv->dcb_carrier_id);
|
||||
nm_device_state_changed (device,
|
||||
NM_DEVICE_STATE_FAILED,
|
||||
NM_DEVICE_STATE_REASON_DCB_FCOE_FAILED);
|
||||
|
|
@ -1079,7 +1071,7 @@ dcb_state (NMDevice *device, gboolean timeout)
|
|||
}
|
||||
break;
|
||||
case DCB_WAIT_CARRIER_PRECONFIG_DOWN:
|
||||
dcb_timeout_cleanup (device);
|
||||
nm_clear_g_source (&priv->dcb_timeout_id);
|
||||
priv->dcb_wait = DCB_WAIT_CARRIER_PRECONFIG_UP;
|
||||
|
||||
if (!carrier) {
|
||||
|
|
@ -1093,9 +1085,9 @@ dcb_state (NMDevice *device, gboolean timeout)
|
|||
case DCB_WAIT_CARRIER_PRECONFIG_UP:
|
||||
if (timeout || carrier) {
|
||||
_LOGD (LOGD_DCB, "dcb_state() preconfig up configuring DCB");
|
||||
dcb_timeout_cleanup (device);
|
||||
nm_clear_g_source (&priv->dcb_timeout_id);
|
||||
if (!dcb_configure (device)) {
|
||||
dcb_carrier_cleanup (device);
|
||||
nm_clear_g_signal_handler (device, &priv->dcb_carrier_id);
|
||||
nm_device_state_changed (device,
|
||||
NM_DEVICE_STATE_FAILED,
|
||||
NM_DEVICE_STATE_REASON_DCB_FCOE_FAILED);
|
||||
|
|
@ -1103,7 +1095,7 @@ dcb_state (NMDevice *device, gboolean timeout)
|
|||
}
|
||||
break;
|
||||
case DCB_WAIT_CARRIER_POSTCONFIG_DOWN:
|
||||
dcb_timeout_cleanup (device);
|
||||
nm_clear_g_source (&priv->dcb_timeout_id);
|
||||
priv->dcb_wait = DCB_WAIT_CARRIER_POSTCONFIG_UP;
|
||||
|
||||
if (!carrier) {
|
||||
|
|
@ -1117,8 +1109,8 @@ dcb_state (NMDevice *device, gboolean timeout)
|
|||
case DCB_WAIT_CARRIER_POSTCONFIG_UP:
|
||||
if (timeout || carrier) {
|
||||
_LOGD (LOGD_DCB, "dcb_state() postconfig up starting IP");
|
||||
dcb_timeout_cleanup (device);
|
||||
dcb_carrier_cleanup (device);
|
||||
nm_clear_g_source (&priv->dcb_timeout_id);
|
||||
nm_clear_g_signal_handler (device, &priv->dcb_carrier_id);
|
||||
priv->dcb_wait = DCB_WAIT_UNKNOWN;
|
||||
nm_device_activate_schedule_stage3_ip_config_start (device);
|
||||
}
|
||||
|
|
@ -1188,7 +1180,7 @@ found:
|
|||
static NMActStageReturn
|
||||
act_stage2_config (NMDevice *device, NMDeviceStateReason *reason)
|
||||
{
|
||||
NMDeviceEthernet *self = NM_DEVICE_ETHERNET (device);
|
||||
NMDeviceEthernet *self = (NMDeviceEthernet *) device;
|
||||
NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE (self);
|
||||
NMSettingConnection *s_con;
|
||||
const char *connection_type;
|
||||
|
|
@ -1201,8 +1193,8 @@ act_stage2_config (NMDevice *device, NMDeviceStateReason *reason)
|
|||
NM_TYPE_SETTING_CONNECTION));
|
||||
g_assert (s_con);
|
||||
|
||||
dcb_timeout_cleanup (device);
|
||||
dcb_carrier_cleanup (device);
|
||||
nm_clear_g_source (&priv->dcb_timeout_id);
|
||||
nm_clear_g_signal_handler (device, &priv->dcb_carrier_id);
|
||||
|
||||
/* 802.1x has to run before any IP configuration since the 802.1x auth
|
||||
* process opens the port up for normal traffic.
|
||||
|
|
@ -1299,7 +1291,7 @@ ip4_config_pre_commit (NMDevice *device, NMIP4Config *config)
|
|||
guint32 mtu;
|
||||
|
||||
/* MTU only set for plain ethernet */
|
||||
if (NM_DEVICE_ETHERNET_GET_PRIVATE (device)->ppp_manager)
|
||||
if (NM_DEVICE_ETHERNET_GET_PRIVATE ((NMDeviceEthernet *) device)->ppp_manager)
|
||||
return;
|
||||
|
||||
connection = nm_device_get_applied_connection (device);
|
||||
|
|
@ -1336,8 +1328,8 @@ deactivate (NMDevice *device)
|
|||
supplicant_interface_release (self);
|
||||
|
||||
priv->dcb_wait = DCB_WAIT_UNKNOWN;
|
||||
dcb_timeout_cleanup (device);
|
||||
dcb_carrier_cleanup (device);
|
||||
nm_clear_g_source (&priv->dcb_timeout_id);
|
||||
nm_clear_g_signal_handler (device, &priv->dcb_carrier_id);
|
||||
|
||||
/* Tear down DCB/FCoE if it was enabled */
|
||||
s_dcb = (NMSettingDcb *) nm_device_get_applied_setting (device, NM_TYPE_SETTING_DCB);
|
||||
|
|
@ -1351,7 +1343,7 @@ deactivate (NMDevice *device)
|
|||
|
||||
/* Set last PPPoE connection time */
|
||||
if (nm_device_get_applied_setting (device, NM_TYPE_SETTING_PPPOE))
|
||||
NM_DEVICE_ETHERNET_GET_PRIVATE (device)->last_pppoe_time = nm_utils_get_monotonic_timestamp_s ();
|
||||
priv->last_pppoe_time = nm_utils_get_monotonic_timestamp_s ();
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
|
@ -1473,7 +1465,7 @@ static NMMatchSpecMatchType
|
|||
spec_match_list (NMDevice *device, const GSList *specs)
|
||||
{
|
||||
NMMatchSpecMatchType matched = NM_MATCH_SPEC_NO_MATCH, m;
|
||||
NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE (device);
|
||||
NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE ((NMDeviceEthernet *) device);
|
||||
|
||||
if (priv->subchannels)
|
||||
matched = nm_match_spec_s390_subchannels (specs, priv->subchannels);
|
||||
|
|
@ -1487,7 +1479,7 @@ spec_match_list (NMDevice *device, const GSList *specs)
|
|||
static void
|
||||
update_connection (NMDevice *device, NMConnection *connection)
|
||||
{
|
||||
NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE (device);
|
||||
NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE ((NMDeviceEthernet *) device);
|
||||
NMSettingWired *s_wired = nm_connection_get_setting_wired (connection);
|
||||
const char *perm_hw_addr = nm_device_get_permanent_hw_address (device, FALSE);
|
||||
const char *mac = nm_device_get_hw_address (device);
|
||||
|
|
@ -1546,7 +1538,7 @@ get_link_speed (NMDevice *device)
|
|||
return;
|
||||
|
||||
priv->speed = speed;
|
||||
g_object_notify (G_OBJECT (device), "speed");
|
||||
_notify (self, PROP_SPEED);
|
||||
|
||||
_LOGD (LOGD_HW | LOGD_ETHER, "speed is now %d Mb/s", speed);
|
||||
}
|
||||
|
|
@ -1563,12 +1555,9 @@ carrier_changed (NMDevice *device, gboolean carrier)
|
|||
static void
|
||||
link_changed (NMDevice *device, NMPlatformLink *info)
|
||||
{
|
||||
NMDeviceEthernet *self = NM_DEVICE_ETHERNET (device);
|
||||
NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE (self);
|
||||
|
||||
NM_DEVICE_CLASS (nm_device_ethernet_parent_class)->link_changed (device, info);
|
||||
if (!priv->subchan1 && info->initialized)
|
||||
_update_s390_subchannels (self);
|
||||
if (info->initialized)
|
||||
_update_s390_subchannels ((NMDeviceEthernet *) device);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
|
@ -1590,8 +1579,8 @@ dispose (GObject *object)
|
|||
|
||||
nm_clear_g_source (&priv->pppoe_wait_id);
|
||||
|
||||
dcb_timeout_cleanup (NM_DEVICE (self));
|
||||
dcb_carrier_cleanup (NM_DEVICE (self));
|
||||
nm_clear_g_source (&priv->dcb_timeout_id);
|
||||
nm_clear_g_signal_handler (self, &priv->dcb_carrier_id);
|
||||
|
||||
G_OBJECT_CLASS (nm_device_ethernet_parent_class)->dispose (object);
|
||||
}
|
||||
|
|
@ -1656,7 +1645,7 @@ nm_device_ethernet_class_init (NMDeviceEthernetClass *klass)
|
|||
NM_DEVICE_CLASS_DECLARE_TYPES (klass, NM_SETTING_WIRED_SETTING_NAME, NM_LINK_TYPE_ETHERNET)
|
||||
|
||||
/* virtual methods */
|
||||
object_class->constructor = constructor;
|
||||
object_class->constructed = constructed;
|
||||
object_class->dispose = dispose;
|
||||
object_class->finalize = finalize;
|
||||
object_class->get_property = get_property;
|
||||
|
|
@ -1680,20 +1669,19 @@ nm_device_ethernet_class_init (NMDeviceEthernetClass *klass)
|
|||
|
||||
parent_class->state_changed = device_state_changed;
|
||||
|
||||
/* properties */
|
||||
g_object_class_install_property
|
||||
(object_class, PROP_SPEED,
|
||||
g_param_spec_uint (NM_DEVICE_ETHERNET_SPEED, "", "",
|
||||
0, G_MAXUINT32, 0,
|
||||
G_PARAM_READABLE |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
obj_properties[PROP_SPEED] =
|
||||
g_param_spec_uint (NM_DEVICE_ETHERNET_SPEED, "", "",
|
||||
0, G_MAXUINT32, 0,
|
||||
G_PARAM_READABLE |
|
||||
G_PARAM_STATIC_STRINGS);
|
||||
|
||||
g_object_class_install_property
|
||||
(object_class, PROP_S390_SUBCHANNELS,
|
||||
g_param_spec_boxed (NM_DEVICE_ETHERNET_S390_SUBCHANNELS, "", "",
|
||||
G_TYPE_STRV,
|
||||
G_PARAM_READABLE |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
obj_properties[PROP_S390_SUBCHANNELS] =
|
||||
g_param_spec_boxed (NM_DEVICE_ETHERNET_S390_SUBCHANNELS, "", "",
|
||||
G_TYPE_STRV,
|
||||
G_PARAM_READABLE |
|
||||
G_PARAM_STATIC_STRINGS);
|
||||
|
||||
g_object_class_install_properties (object_class, _PROPERTY_ENUMS_LAST, obj_properties);
|
||||
|
||||
nm_exported_object_class_add_interface (NM_EXPORTED_OBJECT_CLASS (klass),
|
||||
NMDBUS_TYPE_DEVICE_ETHERNET_SKELETON,
|
||||
|
|
|
|||
|
|
@ -36,8 +36,16 @@ G_BEGIN_DECLS
|
|||
#define NM_DEVICE_ETHERNET_SPEED "speed"
|
||||
#define NM_DEVICE_ETHERNET_S390_SUBCHANNELS "s390-subchannels"
|
||||
|
||||
typedef NMDevice NMDeviceEthernet;
|
||||
typedef NMDeviceClass NMDeviceEthernetClass;
|
||||
struct _NMDeviceEthernetPrivate;
|
||||
|
||||
typedef struct {
|
||||
NMDevice parent;
|
||||
struct _NMDeviceEthernetPrivate *_priv;
|
||||
} NMDeviceEthernet;
|
||||
|
||||
typedef struct {
|
||||
NMDeviceClass parent_class;
|
||||
} NMDeviceEthernetClass;
|
||||
|
||||
GType nm_device_ethernet_get_type (void);
|
||||
|
||||
|
|
|
|||
|
|
@ -38,23 +38,44 @@
|
|||
#include "nm-device-logging.h"
|
||||
_LOG_DECLARE_SELF(NMDeviceVeth);
|
||||
|
||||
G_DEFINE_TYPE (NMDeviceVeth, nm_device_veth, NM_TYPE_DEVICE_ETHERNET)
|
||||
|
||||
#define NM_DEVICE_VETH_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_DEVICE_VETH, NMDeviceVethPrivate))
|
||||
/*****************************************************************************/
|
||||
|
||||
typedef struct {
|
||||
NMDevice *peer;
|
||||
gboolean ever_had_peer;
|
||||
} NMDeviceVethPrivate;
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
PROP_PEER,
|
||||
|
||||
LAST_PROP
|
||||
struct _NMDeviceVeth {
|
||||
NMDeviceEthernet parent;
|
||||
NMDeviceVethPrivate _priv;
|
||||
};
|
||||
|
||||
/**************************************************************/
|
||||
struct _NMDeviceVethClass {
|
||||
NMDeviceEthernetClass parent_class;
|
||||
};
|
||||
|
||||
NM_GOBJECT_PROPERTIES_DEFINE (NMDeviceVeth,
|
||||
PROP_PEER,
|
||||
);
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
G_DEFINE_TYPE (NMDeviceVeth, nm_device_veth, NM_TYPE_DEVICE_ETHERNET)
|
||||
|
||||
#define NM_DEVICE_VETH_GET_PRIVATE(self) \
|
||||
({ \
|
||||
/* preserve the const-ness of self. Unfortunately, that
|
||||
* way, @self cannot be a void pointer */ \
|
||||
typeof (self) _self = (self); \
|
||||
\
|
||||
/* Get compiler error if variable is of wrong type */ \
|
||||
_nm_unused const NMDeviceVeth *_self2 = (_self); \
|
||||
\
|
||||
nm_assert (NM_IS_DEVICE_VETH (_self)); \
|
||||
&_self->_priv; \
|
||||
})
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static void
|
||||
set_peer (NMDeviceVeth *self, NMDevice *peer)
|
||||
|
|
@ -66,7 +87,7 @@ set_peer (NMDeviceVeth *self, NMDevice *peer)
|
|||
priv->peer = peer;
|
||||
g_object_add_weak_pointer (G_OBJECT (peer), (gpointer *) &priv->peer);
|
||||
|
||||
g_object_notify (G_OBJECT (self), NM_DEVICE_VETH_PEER);
|
||||
_notify (self, PROP_PEER);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -150,8 +171,6 @@ nm_device_veth_class_init (NMDeviceVethClass *klass)
|
|||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
NMDeviceClass *device_class = NM_DEVICE_CLASS (klass);
|
||||
|
||||
g_type_class_add_private (klass, sizeof (NMDeviceVethPrivate));
|
||||
|
||||
NM_DEVICE_CLASS_DECLARE_TYPES (klass, NULL, NM_LINK_TYPE_VETH)
|
||||
|
||||
object_class->get_property = get_property;
|
||||
|
|
@ -159,13 +178,13 @@ nm_device_veth_class_init (NMDeviceVethClass *klass)
|
|||
|
||||
device_class->can_unmanaged_external_down = can_unmanaged_external_down;
|
||||
|
||||
/* properties */
|
||||
g_object_class_install_property
|
||||
(object_class, PROP_PEER,
|
||||
g_param_spec_string (NM_DEVICE_VETH_PEER, "", "",
|
||||
NULL,
|
||||
G_PARAM_READABLE |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
obj_properties[PROP_PEER] =
|
||||
g_param_spec_string (NM_DEVICE_VETH_PEER, "", "",
|
||||
NULL,
|
||||
G_PARAM_READABLE |
|
||||
G_PARAM_STATIC_STRINGS);
|
||||
|
||||
g_object_class_install_properties (object_class, _PROPERTY_ENUMS_LAST, obj_properties);
|
||||
|
||||
nm_exported_object_class_add_interface (NM_EXPORTED_OBJECT_CLASS (klass),
|
||||
NMDBUS_TYPE_DEVICE_VETH_SKELETON,
|
||||
|
|
|
|||
|
|
@ -34,8 +34,8 @@ G_BEGIN_DECLS
|
|||
|
||||
#define NM_DEVICE_VETH_PEER "peer"
|
||||
|
||||
typedef NMDeviceEthernet NMDeviceVeth;
|
||||
typedef NMDeviceEthernetClass NMDeviceVethClass;
|
||||
typedef struct _NMDeviceVeth NMDeviceVeth;
|
||||
typedef struct _NMDeviceVethClass NMDeviceVethClass;
|
||||
|
||||
GType nm_device_veth_get_type (void);
|
||||
|
||||
|
|
|
|||
|
|
@ -6440,11 +6440,18 @@ set_nm_ipv6ll (NMDevice *self, gboolean enable)
|
|||
|
||||
priv->nm_ipv6ll = enable;
|
||||
if (ifindex > 0) {
|
||||
NMPlatformError plerr;
|
||||
const char *detail = enable ? "enable" : "disable";
|
||||
|
||||
_LOGD (LOGD_IP6, "will %s userland IPv6LL", detail);
|
||||
if (!nm_platform_link_set_user_ipv6ll_enabled (NM_PLATFORM_GET, ifindex, enable))
|
||||
_LOGW (LOGD_IP6, "failed to %s userspace IPv6LL address handling", detail);
|
||||
plerr = nm_platform_link_set_user_ipv6ll_enabled (NM_PLATFORM_GET, ifindex, enable);
|
||||
if (plerr != NM_PLATFORM_ERROR_SUCCESS) {
|
||||
_NMLOG (plerr == NM_PLATFORM_ERROR_NOT_FOUND ? LOGL_DEBUG : LOGL_WARN,
|
||||
LOGD_IP6,
|
||||
"failed to %s userspace IPv6LL address handling (%s)",
|
||||
detail,
|
||||
nm_platform_error_to_string (plerr));
|
||||
}
|
||||
|
||||
if (enable) {
|
||||
/* Bounce IPv6 to ensure the kernel stops IPv6LL address generation */
|
||||
|
|
@ -11657,6 +11664,7 @@ _hw_addr_set (NMDevice *self,
|
|||
{
|
||||
NMDevicePrivate *priv;
|
||||
gboolean success = FALSE;
|
||||
NMPlatformError plerr;
|
||||
const char *cur_addr;
|
||||
guint8 addr_bytes[NM_UTILS_HWADDR_LEN_MAX];
|
||||
guint hw_addr_len;
|
||||
|
|
@ -11691,7 +11699,8 @@ _hw_addr_set (NMDevice *self,
|
|||
nm_device_take_down (self, FALSE);
|
||||
}
|
||||
|
||||
success = nm_platform_link_set_address (NM_PLATFORM_GET, nm_device_get_ip_ifindex (self), addr_bytes, hw_addr_len);
|
||||
plerr = nm_platform_link_set_address (NM_PLATFORM_GET, nm_device_get_ip_ifindex (self), addr_bytes, hw_addr_len);
|
||||
success = (plerr == NM_PLATFORM_ERROR_SUCCESS);
|
||||
if (success) {
|
||||
/* MAC address succesfully changed; update the current MAC to match */
|
||||
nm_device_update_hw_address (self);
|
||||
|
|
@ -11706,8 +11715,10 @@ _hw_addr_set (NMDevice *self,
|
|||
success = FALSE;
|
||||
}
|
||||
} else {
|
||||
_LOGW (LOGD_DEVICE, "set-hw-addr: failed to %s MAC address to %s (%s)",
|
||||
operation, addr, detail);
|
||||
_NMLOG (plerr == NM_PLATFORM_ERROR_NOT_FOUND ? LOGL_DEBUG : LOGL_WARN,
|
||||
LOGD_DEVICE, "set-hw-addr: failed to %s MAC address to %s (%s) (%s)",
|
||||
operation, addr, detail,
|
||||
nm_platform_error_to_string (plerr));
|
||||
}
|
||||
|
||||
if (was_up) {
|
||||
|
|
|
|||
|
|
@ -664,7 +664,8 @@ _nm_log_impl (const char *file,
|
|||
_iovec_set_format (iov, iov_free, i_field++, "NM_LOG_DOMAINS=%s", s_domain_1);
|
||||
}
|
||||
_iovec_set_format (iov, iov_free, i_field++, "NM_LOG_LEVEL=%s", global.level_desc[level].name);
|
||||
_iovec_set_format (iov, iov_free, i_field++, "CODE_FUNC=%s", func ?: "");
|
||||
if (func)
|
||||
_iovec_set_format (iov, iov_free, i_field++, "CODE_FUNC=%s", func);
|
||||
_iovec_set_format (iov, iov_free, i_field++, "CODE_FILE=%s", file ?: "");
|
||||
_iovec_set_format (iov, iov_free, i_field++, "CODE_LINE=%u", line);
|
||||
_iovec_set_format (iov, iov_free, i_field++, "TIMESTAMP_MONOTONIC=%lld.%06lld", (long long) (now / NM_UTILS_NS_PER_SECOND), (long long) ((now % NM_UTILS_NS_PER_SECOND) / 1000));
|
||||
|
|
|
|||
|
|
@ -103,12 +103,20 @@ typedef enum { /*< skip >*/
|
|||
#define nm_log_dbg(domain, ...) nm_log (LOGL_DEBUG, (domain), __VA_ARGS__)
|
||||
#define nm_log_trace(domain, ...) nm_log (LOGL_TRACE, (domain), __VA_ARGS__)
|
||||
|
||||
//#define _NM_LOG_FUNC G_STRFUNC
|
||||
#define _NM_LOG_FUNC NULL
|
||||
|
||||
/* A wrapper for the _nm_log_impl() function that adds call site information.
|
||||
* Contrary to nm_log(), it unconditionally calls the function without
|
||||
* checking whether logging for the given level and domain is enabled. */
|
||||
#define _nm_log(level, domain, error, ...) \
|
||||
G_STMT_START { \
|
||||
_nm_log_impl (__FILE__, __LINE__, G_STRFUNC, (level), (domain), (error), ""__VA_ARGS__); \
|
||||
_nm_log_impl (__FILE__, __LINE__, \
|
||||
_NM_LOG_FUNC, \
|
||||
(level), \
|
||||
(domain), \
|
||||
(error), \
|
||||
""__VA_ARGS__); \
|
||||
} G_STMT_END
|
||||
|
||||
/* nm_log() only evaluates it's argument list after checking
|
||||
|
|
|
|||
|
|
@ -506,7 +506,7 @@ link_set_noarp (NMPlatform *platform, int ifindex)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
static NMPlatformError
|
||||
link_set_address (NMPlatform *platform, int ifindex, gconstpointer addr, size_t len)
|
||||
{
|
||||
NMFakePlatformLink *device = link_get (platform, ifindex);
|
||||
|
|
@ -515,7 +515,7 @@ link_set_address (NMPlatform *platform, int ifindex, gconstpointer addr, size_t
|
|||
|| len == 0
|
||||
|| len > NM_UTILS_HWADDR_LEN_MAX
|
||||
|| !addr)
|
||||
g_return_val_if_reached (FALSE);
|
||||
g_return_val_if_reached (NM_PLATFORM_ERROR_BUG);
|
||||
|
||||
if ( device->link.addr.len != len
|
||||
|| ( len > 0
|
||||
|
|
@ -525,7 +525,7 @@ link_set_address (NMPlatform *platform, int ifindex, gconstpointer addr, size_t
|
|||
link_changed (platform, link_get (platform, ifindex), TRUE);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
return NM_PLATFORM_ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
|
|
|||
|
|
@ -4089,6 +4089,9 @@ retry:
|
|||
} else if (NM_IN_SET (-((int) seq_result), ESRCH, ENOENT)) {
|
||||
log_detail = ", firmware not found";
|
||||
result = NM_PLATFORM_ERROR_NO_FIRMWARE;
|
||||
} else if (NM_IN_SET (-((int) seq_result), ENODEV)) {
|
||||
log_level = LOGL_DEBUG;
|
||||
result = NM_PLATFORM_ERROR_NOT_FOUND;
|
||||
} else {
|
||||
log_level = LOGL_ERR;
|
||||
result = NM_PLATFORM_ERROR_UNSPECIFIED;
|
||||
|
|
@ -4325,7 +4328,7 @@ link_get_udev_device (NMPlatform *platform, int ifindex)
|
|||
return obj_cache ? (GObject *) obj_cache->_link.udev.device : NULL;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
static NMPlatformError
|
||||
link_set_user_ipv6ll_enabled (NMPlatform *platform, int ifindex, gboolean enabled)
|
||||
{
|
||||
nm_auto_nlmsg struct nl_msg *nlmsg = NULL;
|
||||
|
|
@ -4333,7 +4336,7 @@ link_set_user_ipv6ll_enabled (NMPlatform *platform, int ifindex, gboolean enable
|
|||
|
||||
if (!_support_user_ipv6ll_get ()) {
|
||||
_LOGD ("link: change %d: user-ipv6ll: not supported", ifindex);
|
||||
return FALSE;
|
||||
return NM_PLATFORM_ERROR_OPNOTSUPP;
|
||||
}
|
||||
|
||||
_LOGD ("link: change %d: user-ipv6ll: set IPv6 address generation mode to %s",
|
||||
|
|
@ -4348,9 +4351,9 @@ link_set_user_ipv6ll_enabled (NMPlatform *platform, int ifindex, gboolean enable
|
|||
0);
|
||||
if ( !nlmsg
|
||||
|| !_nl_msg_new_link_set_afspec (nlmsg, mode, NULL))
|
||||
g_return_val_if_reached (FALSE);
|
||||
g_return_val_if_reached (NM_PLATFORM_ERROR_BUG);
|
||||
|
||||
return do_change_link (platform, ifindex, nlmsg) == NM_PLATFORM_ERROR_SUCCESS;
|
||||
return do_change_link (platform, ifindex, nlmsg);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
|
@ -4405,14 +4408,14 @@ link_supports_vlans (NMPlatform *platform, int ifindex)
|
|||
return nmp_utils_ethtool_supports_vlans (obj->link.name);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
static NMPlatformError
|
||||
link_set_address (NMPlatform *platform, int ifindex, gconstpointer address, size_t length)
|
||||
{
|
||||
nm_auto_nlmsg struct nl_msg *nlmsg = NULL;
|
||||
gs_free char *mac = NULL;
|
||||
|
||||
if (!address || !length)
|
||||
g_return_val_if_reached (FALSE);
|
||||
g_return_val_if_reached (NM_PLATFORM_ERROR_BUG);
|
||||
|
||||
_LOGD ("link: change %d: address: %s (%lu bytes)", ifindex,
|
||||
(mac = nm_utils_hwaddr_ntoa (address, length)),
|
||||
|
|
@ -4425,13 +4428,13 @@ link_set_address (NMPlatform *platform, int ifindex, gconstpointer address, size
|
|||
0,
|
||||
0);
|
||||
if (!nlmsg)
|
||||
return FALSE;
|
||||
g_return_val_if_reached (NM_PLATFORM_ERROR_UNSPECIFIED);
|
||||
|
||||
NLA_PUT (nlmsg, IFLA_ADDRESS, length, address);
|
||||
|
||||
return do_change_link (platform, ifindex, nlmsg) == NM_PLATFORM_ERROR_SUCCESS;
|
||||
return do_change_link (platform, ifindex, nlmsg);
|
||||
nla_put_failure:
|
||||
g_return_val_if_reached (FALSE);
|
||||
g_return_val_if_reached (NM_PLATFORM_ERROR_UNSPECIFIED);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
|
|
|||
|
|
@ -205,6 +205,7 @@ NM_UTILS_LOOKUP_STR_DEFINE (_nm_platform_error_to_string, NMPlatformError,
|
|||
NM_UTILS_LOOKUP_STR_ITEM (NM_PLATFORM_ERROR_WRONG_TYPE, "wrong-type"),
|
||||
NM_UTILS_LOOKUP_STR_ITEM (NM_PLATFORM_ERROR_NOT_SLAVE, "not-slave"),
|
||||
NM_UTILS_LOOKUP_STR_ITEM (NM_PLATFORM_ERROR_NO_FIRMWARE, "no-firmware"),
|
||||
NM_UTILS_LOOKUP_STR_ITEM (NM_PLATFORM_ERROR_OPNOTSUPP, "not-supported"),
|
||||
NM_UTILS_LOOKUP_ITEM_IGNORE (_NM_PLATFORM_ERROR_MININT),
|
||||
);
|
||||
|
||||
|
|
@ -981,18 +982,16 @@ nm_platform_link_get_user_ipv6ll_enabled (NMPlatform *self, int ifindex)
|
|||
* platform or OS doesn't support changing the IPv6LL address mode, this call
|
||||
* will fail and return %FALSE.
|
||||
*
|
||||
* Returns: %TRUE if the operation was successful, %FALSE if it failed.
|
||||
* Returns: %NM_PLATFORM_ERROR_SUCCESS if the operation was successful or an error code otherwise.
|
||||
*/
|
||||
gboolean
|
||||
NMPlatformError
|
||||
nm_platform_link_set_user_ipv6ll_enabled (NMPlatform *self, int ifindex, gboolean enabled)
|
||||
{
|
||||
_CHECK_SELF (self, klass, FALSE);
|
||||
_CHECK_SELF (self, klass, NM_PLATFORM_ERROR_BUG);
|
||||
|
||||
g_return_val_if_fail (ifindex >= 0, FALSE);
|
||||
g_return_val_if_fail (ifindex > 0, NM_PLATFORM_ERROR_BUG);
|
||||
|
||||
if (klass->link_set_user_ipv6ll_enabled)
|
||||
return klass->link_set_user_ipv6ll_enabled (self, ifindex, enabled);
|
||||
return FALSE;
|
||||
return klass->link_set_user_ipv6ll_enabled (self, ifindex, enabled);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -1003,16 +1002,18 @@ nm_platform_link_set_user_ipv6ll_enabled (NMPlatform *self, int ifindex, gboolea
|
|||
*
|
||||
* Set interface MAC address.
|
||||
*/
|
||||
gboolean
|
||||
NMPlatformError
|
||||
nm_platform_link_set_address (NMPlatform *self, int ifindex, gconstpointer address, size_t length)
|
||||
{
|
||||
_CHECK_SELF (self, klass, FALSE);
|
||||
_CHECK_SELF (self, klass, NM_PLATFORM_ERROR_BUG);
|
||||
|
||||
g_return_val_if_fail (ifindex > 0, FALSE);
|
||||
g_return_val_if_fail (address, FALSE);
|
||||
g_return_val_if_fail (length > 0, FALSE);
|
||||
g_return_val_if_fail (ifindex > 0, NM_PLATFORM_ERROR_BUG);
|
||||
g_return_val_if_fail (address, NM_PLATFORM_ERROR_BUG);
|
||||
g_return_val_if_fail (length > 0, NM_PLATFORM_ERROR_BUG);
|
||||
|
||||
_LOGD ("link: setting '%s' (%d) hardware address", nm_platform_link_get_name (self, ifindex), ifindex);
|
||||
_LOGD ("link: setting %s (%d) hardware address",
|
||||
nm_strquote_a (20, nm_platform_link_get_name (self, ifindex)),
|
||||
ifindex);
|
||||
return klass->link_set_address (self, ifindex, address, length);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -88,6 +88,7 @@ typedef enum { /*< skip >*/
|
|||
NM_PLATFORM_ERROR_WRONG_TYPE,
|
||||
NM_PLATFORM_ERROR_NOT_SLAVE,
|
||||
NM_PLATFORM_ERROR_NO_FIRMWARE,
|
||||
NM_PLATFORM_ERROR_OPNOTSUPP,
|
||||
} NMPlatformError;
|
||||
|
||||
|
||||
|
|
@ -519,14 +520,14 @@ typedef struct {
|
|||
const char *(*link_get_udi) (NMPlatform *self, int ifindex);
|
||||
GObject *(*link_get_udev_device) (NMPlatform *self, int ifindex);
|
||||
|
||||
gboolean (*link_set_user_ipv6ll_enabled) (NMPlatform *, int ifindex, gboolean enabled);
|
||||
NMPlatformError (*link_set_user_ipv6ll_enabled) (NMPlatform *, int ifindex, gboolean enabled);
|
||||
gboolean (*link_set_token) (NMPlatform *, int ifindex, NMUtilsIPv6IfaceId iid);
|
||||
|
||||
gboolean (*link_get_permanent_address) (NMPlatform *,
|
||||
int ifindex,
|
||||
guint8 *buf,
|
||||
size_t *length);
|
||||
gboolean (*link_set_address) (NMPlatform *, int ifindex, gconstpointer address, size_t length);
|
||||
NMPlatformError (*link_set_address) (NMPlatform *, int ifindex, gconstpointer address, size_t length);
|
||||
gboolean (*link_set_mtu) (NMPlatform *, int ifindex, guint32 mtu);
|
||||
|
||||
char * (*link_get_physical_port_id) (NMPlatform *, int ifindex);
|
||||
|
|
@ -753,11 +754,11 @@ const char *nm_platform_link_get_udi (NMPlatform *self, int ifindex);
|
|||
|
||||
GObject *nm_platform_link_get_udev_device (NMPlatform *self, int ifindex);
|
||||
|
||||
gboolean nm_platform_link_set_user_ipv6ll_enabled (NMPlatform *self, int ifindex, gboolean enabled);
|
||||
NMPlatformError nm_platform_link_set_user_ipv6ll_enabled (NMPlatform *self, int ifindex, gboolean enabled);
|
||||
gboolean nm_platform_link_set_ipv6_token (NMPlatform *self, int ifindex, NMUtilsIPv6IfaceId iid);
|
||||
|
||||
gboolean nm_platform_link_get_permanent_address (NMPlatform *self, int ifindex, guint8 *buf, size_t *length);
|
||||
gboolean nm_platform_link_set_address (NMPlatform *self, int ifindex, const void *address, size_t length);
|
||||
NMPlatformError nm_platform_link_set_address (NMPlatform *self, int ifindex, const void *address, size_t length);
|
||||
gboolean nm_platform_link_set_mtu (NMPlatform *self, int ifindex, guint32 mtu);
|
||||
|
||||
char *nm_platform_link_get_physical_port_id (NMPlatform *self, int ifindex);
|
||||
|
|
|
|||
|
|
@ -592,7 +592,7 @@ test_internal (void)
|
|||
g_assert (nm_platform_link_supports_vlans (NM_PLATFORM_GET, ifindex));
|
||||
|
||||
/* Set MAC address */
|
||||
g_assert (nm_platform_link_set_address (NM_PLATFORM_GET, ifindex, mac, sizeof (mac)));
|
||||
g_assert (nm_platform_link_set_address (NM_PLATFORM_GET, ifindex, mac, sizeof (mac)) == NM_PLATFORM_ERROR_SUCCESS);
|
||||
address = nm_platform_link_get_address (NM_PLATFORM_GET, ifindex, &addrlen);
|
||||
g_assert (addrlen == sizeof(mac));
|
||||
g_assert (!memcmp (address, mac, addrlen));
|
||||
|
|
|
|||
|
|
@ -470,7 +470,7 @@ nm_ifcfg_connection_init (NMIfcfgConnection *connection)
|
|||
|
||||
static void
|
||||
set_property (GObject *object, guint prop_id,
|
||||
const GValue *value, GParamSpec *pspec)
|
||||
const GValue *value, GParamSpec *pspec)
|
||||
{
|
||||
NMIfcfgConnectionPrivate *priv = NM_IFCFG_CONNECTION_GET_PRIVATE (object);
|
||||
|
||||
|
|
@ -489,7 +489,7 @@ set_property (GObject *object, guint prop_id,
|
|||
|
||||
static void
|
||||
get_property (GObject *object, guint prop_id,
|
||||
GValue *value, GParamSpec *pspec)
|
||||
GValue *value, GParamSpec *pspec)
|
||||
{
|
||||
NMIfcfgConnectionPrivate *priv = NM_IFCFG_CONNECTION_GET_PRIVATE (object);
|
||||
|
||||
|
|
|
|||
|
|
@ -363,17 +363,9 @@ update_connection (SettingsPluginIfcfg *self,
|
|||
self);
|
||||
|
||||
if (nm_ifcfg_connection_get_unmanaged_spec (connection_new)) {
|
||||
const char *spec;
|
||||
const char *device_id;
|
||||
|
||||
spec = nm_ifcfg_connection_get_unmanaged_spec (connection_new);
|
||||
device_id = strchr (spec, ':');
|
||||
if (device_id)
|
||||
device_id++;
|
||||
else
|
||||
device_id = spec;
|
||||
_LOGW ("Ignoring connection "NM_IFCFG_CONNECTION_LOG_FMT" / device '%s' due to NM_CONTROLLED=no.",
|
||||
NM_IFCFG_CONNECTION_LOG_ARG (connection_new), device_id);
|
||||
_LOGI ("Ignoring connection "NM_IFCFG_CONNECTION_LOG_FMT" due to NM_CONTROLLED=no. Unmanaged: %s.",
|
||||
NM_IFCFG_CONNECTION_LOG_ARG (connection_new),
|
||||
nm_ifcfg_connection_get_unmanaged_spec (connection_new));
|
||||
} else if (nm_ifcfg_connection_get_unrecognized_spec (connection_new))
|
||||
_LOGW ("Ignoring connection "NM_IFCFG_CONNECTION_LOG_FMT" of unrecognized type.", NM_IFCFG_CONNECTION_LOG_ARG (connection_new));
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue