nl80211: Warn about interface name truncations
This is something useful to know and also eliminates format truncation warnings. Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
This commit is contained in:
parent
16b5413f2b
commit
d577f7f3d5
2 changed files with 18 additions and 2 deletions
|
@ -6580,8 +6580,15 @@ static int i802_set_wds_sta(void *priv, const u8 *addr, int aid, int val,
|
|||
struct wpa_driver_nl80211_data *drv = bss->drv;
|
||||
char name[IFNAMSIZ + 1];
|
||||
union wpa_event_data event;
|
||||
int ret;
|
||||
|
||||
ret = os_snprintf(name, sizeof(name), "%s.sta%d", bss->ifname, aid);
|
||||
if (ret >= (int) sizeof(name))
|
||||
wpa_printf(MSG_WARNING,
|
||||
"nl80211: WDS interface name was truncated");
|
||||
else if (ret < 0)
|
||||
return ret;
|
||||
|
||||
os_snprintf(name, sizeof(name), "%s.sta%d", bss->ifname, aid);
|
||||
if (ifname_wds)
|
||||
os_strlcpy(ifname_wds, name, IFNAMSIZ + 1);
|
||||
|
||||
|
|
|
@ -361,8 +361,17 @@ int nl80211_create_monitor_interface(struct wpa_driver_nl80211_data *drv)
|
|||
*/
|
||||
snprintf(buf, IFNAMSIZ, "mon-%s", drv->first_bss->ifname + 4);
|
||||
} else {
|
||||
int ret;
|
||||
|
||||
/* Non-P2P interface with AP functionality. */
|
||||
snprintf(buf, IFNAMSIZ, "mon.%s", drv->first_bss->ifname);
|
||||
ret = os_snprintf(buf, IFNAMSIZ, "mon.%s",
|
||||
drv->first_bss->ifname);
|
||||
if (ret >= (int) sizeof(buf))
|
||||
wpa_printf(MSG_DEBUG,
|
||||
"nl80211: Monitor interface name has been truncated to %s",
|
||||
buf);
|
||||
else if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
|
||||
buf[IFNAMSIZ - 1] = '\0';
|
||||
|
|
Loading…
Reference in a new issue