From 1701a70b9eba0a0bc9db2bc253de352675fac915 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Fri, 16 May 2014 17:40:34 +0200 Subject: [PATCH] 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 --- src/devices/nm-device-bridge.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/devices/nm-device-bridge.c b/src/devices/nm-device-bridge.c index eb7f5ad6f..663f3188f 100644 --- a/src/devices/nm-device-bridge.c +++ b/src/devices/nm-device-bridge.c @@ -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),