diff -ruN NetworkManager-0.9.8.8/src/settings/plugins/ifnet/connection_parser.c NetworkManager-0.9.8.8-fixed/src/settings/plugins/ifnet/connection_parser.c --- NetworkManager-0.9.8.8/src/settings/plugins/ifnet/connection_parser.c 2013-10-10 17:23:40.000000000 +0200 +++ NetworkManager-0.9.8.8-fixed/src/settings/plugins/ifnet/connection_parser.c 2014-02-02 16:46:15.000000000 +0100 @@ -516,9 +516,12 @@ /* Reading mac address for setting connection option. * Unmanaged device mac address is required by NetworkManager*/ static gboolean -read_mac_address (const char *conn_name, GByteArray **array, GError **error) +read_mac_address (const char *conn_name, const char *key, GByteArray **array, GError **error) { - const char *value = ifnet_get_data (conn_name, "mac"); + const char *value = ifnet_get_data (conn_name, key); + + /* make sure it's NULL unless we find an address */ + *array = NULL; if (!value || !strlen (value)) return TRUE; @@ -526,7 +529,7 @@ *array = nm_utils_hwaddr_atoba (value, ARPHRD_ETHER); if (!*array) { g_set_error (error, ifnet_plugin_error_quark (), 0, - "The MAC address '%s' was invalid.", value); + "%s: The MAC address '%s' was invalid.", key, value); return FALSE; } @@ -560,7 +563,17 @@ (guint32) mtu, NULL); } - if (read_mac_address (conn_name, &mac, error)) { + /* cloned mac address is optional */ + if (read_mac_address (conn_name, "mac", &mac, error)) { + if (mac) { + g_object_set (s_wired, NM_SETTING_WIRED_CLONED_MAC_ADDRESS, + mac, NULL); + g_byte_array_free (mac, TRUE); + } + } + + /* hardware mac address is required */ + if (read_mac_address (conn_name, "hwaddr", &mac, error)) { if (mac) { g_object_set (s_wired, NM_SETTING_WIRED_MAC_ADDRESS, mac, NULL); @@ -938,13 +951,23 @@ } wireless_setting = NM_SETTING_WIRELESS (nm_setting_wireless_new ()); - if (read_mac_address (conn_name, &mac, error)) { + + /* cloned mac address is optional */ + if (read_mac_address (conn_name, "mac", &mac, error)) { if (mac) { g_object_set (wireless_setting, - NM_SETTING_WIRELESS_MAC_ADDRESS, mac, + NM_SETTING_WIRELESS_CLONED_MAC_ADDRESS, mac, NULL); g_byte_array_free (mac, TRUE); + } + } + if (read_mac_address (conn_name, "hwaddr", &mac, error)) { + if (mac) { + g_object_set (wireless_setting, + NM_SETTING_WIRELESS_MAC_ADDRESS, mac, + NULL); + g_byte_array_free (mac, TRUE); } } else { g_object_unref (wireless_setting); @@ -2340,7 +2363,7 @@ } ifnet_set_data (ssid_str, "mac", NULL); - mac = nm_setting_wireless_get_mac_address (s_wireless); + mac = nm_setting_wireless_get_cloned_mac_address (s_wireless); if (mac) { tmp = g_strdup_printf ("%02X:%02X:%02X:%02X:%02X:%02X", mac->data[0], mac->data[1], mac->data[2], @@ -2350,6 +2373,17 @@ g_free (tmp); } + ifnet_set_data (ssid_str, "hwaddr", NULL); + mac = nm_setting_wireless_get_mac_address (s_wireless); + if (mac) { + tmp = g_strdup_printf ("%02X:%02X:%02X:%02X:%02X:%02X", + mac->data[0], mac->data[1], mac->data[2], + mac->data[3], mac->data[4], + mac->data[5]); + ifnet_set_data (ssid_str, "hwaddr", tmp); + g_free (tmp); + } + ifnet_set_data (ssid_str, "mtu", NULL); mtu = nm_setting_wireless_get_mtu (s_wireless); if (mtu) { @@ -2415,7 +2449,7 @@ } ifnet_set_data (conn_name, "mac", NULL); - mac = nm_setting_wired_get_mac_address (s_wired); + mac = nm_setting_wired_get_cloned_mac_address (s_wired); if (mac) { tmp = g_strdup_printf ("%02X:%02X:%02X:%02X:%02X:%02X", mac->data[0], mac->data[1], mac->data[2], @@ -2425,6 +2459,17 @@ g_free (tmp); } + ifnet_set_data (conn_name, "hwaddr", NULL); + mac = nm_setting_wired_get_mac_address (s_wired); + if (mac) { + tmp = g_strdup_printf ("%02X:%02X:%02X:%02X:%02X:%02X", + mac->data[0], mac->data[1], mac->data[2], + mac->data[3], mac->data[4], + mac->data[5]); + ifnet_set_data (conn_name, "hwaddr", tmp); + g_free (tmp); + } + ifnet_set_data (conn_name, "mtu", NULL); mtu = nm_setting_wired_get_mtu (s_wired); if (mtu) {