samples: sockets: echo_server: fix IPPROTO_IPV6 on UDP sockets
IPPROTO_IPV6 option was set on TCP socket (besides doing it already in tcp.c) instead of UDP. Fix that. Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
This commit is contained in:
parent
346031d060
commit
2b9ce2eef6
1 changed files with 2 additions and 2 deletions
|
@ -81,7 +81,7 @@ static int start_udp_proto(struct data *data, struct sockaddr *bind_addr,
|
||||||
if (bind_addr->sa_family == AF_INET6) {
|
if (bind_addr->sa_family == AF_INET6) {
|
||||||
/* Prefer IPv6 temporary addresses */
|
/* Prefer IPv6 temporary addresses */
|
||||||
optval = IPV6_PREFER_SRC_PUBLIC;
|
optval = IPV6_PREFER_SRC_PUBLIC;
|
||||||
(void)setsockopt(data->tcp.sock, IPPROTO_IPV6,
|
(void)setsockopt(data->udp.sock, IPPROTO_IPV6,
|
||||||
IPV6_ADDR_PREFERENCES,
|
IPV6_ADDR_PREFERENCES,
|
||||||
&optval, sizeof(optval));
|
&optval, sizeof(optval));
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@ static int start_udp_proto(struct data *data, struct sockaddr *bind_addr,
|
||||||
* IPv4 using another socket
|
* IPv4 using another socket
|
||||||
*/
|
*/
|
||||||
optval = 1;
|
optval = 1;
|
||||||
(void)setsockopt(data->tcp.sock, IPPROTO_IPV6, IPV6_V6ONLY,
|
(void)setsockopt(data->udp.sock, IPPROTO_IPV6, IPV6_V6ONLY,
|
||||||
&optval, sizeof(optval));
|
&optval, sizeof(optval));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue