Skip to content

Commit 1552402

Browse files
andy31415pull[bot]
authored andcommitted
If IPv4 is disabled, force avahi to use ipv6 (#15512)
1 parent b420283 commit 1552402

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/platform/Linux/DnssdImpl.cpp

+6-2
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,14 @@ namespace {
4444

4545
AvahiProtocol ToAvahiProtocol(chip::Inet::IPAddressType addressType)
4646
{
47+
#if INET_CONFIG_ENABLE_IPV4
4748
AvahiProtocol protocol;
4849

4950
switch (addressType)
5051
{
51-
#if INET_CONFIG_ENABLE_IPV4
5252
case chip::Inet::IPAddressType::kIPv4:
5353
protocol = AVAHI_PROTO_INET;
5454
break;
55-
#endif
5655
case chip::Inet::IPAddressType::kIPv6:
5756
protocol = AVAHI_PROTO_INET6;
5857
break;
@@ -62,6 +61,11 @@ AvahiProtocol ToAvahiProtocol(chip::Inet::IPAddressType addressType)
6261
}
6362

6463
return protocol;
64+
#else
65+
// We only support IPV6, never tell AVAHI about INET4 or UNSPEC because
66+
// UNSPEC may actually return IPv4 data.
67+
return AVAHI_PROTO_INET6;
68+
#endif
6569
}
6670

6771
chip::Inet::IPAddressType ToAddressType(AvahiProtocol protocol)

0 commit comments

Comments
 (0)