Skip to content

Commit

Permalink
Propagate the interface id from avahi in the Linux MDNS impl. (#9484)
Browse files Browse the repository at this point in the history
Without this resolving something to a link-local IP won't work right.

Fixes #8232

Co-authored-by: Abdul Samad <[email protected]>
  • Loading branch information
2 people authored and pull[bot] committed Oct 5, 2021
1 parent 12010d8 commit 1056979
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/platform/Linux/MdnsImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -605,8 +605,13 @@ void MdnsAvahi::HandleBrowse(AvahiServiceBrowser * browser, AvahiIfIndex interfa

Platform::CopyString(service.mName, name);
CopyTypeWithoutProtocol(service.mType, type);
service.mProtocol = GetProtocolInType(type);
service.mAddressType = ToAddressType(protocol);
service.mProtocol = GetProtocolInType(type);
service.mAddressType = ToAddressType(protocol);
service.mInterface = INET_NULL_INTERFACEID;
if (interface != AVAHI_IF_UNSPEC)
{
service.mInterface = static_cast<chip::Inet::InterfaceId>(interface);
}
service.mType[kMdnsTypeMaxSize] = 0;
context->mServices.push_back(service);
}
Expand Down Expand Up @@ -686,6 +691,11 @@ void MdnsAvahi::HandleResolve(AvahiServiceResolver * resolver, AvahiIfIndex inte
result.mProtocol = GetProtocolInType(type);
result.mPort = port;
result.mAddressType = ToAddressType(protocol);
result.mInterface = INET_NULL_INTERFACEID;
if (interface != AVAHI_IF_UNSPEC)
{
result.mInterface = static_cast<chip::Inet::InterfaceId>(interface);
}
Platform::CopyString(result.mHostName, host_name);
// Returned value is full QName, want only host part.
char * dot = strchr(result.mHostName, '.');
Expand Down

0 comments on commit 1056979

Please sign in to comment.