diff options
Diffstat (limited to 'libnm-glib/nm-device-infiniband.c')
-rw-r--r-- | libnm-glib/nm-device-infiniband.c | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/libnm-glib/nm-device-infiniband.c b/libnm-glib/nm-device-infiniband.c index d611993be..b60b2d821 100644 --- a/libnm-glib/nm-device-infiniband.c +++ b/libnm-glib/nm-device-infiniband.c @@ -54,9 +54,6 @@ enum { LAST_PROP }; -#define DBUS_PROP_HW_ADDRESS "HwAddress" -#define DBUS_PROP_CARRIER "Carrier" - /** * nm_device_infiniband_error_quark: * @@ -143,8 +140,6 @@ connection_compatible (NMDevice *device, NMConnection *connection, GError **erro const GByteArray *mac; guint8 *hwaddr, hwaddr_buf[INFINIBAND_ALEN]; - g_return_val_if_fail (error == NULL || *error == NULL, FALSE); - s_con = nm_connection_get_setting_connection (connection); g_assert (s_con); @@ -171,14 +166,28 @@ connection_compatible (NMDevice *device, NMConnection *connection, GError **erro return FALSE; } mac = nm_setting_infiniband_get_mac_address (s_infiniband); - if (mac && hwaddr && memcmp (mac->data, hwaddr, INFINIBAND_ALEN)) { + + /* We only match against the last 8 bytes */ + if (mac && hwaddr && memcmp (mac->data + INFINIBAND_ALEN - 8, hwaddr + INFINIBAND_ALEN - 8, 8)) { g_set_error (error, NM_DEVICE_INFINIBAND_ERROR, NM_DEVICE_INFINIBAND_ERROR_MAC_MISMATCH, "The MACs of the device and the connection didn't match."); return FALSE; } } - return TRUE; + return NM_DEVICE_CLASS (nm_device_infiniband_parent_class)->connection_compatible (device, connection, error); +} + +static GType +get_setting_type (NMDevice *device) +{ + return NM_TYPE_SETTING_INFINIBAND; +} + +static const char * +get_hw_address (NMDevice *device) +{ + return nm_device_infiniband_get_hw_address (NM_DEVICE_INFINIBAND (device)); } /***********************************************************/ @@ -207,17 +216,11 @@ register_properties (NMDeviceInfiniband *device) static void constructed (GObject *object) { - NMDeviceInfinibandPrivate *priv; + NMDeviceInfinibandPrivate *priv = NM_DEVICE_INFINIBAND_GET_PRIVATE (object); G_OBJECT_CLASS (nm_device_infiniband_parent_class)->constructed (object); - priv = NM_DEVICE_INFINIBAND_GET_PRIVATE (object); - - priv->proxy = dbus_g_proxy_new_for_name (nm_object_get_connection (NM_OBJECT (object)), - NM_DBUS_SERVICE, - nm_object_get_path (NM_OBJECT (object)), - NM_DBUS_INTERFACE_DEVICE_INFINIBAND); - + priv->proxy = _nm_object_new_proxy (NM_OBJECT (object), NULL, NM_DBUS_INTERFACE_DEVICE_INFINIBAND); register_properties (NM_DEVICE_INFINIBAND (object)); } @@ -278,6 +281,8 @@ nm_device_infiniband_class_init (NMDeviceInfinibandClass *eth_class) object_class->finalize = finalize; object_class->get_property = get_property; device_class->connection_compatible = connection_compatible; + device_class->get_setting_type = get_setting_type; + device_class->get_hw_address = get_hw_address; /* properties */ |