summaryrefslogtreecommitdiff
path: root/libnm/nm-device-wifi.c
diff options
context:
space:
mode:
authorDan Winship <danw@gnome.org>2014-07-07 12:04:14 -0400
committerDan Winship <danw@gnome.org>2014-08-07 12:11:49 -0400
commitea456aaa81f2290618421d28a824b85e02002fdf (patch)
tree9139087dc2ac31de6c44d6a21596daed3ff85fc1 /libnm/nm-device-wifi.c
parent0dcba8a9a0b9d1dcfff90348bb433d2625489017 (diff)
downloadNetworkManager-ea456aaa81f2290618421d28a824b85e02002fdf.tar.gz
all: remove use of struct ether_addr / ether_aton()
Lots of old code used struct ether_addr to store hardware addresses, and ether_aton() to parse them, but more recent code generally uses guint8 arrays, and the nm_utils_hwaddr_* methods, to be able to share code between ETH_ALEN and INFINIBAND_ALEN cases. So update the old code to match the new. (In many places, this ends up getting rid of casts between struct ether_addr and guint8* anyway.) (Also, in some places, variables were switched from struct ether_addr to guint8[] a while back, but some code still used "&" when referring to them even though that's unnecessary now. Clean that up.)
Diffstat (limited to 'libnm/nm-device-wifi.c')
-rw-r--r--libnm/nm-device-wifi.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/libnm/nm-device-wifi.c b/libnm/nm-device-wifi.c
index 7abab9aa61..81c9a3279d 100644
--- a/libnm/nm-device-wifi.c
+++ b/libnm/nm-device-wifi.c
@@ -28,6 +28,7 @@
#include <nm-setting-connection.h>
#include <nm-setting-wireless.h>
#include <nm-setting-wireless-security.h>
+#include <nm-utils.h>
#include "nm-device-wifi.h"
#include "nm-device-private.h"
@@ -420,7 +421,7 @@ connection_compatible (NMDevice *device, NMConnection *connection, GError **erro
const char *ctype;
const GByteArray *mac;
const char *hw_str;
- struct ether_addr *hw_mac;
+ guint8 hw_mac[ETH_ALEN];
NMDeviceWifiCapabilities wifi_caps;
const char *key_mgmt;
@@ -444,14 +445,13 @@ connection_compatible (NMDevice *device, NMConnection *connection, GError **erro
/* Check MAC address */
hw_str = nm_device_wifi_get_permanent_hw_address (NM_DEVICE_WIFI (device));
if (hw_str) {
- hw_mac = ether_aton (hw_str);
- if (!hw_mac) {
+ if (!nm_utils_hwaddr_aton (hw_str, hw_mac, 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 && hw_mac && memcmp (mac->data, hw_mac->ether_addr_octet, ETH_ALEN)) {
+ if (mac && memcmp (mac->data, hw_mac, ETH_ALEN)) {
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;