mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-06 23:20:34 +01:00
core: match the NMSettingBridge:mac-address in NMDeviceBridge:check_connection_compatible()
https://bugzilla.gnome.org/show_bug.cgi?id=729844 Signed-off-by: Thomas Haller <thaller@redhat.com>
This commit is contained in:
parent
1701a70b9e
commit
6e06a7d4a1
1 changed files with 16 additions and 0 deletions
|
|
@ -102,6 +102,7 @@ check_connection_compatible (NMDevice *device,
|
|||
{
|
||||
const char *iface;
|
||||
NMSettingBridge *s_bridge;
|
||||
const GByteArray *mac_address;
|
||||
|
||||
if (!NM_DEVICE_CLASS (nm_device_bridge_parent_class)->check_connection_compatible (device, connection, error))
|
||||
return FALSE;
|
||||
|
|
@ -121,6 +122,21 @@ check_connection_compatible (NMDevice *device,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
mac_address = nm_setting_bridge_get_mac_address (s_bridge);
|
||||
if (mac_address) {
|
||||
guint hw_len;
|
||||
const guint8 *hw_addr;
|
||||
|
||||
hw_addr = nm_device_get_hw_address (device, &hw_len);
|
||||
if ( !hw_addr
|
||||
|| hw_len != mac_address->len
|
||||
|| memcmp (mac_address->data, hw_addr, hw_len) != 0) {
|
||||
g_set_error (error, NM_BRIDGE_ERROR, NM_BRIDGE_ERROR_CONNECTION_INVALID,
|
||||
"The bridge mac-address does not match the address of the device.");
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue