You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2023/07/24 16:46:44 UTC
[nuttx] 02/02: net/setsockopt: Add IP_TTL support
This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit 9fd26195d1f99ad004c204fe2cf83c37ee03c1d0
Author: Zhe Weng <we...@xiaomi.com>
AuthorDate: Mon Jul 24 17:43:09 2023 +0800
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 <we...@xiaomi.com>
---
net/inet/ipv4_setsockopt.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/net/inet/ipv4_setsockopt.c b/net/inet/ipv4_setsockopt.c
index 24199964b5..23e756b748 100644
--- a/net/inet/ipv4_setsockopt.c
+++ b/net/inet/ipv4_setsockopt.c
@@ -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 */