[2/6] net/tap: log if netlink ext ack not possible

Message ID 20240301175842.159967-3-stephen@networkplumber.org (mailing list archive)
State Accepted, archived
Delegated to: David Marchand
Headers
Series Coverity related fixes |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Stephen Hemminger March 1, 2024, 5:57 p.m. UTC
  If kernel doesn't support external ack, log that to aide
in any problem diagnosis.

Coverity issue: 362848
Fixes: 647909bcf34b ("net/tap: use netlink extended ack support")
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 drivers/net/tap/tap_netlink.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
  

Patch

diff --git a/drivers/net/tap/tap_netlink.c b/drivers/net/tap/tap_netlink.c
index 75af3404b035..d9c260127d52 100644
--- a/drivers/net/tap/tap_netlink.c
+++ b/drivers/net/tap/tap_netlink.c
@@ -72,7 +72,8 @@  tap_nl_init(uint32_t nl_groups)
 
 #ifdef NETLINK_EXT_ACK
 	/* Ask for extended ACK response. on older kernel will ignore request. */
-	setsockopt(fd, SOL_NETLINK, NETLINK_EXT_ACK, &one, sizeof(one));
+	if (setsockopt(fd, SOL_NETLINK, NETLINK_EXT_ACK, &one, sizeof(one)) < 0)
+		TAP_LOG(NOTICE, "Unable to request netlink error information");
 #endif
 
 	if (bind(fd, (struct sockaddr *)&local, sizeof(local)) < 0) {