mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-02 17:50:29 +01:00
core: remove nm_device_hwaddr_matches() / get_connection_hw_address()
These were only needed to support the possibility of VLANs having arbitrary additional hardware settings.
This commit is contained in:
parent
066b592241
commit
e0f0f60ff5
7 changed files with 0 additions and 116 deletions
|
|
@ -378,16 +378,6 @@ complete_connection (NMDevice *device,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
static const GByteArray *
|
||||
get_connection_hw_address (NMDevice *device,
|
||||
NMConnection *connection)
|
||||
{
|
||||
NMSettingBluetooth *s_bt;
|
||||
|
||||
s_bt = nm_connection_get_setting_bluetooth (connection);
|
||||
return s_bt ? nm_setting_bluetooth_get_bdaddr (s_bt) : NULL;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* IP method PPP */
|
||||
|
||||
|
|
@ -1278,7 +1268,6 @@ nm_device_bt_class_init (NMDeviceBtClass *klass)
|
|||
device_class->check_connection_compatible = check_connection_compatible;
|
||||
device_class->check_connection_available = check_connection_available;
|
||||
device_class->complete_connection = complete_connection;
|
||||
device_class->get_connection_hw_address = get_connection_hw_address;
|
||||
device_class->is_available = is_available;
|
||||
|
||||
device_class->state_changed = device_state_changed;
|
||||
|
|
|
|||
|
|
@ -1275,16 +1275,6 @@ update_connection (NMDevice *device, NMConnection *connection)
|
|||
/* We don't set the MTU as we don't know whether it was set explicitly */
|
||||
}
|
||||
|
||||
static const GByteArray *
|
||||
get_connection_hw_address (NMDevice *device,
|
||||
NMConnection *connection)
|
||||
{
|
||||
NMSettingWired *s_wired;
|
||||
|
||||
s_wired = nm_connection_get_setting_wired (connection);
|
||||
return s_wired ? nm_setting_wired_get_mac_address (s_wired) : NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
get_link_speed (NMDevice *device)
|
||||
{
|
||||
|
|
@ -1414,7 +1404,6 @@ nm_device_ethernet_class_init (NMDeviceEthernetClass *klass)
|
|||
parent_class->deactivate = deactivate;
|
||||
parent_class->spec_match_list = spec_match_list;
|
||||
parent_class->update_connection = update_connection;
|
||||
parent_class->get_connection_hw_address = get_connection_hw_address;
|
||||
parent_class->carrier_changed = carrier_changed;
|
||||
|
||||
parent_class->state_changed = device_state_changed;
|
||||
|
|
|
|||
|
|
@ -306,16 +306,6 @@ match_l2_config (NMDevice *self, NMConnection *connection)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
static const GByteArray *
|
||||
get_connection_hw_address (NMDevice *device,
|
||||
NMConnection *connection)
|
||||
{
|
||||
NMSettingInfiniband *s_ib;
|
||||
|
||||
s_ib = nm_connection_get_setting_infiniband (connection);
|
||||
return s_ib ? nm_setting_infiniband_get_mac_address (s_ib) : NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
get_property (GObject *object, guint prop_id,
|
||||
GValue *value, GParamSpec *pspec)
|
||||
|
|
@ -358,7 +348,6 @@ nm_device_infiniband_class_init (NMDeviceInfinibandClass *klass)
|
|||
parent_class->act_stage1_prepare = act_stage1_prepare;
|
||||
parent_class->ip4_config_pre_commit = ip4_config_pre_commit;
|
||||
parent_class->match_l2_config = match_l2_config;
|
||||
parent_class->get_connection_hw_address = get_connection_hw_address;
|
||||
|
||||
/* properties */
|
||||
|
||||
|
|
|
|||
|
|
@ -3318,16 +3318,6 @@ can_interrupt_activation (NMDevice *dev)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
static const GByteArray *
|
||||
get_connection_hw_address (NMDevice *device,
|
||||
NMConnection *connection)
|
||||
{
|
||||
NMSettingWireless *s_wifi;
|
||||
|
||||
s_wifi = nm_connection_get_setting_wireless (connection);
|
||||
return s_wifi ? nm_setting_wireless_get_mac_address (s_wifi) : NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
device_state_changed (NMDevice *device,
|
||||
NMDeviceState new_state,
|
||||
|
|
@ -3630,7 +3620,6 @@ nm_device_wifi_class_init (NMDeviceWifiClass *klass)
|
|||
parent_class->act_stage4_ip6_config_timeout = act_stage4_ip6_config_timeout;
|
||||
parent_class->deactivate = deactivate;
|
||||
parent_class->can_interrupt_activation = can_interrupt_activation;
|
||||
parent_class->get_connection_hw_address = get_connection_hw_address;
|
||||
|
||||
parent_class->state_changed = device_state_changed;
|
||||
|
||||
|
|
|
|||
|
|
@ -6495,58 +6495,6 @@ nm_device_find_assumable_connection (NMDevice *device, const GSList *connections
|
|||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_device_hwaddr_matches:
|
||||
* @device: the device to use when matching the hardware address
|
||||
* @connection: the connection which supplies the hardware address
|
||||
* @other_hwaddr: if given, use this address instead of the device's actual
|
||||
* hardware address
|
||||
* @other_hwaddr_len: length in bytes of @other_hwaddr
|
||||
* @fail_if_no_hwaddr: whether to fail the match if @connection does not contain
|
||||
* a hardware address
|
||||
*
|
||||
* Matches a the devices hardware address (or @other_hwaddr if given) against
|
||||
* the hardware-specific setting in @connection. Allows for device-agnostic
|
||||
* hardware address matching without having to know the internal details of
|
||||
* the connection and which settings are used by each device subclass.
|
||||
*
|
||||
* Returns: %TRUE if the @device 's hardware address or @other_hwaddr matches
|
||||
* a hardware address in a hardware-specific setting in @connection
|
||||
*/
|
||||
gboolean
|
||||
nm_device_hwaddr_matches (NMDevice *device,
|
||||
NMConnection *connection,
|
||||
const guint8 *other_hwaddr,
|
||||
guint other_hwaddr_len,
|
||||
gboolean fail_if_no_hwaddr)
|
||||
{
|
||||
NMDevicePrivate *priv;
|
||||
const GByteArray *setting_hwaddr;
|
||||
|
||||
g_return_val_if_fail (NM_IS_DEVICE (device), FALSE);
|
||||
priv = NM_DEVICE_GET_PRIVATE (device);
|
||||
|
||||
if (other_hwaddr)
|
||||
g_return_val_if_fail (other_hwaddr_len != priv->hw_addr_len, FALSE);
|
||||
|
||||
if (!NM_DEVICE_GET_CLASS (device)->get_connection_hw_address)
|
||||
return FALSE;
|
||||
|
||||
setting_hwaddr = NM_DEVICE_GET_CLASS (device)->get_connection_hw_address (device, connection);
|
||||
if (setting_hwaddr) {
|
||||
g_return_val_if_fail (setting_hwaddr->len == priv->hw_addr_len, FALSE);
|
||||
|
||||
if (other_hwaddr) {
|
||||
if (memcmp (setting_hwaddr->data, other_hwaddr, priv->hw_addr_len) == 0)
|
||||
return TRUE;
|
||||
} else if (memcmp (setting_hwaddr->data, priv->hw_addr, priv->hw_addr_len) == 0)
|
||||
return TRUE;
|
||||
} else if (fail_if_no_hwaddr == FALSE)
|
||||
return TRUE;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
nm_device_set_dhcp_timeout (NMDevice *device, guint32 timeout)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -196,9 +196,6 @@ typedef struct {
|
|||
gboolean (* match_l2_config) (NMDevice *self, NMConnection *connection);
|
||||
void (* update_connection) (NMDevice *device, NMConnection *connection);
|
||||
|
||||
const GByteArray * (* get_connection_hw_address) (NMDevice *self,
|
||||
NMConnection *connection);
|
||||
|
||||
gboolean (* enslave_slave) (NMDevice *self,
|
||||
NMDevice *slave,
|
||||
NMConnection *connection);
|
||||
|
|
@ -287,12 +284,6 @@ gboolean nm_device_can_assume_connections (NMDevice *device);
|
|||
NMConnection * nm_device_find_assumable_connection (NMDevice *device,
|
||||
const GSList *connections);
|
||||
|
||||
gboolean nm_device_hwaddr_matches (NMDevice *device,
|
||||
NMConnection *connection,
|
||||
const guint8 *other_hwaddr,
|
||||
guint other_hwaddr_len,
|
||||
gboolean fail_if_no_hwaddr);
|
||||
|
||||
gboolean nm_device_spec_match_list (NMDevice *device, const GSList *specs);
|
||||
|
||||
gboolean nm_device_is_activating (NMDevice *dev);
|
||||
|
|
|
|||
|
|
@ -331,16 +331,6 @@ set_enabled (NMDevice *device, gboolean enabled)
|
|||
|
||||
/* NMDevice methods */
|
||||
|
||||
static const GByteArray *
|
||||
get_connection_hw_address (NMDevice *device,
|
||||
NMConnection *connection)
|
||||
{
|
||||
NMSettingWimax *s_wimax;
|
||||
|
||||
s_wimax = nm_connection_get_setting_wimax (connection);
|
||||
return s_wimax ? nm_setting_wimax_get_mac_address (s_wimax) : NULL;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
check_connection_compatible (NMDevice *device,
|
||||
NMConnection *connection,
|
||||
|
|
@ -1391,7 +1381,6 @@ nm_device_wimax_class_init (NMDeviceWimaxClass *klass)
|
|||
device_class->act_stage2_config = act_stage2_config;
|
||||
device_class->deactivate = deactivate;
|
||||
device_class->set_enabled = set_enabled;
|
||||
device_class->get_connection_hw_address = get_connection_hw_address;
|
||||
|
||||
device_class->state_changed = device_state_changed;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue