aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnte <cante@google.com>2023-02-24 18:40:56 +0000
committerAnte Culo <cante@google.com>2023-03-07 16:53:55 +0000
commit9576bf06401ba22da50f8b64105a54971cea209b (patch)
tree35723b84364b04fec38682ccf9851e19c437a581
parent21d030fe4342697f1e99cdf57edce1948d7e0733 (diff)
downloadmdnsresponder-9576bf06401ba22da50f8b64105a54971cea209b.tar.gz
Cherry-pick from aosp/2463529 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 Merged-In: I1c070d989769752fda92bbe9308ca5bfc7c2d3e5
-rw-r--r--mDNSPosix/mDNSPosix.c14
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)