mac80211_linux: Fix libnl error string fetching

libnl functions return a library specific error value. errno is not
necessarily valid in all error cases and strerror() for the returned
value is not valid either.

Use nl_geterror() to get the correct error string from the returned
error code.

Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2020-01-02 16:50:50 +02:00
parent 25ebd538a4
commit 139f7ab311

View file

@ -319,14 +319,14 @@ static int macsec_drv_macsec_init(void *priv, struct macsec_init_params *params)
if (err < 0) {
wpa_printf(MSG_ERROR, DRV_PREFIX
"Unable to connect NETLINK_ROUTE socket: %s",
strerror(errno));
nl_geterror(err));
goto sock;
}
err = rtnl_link_alloc_cache(drv->sk, AF_UNSPEC, &drv->link_cache);
if (err < 0) {
wpa_printf(MSG_ERROR, DRV_PREFIX "Unable to get link cache: %s",
strerror(errno));
nl_geterror(err));
goto sock;
}