core: set NMSettingBridge:mac-address when creating new bridge

This feature requires recent support from the kernel.

Most notably these upstream kernel commits are required:
 -  92c0574f11598c8036f81e27d2e8bdd6eed7d76d
 - 43598813386f6205edf3c21f1fe97f731ccb4f15
 - 30313a3d5794472c3548d7288e306a5492030370

The latter of them was merged to upstream kernel version 3.15-rc5.

https://bugzilla.gnome.org/show_bug.cgi?id=729844

Signed-off-by: Thomas Haller <thaller@redhat.com>
This commit is contained in:
Thomas Haller
2014-05-16 17:40:34 +02:00
parent 891eb83f45
commit 1701a70b9e

View File

@@ -438,13 +438,22 @@ NMDevice *
nm_device_bridge_new_for_connection (NMConnection *connection)
{
const char *iface;
NMSettingBridge *s_bridge;
const GByteArray *mac_address;
g_return_val_if_fail (connection != NULL, NULL);
iface = nm_connection_get_virtual_iface_name (connection);
g_return_val_if_fail (iface != NULL, NULL);
if ( !nm_platform_bridge_add (iface, NULL, 0)
s_bridge = nm_connection_get_setting_bridge (connection);
g_return_val_if_fail (s_bridge, NULL);
mac_address = nm_setting_bridge_get_mac_address (s_bridge);
if ( !nm_platform_bridge_add (iface,
mac_address ? mac_address->data : NULL,
mac_address ? mac_address->len : 0)
&& nm_platform_get_error () != NM_PLATFORM_ERROR_EXISTS) {
nm_log_warn (LOGD_DEVICE | LOGD_BRIDGE, "(%s): failed to create bridge master interface for '%s': %s",
iface, nm_connection_get_id (connection),