Skip to content

Commit

Permalink
net: dns: Do not pass 0 as TTL or hop limit
Browse files Browse the repository at this point in the history
We specifically set TTL/hoplimit to 1 for LLMNR,
but only want to set it if in that specific case.
We must not pass TTL/hoplimit value 0 as that would
cause the packet to be dropped.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
  • Loading branch information
jukkar committed Nov 30, 2023
1 parent f827cde commit 54c3166
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions subsys/net/lib/dns/resolve.c
Expand Up @@ -906,10 +906,12 @@ static int dns_write(struct dns_resolve_context *ctx,
dns_qname->len + 2);

if (IS_ENABLED(CONFIG_NET_IPV6) &&
net_context_get_family(net_ctx) == AF_INET6) {
net_context_get_family(net_ctx) == AF_INET6 &&
hop_limit > 0) {
net_context_set_ipv6_hop_limit(net_ctx, hop_limit);
} else if (IS_ENABLED(CONFIG_NET_IPV4) &&
net_context_get_family(net_ctx) == AF_INET) {
net_context_get_family(net_ctx) == AF_INET &&
hop_limit > 0) {
net_context_set_ipv4_ttl(net_ctx, hop_limit);
}

Expand Down

0 comments on commit 54c3166

Please sign in to comment.