From cd34d8dea4adb69b3d7189c7b98dbc9516da3e4a Mon Sep 17 00:00:00 2001 From: Ricardo Branco Date: Sun, 12 Apr 2026 16:43:05 +0200 Subject: [PATCH] linux: Translate IPv6 hoplimit ancillary data for recvmsg Signed-off-by: Ricardo Branco Reviewed by: pouria Pull-Request: https://github.com/freebsd/freebsd-src/pull/2138 --- sys/compat/linux/linux_socket.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/sys/compat/linux/linux_socket.c b/sys/compat/linux/linux_socket.c index 2d20751a41a..29b55ef6035 100644 --- a/sys/compat/linux/linux_socket.c +++ b/sys/compat/linux/linux_socket.c @@ -707,6 +707,20 @@ bsd_to_linux_ip_cmsg_type(int cmsg_type) return (-1); } +#ifdef INET6 +static int +bsd_to_linux_ip6_cmsg_type(int cmsg_type) +{ + switch (cmsg_type) { + case IPV6_2292HOPLIMIT: + return (LINUX_IPV6_2292HOPLIMIT); + case IPV6_HOPLIMIT: + return (LINUX_IPV6_HOPLIMIT); + } + return (-1); +} +#endif + static int bsd_to_linux_cmsg_type(struct proc *p, int cmsg_type, int cmsg_level) { @@ -714,6 +728,10 @@ bsd_to_linux_cmsg_type(struct proc *p, int cmsg_type, int cmsg_level) if (cmsg_level == IPPROTO_IP) return (bsd_to_linux_ip_cmsg_type(cmsg_type)); +#ifdef INET6 + if (cmsg_level == IPPROTO_IPV6) + return (bsd_to_linux_ip6_cmsg_type(cmsg_type)); +#endif if (cmsg_level != SOL_SOCKET) return (-1);