From 139f7ab31190308a7f9d5299e2b94bc270619c94 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Thu, 2 Jan 2020 16:50:50 +0200 Subject: [PATCH] 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 --- src/drivers/driver_macsec_linux.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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; }