net/setsockopt: Add IP_TTL support

We have IPV6_UNICAST_HOPS and IPV6_MULTICAST_HOPS in ipv6_setsockopt,
but only IP_MULTICAST_TTL in ipv4_setsockopt. So add IP_TTL support.

Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
This commit is contained in:
Zhe Weng 2023-07-24 17:43:09 +08:00 committed by Xiang Xiao
parent bde91a2abd
commit 9fd26195d1

View File

@ -179,6 +179,9 @@ int ipv4_setsockopt(FAR struct socket *psock, int option,
#ifdef NET_UDP_HAVE_STACK
case IP_MULTICAST_TTL: /* Set/read the time-to-live value of
* outgoing multicast packets */
#endif
case IP_TTL: /* The IP TTL (time to live) of IP
* packets sent by the network stack */
{
FAR struct socket_conn_s *conn;
int ttl;
@ -204,7 +207,6 @@ int ipv4_setsockopt(FAR struct socket *psock, int option,
}
}
break;
#endif
/* The following IPv4 socket options are defined, but not implemented */