From 5c6709dbb448bb24eecd5f50bea1a386b9769fd7 Mon Sep 17 00:00:00 2001 From: Robert Antoni Buj Gelonch Date: Wed, 29 Jul 2020 14:26:53 +0200 Subject: Netspeed kernel warning (#510) * netspeed: Fix attribute type 6 has an invalid length warning - and fix a typo --- netspeed/src/backend.c | 8 +++----- netspeed/src/backend.h | 4 ++-- 2 files changed, 5 insertions(+), 7 deletions(-) (limited to 'netspeed/src') diff --git a/netspeed/src/backend.c b/netspeed/src/backend.c index 91bf0cd8..afbdea2e 100644 --- a/netspeed/src/backend.c +++ b/netspeed/src/backend.c @@ -412,8 +412,7 @@ scan_cb (struct nl_msg *msg, if (!bss[NL80211_BSS_STATUS]) return NL_SKIP; if (nla_get_u32 (bss[NL80211_BSS_STATUS]) != NL80211_BSS_STATUS_ASSOCIATED) return NL_SKIP; - int len = MIN(ETH_ALEN, nla_len (bss[NL80211_BSS_BSSID])); - memcpy (devinfo->station_mac_addr, nla_data (bss[NL80211_BSS_BSSID]), len); + memcpy (devinfo->station_mac_addr, nla_data (bss[NL80211_BSS_BSSID]), ETH_ALEN); return NL_SKIP; } @@ -614,8 +613,7 @@ iface_cb (struct nl_msg *msg, genlmsg_attrlen(gnlh, 0), NULL); if (tb_msg[NL80211_ATTR_MAC]) { - int len = MIN(ETH_ALEN, nla_len (tb_msg[NL80211_ATTR_MAC])); - memcpy (devinfo->hwaddr, nla_data (tb_msg[NL80211_ATTR_MAC]), len); + memcpy (devinfo->hwaddr, nla_data (tb_msg[NL80211_ATTR_MAC]), ETH_ALEN); } if (tb_msg[NL80211_ATTR_SSID]) { @@ -710,7 +708,7 @@ get_wireless_info (DevInfo *devinfo) if (!devinfo->running) goto cleanup; - /* Get in/out bitrate/rate/total, siganl quality from station message */ + /* Get in/out bitrate/rate/total, signal quality from station message */ msg = nlmsg_alloc (); if (!msg) { g_warning ("failed to allocate netlink message"); diff --git a/netspeed/src/backend.h b/netspeed/src/backend.h index c4d16091..b0e79704 100644 --- a/netspeed/src/backend.h +++ b/netspeed/src/backend.h @@ -37,7 +37,7 @@ #define SIOCGIWNAME 0x8B01 /* get name == wireless protocol */ #define SIOCGIWENCODE 0x8B2B /* get encoding token & mode */ -#define ETH_ALEN 8 +#define ETH_ALEN 6 #define ETH_LEN 20 #define MAX_FORMAT_SIZE 15 @@ -60,7 +60,7 @@ typedef struct { guint32 ip; guint32 netmask; guint32 ptpip; - guint8 hwaddr [ETH_ALEN]; + guint8 hwaddr [8]; /* EUI-48 or EUI-64 */ guint8 ipv6 [16]; char *essid; gboolean up; -- cgit v1.2.1