|
7 | 7 | /* |
8 | 8 | * Copyright (c) 2016 Intel Corporation |
9 | 9 | * Copyright (c) 2021 Nordic Semiconductor |
| 10 | + * Copyright (c) 2025 Aerlync Labs Inc. |
10 | 11 | * |
11 | 12 | * SPDX-License-Identifier: Apache-2.0 |
12 | 13 | */ |
@@ -583,6 +584,10 @@ int net_context_get(sa_family_t family, enum net_sock_type type, uint16_t proto, |
583 | 584 |
|
584 | 585 | contexts[i].ipv6_hop_limit = INITIAL_HOP_LIMIT; |
585 | 586 | contexts[i].ipv6_mcast_hop_limit = INITIAL_MCAST_HOP_LIMIT; |
| 587 | +#if defined(CONFIG_NET_IPV6) |
| 588 | + contexts[i].options.ipv6_mcast_loop = |
| 589 | + IS_ENABLED(CONFIG_NET_INITIAL_IPV6_MCAST_LOOP); |
| 590 | +#endif |
586 | 591 | } |
587 | 592 | if (IS_ENABLED(CONFIG_NET_IPV4) && family == AF_INET) { |
588 | 593 | struct sockaddr_in *addr = (struct sockaddr_in *)&contexts[i].local; |
@@ -2033,6 +2038,20 @@ static int get_context_local_port_range(struct net_context *context, |
2033 | 2038 | #endif |
2034 | 2039 | } |
2035 | 2040 |
|
| 2041 | +static int get_context_ipv6_mcast_loop(struct net_context *context, |
| 2042 | + void *value, size_t *len) |
| 2043 | +{ |
| 2044 | +#if defined(CONFIG_NET_IPV6) |
| 2045 | + return get_bool_option(context->options.ipv6_mcast_loop, value, len); |
| 2046 | +#else |
| 2047 | + ARG_UNUSED(context); |
| 2048 | + ARG_UNUSED(value); |
| 2049 | + ARG_UNUSED(len); |
| 2050 | + |
| 2051 | + return -ENOTSUP; |
| 2052 | +#endif |
| 2053 | +} |
| 2054 | + |
2036 | 2055 | /* If buf is not NULL, then use it. Otherwise read the data to be written |
2037 | 2056 | * to net_pkt from msghdr. |
2038 | 2057 | */ |
@@ -3329,6 +3348,20 @@ static int set_context_unicast_hop_limit(struct net_context *context, |
3329 | 3348 | #endif |
3330 | 3349 | } |
3331 | 3350 |
|
| 3351 | +static int set_context_ipv6_mcast_loop(struct net_context *context, |
| 3352 | + const void *value, size_t len) |
| 3353 | +{ |
| 3354 | +#if defined(CONFIG_NET_IPV6) |
| 3355 | + return set_bool_option(&context->options.ipv6_mcast_loop, value, len); |
| 3356 | +#else |
| 3357 | + ARG_UNUSED(context); |
| 3358 | + ARG_UNUSED(value); |
| 3359 | + ARG_UNUSED(len); |
| 3360 | + |
| 3361 | + return -ENOTSUP; |
| 3362 | +#endif |
| 3363 | +} |
| 3364 | + |
3332 | 3365 | static int set_context_reuseaddr(struct net_context *context, |
3333 | 3366 | const void *value, size_t len) |
3334 | 3367 | { |
@@ -3652,6 +3685,9 @@ int net_context_set_option(struct net_context *context, |
3652 | 3685 | case NET_OPT_LOCAL_PORT_RANGE: |
3653 | 3686 | ret = set_context_local_port_range(context, value, len); |
3654 | 3687 | break; |
| 3688 | + case NET_OPT_IPV6_MCAST_LOOP: |
| 3689 | + ret = set_context_ipv6_mcast_loop(context, value, len); |
| 3690 | + break; |
3655 | 3691 | } |
3656 | 3692 |
|
3657 | 3693 | k_mutex_unlock(&context->lock); |
@@ -3737,6 +3773,9 @@ int net_context_get_option(struct net_context *context, |
3737 | 3773 | case NET_OPT_LOCAL_PORT_RANGE: |
3738 | 3774 | ret = get_context_local_port_range(context, value, len); |
3739 | 3775 | break; |
| 3776 | + case NET_OPT_IPV6_MCAST_LOOP: |
| 3777 | + ret = get_context_ipv6_mcast_loop(context, value, len); |
| 3778 | + break; |
3740 | 3779 | } |
3741 | 3780 |
|
3742 | 3781 | k_mutex_unlock(&context->lock); |
|
0 commit comments