From: Jouni Malinen Date: Thu, 2 Jan 2020 14:50:50 +0000 (+0200) Subject: mac80211_linux: Fix libnl error string fetching X-Git-Tag: hostap_2_10~2015 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=139f7ab31190308a7f9d5299e2b94bc270619c94;p=thirdparty%2Fhostap.git 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 --- diff --git a/src/drivers/driver_macsec_linux.c b/src/drivers/driver_macsec_linux.c index 9c2aa3c70..5319ba2d0 100644 --- a/src/drivers/driver_macsec_linux.c +++ b/src/drivers/driver_macsec_linux.c @@ -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; }