diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2023-07-07 05:12:53 +0000 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2023-07-07 05:12:53 +0000 |
commit | 4fbefd9b4e104a81badcb291a118fd3567ae7a75 (patch) | |
tree | 1a749f4f21c4e4721b28a4a935fb5f879120c048 | |
parent | 7f045f7c8200b99eb7693d857944ee733007b668 (diff) | |
parent | e80cf191495cad6788c19ecd42b51ceb25598021 (diff) | |
download | mdnsresponder-android14-mainline-uwb-release.tar.gz |
Snap for 10453563 from e80cf191495cad6788c19ecd42b51ceb25598021 to mainline-uwb-releaseaml_uwb_341513070aml_uwb_341511050aml_uwb_341310300aml_uwb_341310030aml_uwb_341111010aml_uwb_341011000android14-mainline-uwb-release
Change-Id: I1a3165140a642506edca34972e40b3e6bc12ddbb
-rw-r--r-- | Android.bp | 1 | ||||
-rw-r--r-- | mDNSPosix/mDNSPosix.c | 32 | ||||
-rwxr-xr-x | mDNSPosix/mDNSUNP.c | 2 |
3 files changed, 21 insertions, 14 deletions
@@ -175,6 +175,7 @@ cc_library { static_libs: ["libcutils"], shared_libs: ["liblog"], + min_sdk_version: "apex_inherit", apex_available: [ "//apex_available:platform", "com.android.adbd", diff --git a/mDNSPosix/mDNSPosix.c b/mDNSPosix/mDNSPosix.c index 8960c93..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 @@ -1102,14 +1103,14 @@ mDNSlocal void PrintNetLinkMsg(const struct nlmsghdr *pNLMsg) } #endif -mDNSlocal mDNSu32 ProcessRoutingNotification(int sd) +mDNSlocal mDNSBool ProcessRoutingNotification(int sd) // Read through the messages on sd and if any indicate that any interface records should // be torn down and rebuilt, return affected indices as a bitmask. Otherwise return 0. { ssize_t readCount; char buff[4096]; struct nlmsghdr *pNLMsg = (struct nlmsghdr*) buff; - mDNSu32 result = 0; + mDNSBool result = mDNSfalse; // The structure here is more complex than it really ought to be because, // unfortunately, there's no good way to size a buffer in advance large @@ -1144,10 +1145,18 @@ mDNSlocal mDNSu32 ProcessRoutingNotification(int sd) #endif // Process the NetLink message - if (pNLMsg->nlmsg_type == RTM_GETLINK || pNLMsg->nlmsg_type == RTM_NEWLINK) - result |= 1 << ((struct ifinfomsg*) NLMSG_DATA(pNLMsg))->ifi_index; - else if (pNLMsg->nlmsg_type == RTM_DELADDR || pNLMsg->nlmsg_type == RTM_NEWADDR) - result |= 1 << ((struct ifaddrmsg*) NLMSG_DATA(pNLMsg))->ifa_index; + 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) @@ -1191,14 +1200,14 @@ mDNSlocal void PrintRoutingSocketMsg(const struct ifa_msghdr *pRSMsg) } #endif -mDNSlocal mDNSu32 ProcessRoutingNotification(int sd) +mDNSlocal mDNSBool ProcessRoutingNotification(int sd) // Read through the messages on sd and if any indicate that any interface records should // be torn down and rebuilt, return affected indices as a bitmask. Otherwise return 0. { ssize_t readCount; char buff[4096]; struct ifa_msghdr *pRSMsg = (struct ifa_msghdr*) buff; - mDNSu32 result = 0; + mDNSBool result = mDNSfalse; readCount = read(sd, buff, sizeof buff); if (readCount < (ssize_t) sizeof(struct ifa_msghdr)) @@ -1212,10 +1221,7 @@ mDNSlocal mDNSu32 ProcessRoutingNotification(int sd) if (pRSMsg->ifam_type == RTM_NEWADDR || pRSMsg->ifam_type == RTM_DELADDR || pRSMsg->ifam_type == RTM_IFINFO) { - if (pRSMsg->ifam_type == RTM_IFINFO) - result |= 1 << ((struct if_msghdr*) pRSMsg)->ifm_index; - else - result |= 1 << pRSMsg->ifam_index; + result = mDNStrue; } return result; @@ -1228,7 +1234,7 @@ mDNSlocal void InterfaceChangeCallback(int fd, short filter, void *context) { IfChangeRec *pChgRec = (IfChangeRec*) context; fd_set readFDs; - mDNSu32 changedInterfaces = 0; + mDNSBool changedInterfaces = mDNSfalse; struct timeval zeroTimeout = { 0, 0 }; (void)fd; // Unused diff --git a/mDNSPosix/mDNSUNP.c b/mDNSPosix/mDNSUNP.c index f5d0c52..0e3632b 100755 --- a/mDNSPosix/mDNSUNP.c +++ b/mDNSPosix/mDNSUNP.c @@ -106,7 +106,7 @@ struct ifi_info *get_ifi_info_linuxv6(int family, int doaliases) goto gotError; } while (fscanf(fp, - "%4s%4s%4s%4s%4s%4s%4s%4s %x %02x %02x %02x %15s\n", + "%4s%4s%4s%4s%4s%4s%4s%4s %x %x %x %x %15s\n", addr[0],addr[1],addr[2],addr[3], addr[4],addr[5],addr[6],addr[7], &index, &plen, &scope, &flags, ifname) != EOF) { |