From 7f4c7fca2e72e2fee3c33f8acf14d36d1be205a6 Mon Sep 17 00:00:00 2001 From: Kangping Date: Wed, 19 Jul 2023 15:20:25 +0800 Subject: [PATCH] [posix] loose check for NETLINK_EXT_ACK and NETLINK_CAP_ACK (#9299) `NETLINK_EXT_ACK` and `NETLINK_CAP_ACK` are for getting netlink reply details from the kernel and we can still function without the two options. This commit loose the check of enabling the two options to make ot-posix works on platforms where the features are missing. --- src/posix/platform/netif.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/posix/platform/netif.cpp b/src/posix/platform/netif.cpp index 242023504..1cf73e235 100644 --- a/src/posix/platform/netif.cpp +++ b/src/posix/platform/netif.cpp @@ -2004,10 +2004,18 @@ static void platformConfigureNetLink(void) { int enable = 1; - VerifyOrDie(setsockopt(sNetlinkFd, SOL_NETLINK, NETLINK_EXT_ACK, &enable, sizeof(enable)) == 0, - OT_EXIT_ERROR_ERRNO); - VerifyOrDie(setsockopt(sNetlinkFd, SOL_NETLINK, NETLINK_CAP_ACK, &enable, sizeof(enable)) == 0, - OT_EXIT_ERROR_ERRNO); +#if defined(NETLINK_EXT_ACK) + if (setsockopt(sNetlinkFd, SOL_NETLINK, NETLINK_EXT_ACK, &enable, sizeof(enable)) != 0) + { + otLogWarnPlat("[netif] Failed to enable NETLINK_EXT_ACK: %s", strerror(errno)); + } +#endif +#if defined(NETLINK_CAP_ACK) + if (setsockopt(sNetlinkFd, SOL_NETLINK, NETLINK_CAP_ACK, &enable, sizeof(enable)) != 0) + { + otLogWarnPlat("[netif] Failed to enable NETLINK_CAP_ACK: %s", strerror(errno)); + } +#endif } #endif