Skip to content

Commit cb30431

Browse files
kica-znashif
authored andcommitted
net: dns: Improve interface count mismatch warning
In order to reduce confusion regarding interface count the respective warning was adjusted to better reflect the actual state of the system. Signed-off-by: Carlo Kirchmeier <[email protected]>
1 parent 7c35286 commit cb30431

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

subsys/net/lib/dns/mdns_responder.c

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -722,18 +722,16 @@ static int init_listener(void)
722722
NET_DBG("Setting %s listener to %d interface%s", "mDNS", iface_count,
723723
iface_count > 1 ? "s" : "");
724724

725-
if ((iface_count > MAX_IPV6_IFACE_COUNT && MAX_IPV6_IFACE_COUNT > 0) ||
726-
(iface_count > MAX_IPV4_IFACE_COUNT && MAX_IPV4_IFACE_COUNT > 0)) {
727-
NET_WARN("You have %d interfaces configured but there "
728-
"are %d network interfaces in the system.",
729-
MAX(MAX_IPV4_IFACE_COUNT,
730-
MAX_IPV6_IFACE_COUNT), iface_count);
731-
}
732-
733725
#if defined(CONFIG_NET_IPV6)
734726
struct sockaddr_in6 local_addr6;
735727
int v6;
736728

729+
if ((iface_count > MAX_IPV6_IFACE_COUNT && MAX_IPV6_IFACE_COUNT > 0)) {
730+
NET_WARN("You have %d %s interfaces configured but there "
731+
"are %d network interfaces in the system.",
732+
MAX_IPV6_IFACE_COUNT, "IPv6", iface_count);
733+
}
734+
737735
setup_ipv6_addr(&local_addr6);
738736

739737
ARRAY_FOR_EACH(v6_ctx, i) {
@@ -811,6 +809,12 @@ static int init_listener(void)
811809
struct sockaddr_in local_addr4;
812810
int v4;
813811

812+
if ((iface_count > MAX_IPV4_IFACE_COUNT && MAX_IPV4_IFACE_COUNT > 0)) {
813+
NET_WARN("You have %d %s interfaces configured but there "
814+
"are %d network interfaces in the system.",
815+
MAX_IPV4_IFACE_COUNT, "IPv4", iface_count);
816+
}
817+
814818
setup_ipv4_addr(&local_addr4);
815819

816820
ARRAY_FOR_EACH(v4_ctx, i) {

0 commit comments

Comments
 (0)