summaryrefslogtreecommitdiff
path: root/libnm/nm-device-wifi.c
diff options
context:
space:
mode:
authorDan Winship <danw@gnome.org>2014-07-30 10:57:45 -0400
committerDan Winship <danw@gnome.org>2014-09-04 09:20:10 -0400
commit3a54d050985d6ef2067b025571910a8ccd3cbd57 (patch)
tree1a226c3f91ec851fd7e55d519142ff1de24dc650 /libnm/nm-device-wifi.c
parentf4957eb0b7b0c6c28121d728e8ab2da30bd49ac7 (diff)
downloadNetworkManager-3a54d050985d6ef2067b025571910a8ccd3cbd57.tar.gz
libnm-core: change all mac-address properties to G_TYPE_STRING
Make all mac-address properties (including NMSettingBluetooth:bdaddr, NMSettingOlpcMesh:dhcp-anycast-addr, and NMSettingWireless:bssid) be strings, using _nm_setting_class_transform_property() to handle translating to/from binary form when dealing with D-Bus. Update everything accordingly for the change, and also add a test for transformed setting properties to test-general.
Diffstat (limited to 'libnm/nm-device-wifi.c')
-rw-r--r--libnm/nm-device-wifi.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/libnm/nm-device-wifi.c b/libnm/nm-device-wifi.c
index d9a14efdee..f06232c374 100644
--- a/libnm/nm-device-wifi.c
+++ b/libnm/nm-device-wifi.c
@@ -418,8 +418,7 @@ connection_compatible (NMDevice *device, NMConnection *connection, GError **erro
NMSettingWireless *s_wifi;
NMSettingWirelessSecurity *s_wsec;
const char *ctype;
- const GByteArray *mac;
- const char *hw_addr;
+ const char *hwaddr, *setting_hwaddr;
NMDeviceWifiCapabilities wifi_caps;
const char *key_mgmt;
@@ -441,15 +440,15 @@ connection_compatible (NMDevice *device, NMConnection *connection, GError **erro
}
/* Check MAC address */
- hw_addr = nm_device_wifi_get_permanent_hw_address (NM_DEVICE_WIFI (device));
- if (hw_addr) {
- if (!nm_utils_hwaddr_valid (hw_addr, ETH_ALEN)) {
+ hwaddr = nm_device_wifi_get_permanent_hw_address (NM_DEVICE_WIFI (device));
+ if (hwaddr) {
+ if (!nm_utils_hwaddr_valid (hwaddr, ETH_ALEN)) {
g_set_error (error, NM_DEVICE_WIFI_ERROR, NM_DEVICE_WIFI_ERROR_INVALID_DEVICE_MAC,
"Invalid device MAC address.");
return FALSE;
}
- mac = nm_setting_wireless_get_mac_address (s_wifi);
- if (mac && !nm_utils_hwaddr_matches (mac->data, mac->len, hw_addr, -1)) {
+ setting_hwaddr = nm_setting_wireless_get_mac_address (s_wifi);
+ if (setting_hwaddr && !nm_utils_hwaddr_matches (setting_hwaddr, -1, hwaddr, -1)) {
g_set_error (error, NM_DEVICE_WIFI_ERROR, NM_DEVICE_WIFI_ERROR_MAC_MISMATCH,
"The MACs of the device and the connection didn't match.");
return FALSE;