From 01f9e89ffb2f475f597e5ea9a3d7ef30a7b0654c Mon Sep 17 00:00:00 2001 From: whd <7058128+superwhd@users.noreply.github.com> Date: Thu, 15 Dec 2022 05:28:17 +0800 Subject: [PATCH] [posix] enable receiving Neighbor Advertisement on infra interface (#8521) This commit enables receiving Neighbor Advertisements (NA) on the infra link. OTBR relies on receiving Neighbor Advertisement to check if a router is active. Without receiving NA, OTBR may wrongly see a router as inactive and remove the discovered prefixes from Network Data too early, which breaks the border routing feature. --- src/posix/platform/infra_if.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/posix/platform/infra_if.cpp b/src/posix/platform/infra_if.cpp index 94cb747a8..def69f4d9 100644 --- a/src/posix/platform/infra_if.cpp +++ b/src/posix/platform/infra_if.cpp @@ -132,10 +132,11 @@ int CreateIcmp6Socket(void) sock = SocketWithCloseExec(AF_INET6, SOCK_RAW, IPPROTO_ICMPV6, kSocketBlock); VerifyOrDie(sock != -1, OT_EXIT_ERROR_ERRNO); - // Only accept router advertisements and solicitations. + // Only accept Router Advertisements, Router Solicitations and Neighbor Advertisements. ICMP6_FILTER_SETBLOCKALL(&filter); ICMP6_FILTER_SETPASS(ND_ROUTER_SOLICIT, &filter); ICMP6_FILTER_SETPASS(ND_ROUTER_ADVERT, &filter); + ICMP6_FILTER_SETPASS(ND_NEIGHBOR_ADVERT, &filter); rval = setsockopt(sock, IPPROTO_ICMPV6, ICMP6_FILTER, &filter, sizeof(filter)); VerifyOrDie(rval == 0, OT_EXIT_ERROR_ERRNO);