net: dns: responders: Set the multicast TTL or hoplimit

We are creating a multicast address in mDNS or LLMNR
responder so set the TTL or hoplimit using the multicast
variant API.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
This commit is contained in:
Jukka Rissanen 2023-11-30 22:01:09 +02:00 committed by Henrik Brix Andersen
parent fc006d7daa
commit 060295c63b
2 changed files with 4 additions and 4 deletions

View file

@ -339,7 +339,7 @@ static int create_ipv4_answer(struct net_context *ctx,
return -ENOMEM; return -ENOMEM;
} }
net_context_set_ipv4_ttl(ctx, 255); net_context_set_ipv4_mcast_ttl(ctx, 255);
return 0; return 0;
} }
@ -389,7 +389,7 @@ static int create_ipv6_answer(struct net_context *ctx,
return -ENOMEM; return -ENOMEM;
} }
net_context_set_ipv6_hop_limit(ctx, 255); net_context_set_ipv6_mcast_hop_limit(ctx, 255);
#endif /* CONFIG_NET_IPV6 */ #endif /* CONFIG_NET_IPV6 */
return 0; return 0;

View file

@ -110,11 +110,11 @@ int setup_dst_addr(struct net_context *ctx, sa_family_t family,
if (IS_ENABLED(CONFIG_NET_IPV4) && family == AF_INET) { if (IS_ENABLED(CONFIG_NET_IPV4) && family == AF_INET) {
create_ipv4_addr(net_sin(dst)); create_ipv4_addr(net_sin(dst));
*dst_len = sizeof(struct sockaddr_in); *dst_len = sizeof(struct sockaddr_in);
net_context_set_ipv4_ttl(ctx, 255); net_context_set_ipv4_mcast_ttl(ctx, 255);
} else if (IS_ENABLED(CONFIG_NET_IPV6) && family == AF_INET6) { } else if (IS_ENABLED(CONFIG_NET_IPV6) && family == AF_INET6) {
create_ipv6_addr(net_sin6(dst)); create_ipv6_addr(net_sin6(dst));
*dst_len = sizeof(struct sockaddr_in6); *dst_len = sizeof(struct sockaddr_in6);
net_context_set_ipv6_hop_limit(ctx, 255); net_context_set_ipv6_mcast_hop_limit(ctx, 255);
} else { } else {
return -EPFNOSUPPORT; return -EPFNOSUPPORT;
} }