diff options
author | Ante <cante@google.com> | 2023-02-24 18:40:56 +0000 |
---|---|---|
committer | Ante <cante@google.com> | 2023-03-01 22:24:58 +0000 |
commit | b63cb20590d8f4576d2d4be36cfca9c5b6a197f7 (patch) | |
tree | 1a749f4f21c4e4721b28a4a935fb5f879120c048 | |
parent | 4cdbbf938a7145671b10c8654e8cbca661dd2af6 (diff) | |
download | mdnsresponder-b63cb20590d8f4576d2d4be36cfca9c5b6a197f7.tar.gz |
Fix UWB start/stop ranging causing mDNS drop
Current mDNS implementation closes and re-opens all of the network
interfaces when any of the existing interfaces changes. Since UWB on
start/stop ranging modifies its interface, mDNS detects that as a
significant enough change to restart all of its interfaces. This change
prevents that behaviour since the UWB interface is not related to anything
what mDNS does. If the detected interface change is neither an
IPv4 or IPv6 capable interface and if the interface type is
ARPHRD_IEEE802154 which is the IEEE 802.15.4 PHY and MAC standard that
UWB uses, then mDNS will ignore it.
Bug:265207453
Test: Verified manually after this fix is applied interfaces no longer
restart on UWB start/stop ranging.
Change-Id: I1c070d989769752fda92bbe9308ca5bfc7c2d3e5
-rw-r--r-- | mDNSPosix/mDNSPosix.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/mDNSPosix/mDNSPosix.c b/mDNSPosix/mDNSPosix.c index 28f4e06..fe899a6 100644 --- a/mDNSPosix/mDNSPosix.c +++ b/mDNSPosix/mDNSPosix.c @@ -55,6 +55,7 @@ #if USES_NETLINK #include <asm/types.h> +#include <linux/if_arp.h> #include <linux/netlink.h> #include <linux/rtnetlink.h> #else // USES_NETLINK @@ -1144,9 +1145,18 @@ mDNSlocal mDNSBool ProcessRoutingNotification(int sd) #endif // Process the NetLink message - if (pNLMsg->nlmsg_type == RTM_GETLINK || pNLMsg->nlmsg_type == RTM_NEWLINK || - pNLMsg->nlmsg_type == RTM_DELADDR || pNLMsg->nlmsg_type == RTM_NEWADDR) + if (pNLMsg->nlmsg_type == RTM_GETLINK || pNLMsg->nlmsg_type == RTM_DELADDR || + pNLMsg->nlmsg_type == RTM_NEWADDR) + { result = mDNStrue; + } + else if (pNLMsg->nlmsg_type == RTM_NEWLINK) + { + // Fix for UWB start/stop causing mdns drop. See b/265207453 + struct ifinfomsg *pIfInfo = (struct ifinfomsg*) NLMSG_DATA(pNLMsg); + if (pIfInfo->ifi_family != AF_UNSPEC || pIfInfo->ifi_type != ARPHRD_IEEE802154) + result = mDNStrue; + } // Advance pNLMsg to the next message in the buffer if ((pNLMsg->nlmsg_flags & NLM_F_MULTI) != 0 && pNLMsg->nlmsg_type != NLMSG_DONE) |