git: e19cb5cc3c2c - stable/13 - linux: recognize TCP_INFO and ratelimit the warning

From: Edward Tomasz Napierala <trasz_at_FreeBSD.org>
Date: Thu, 17 Feb 2022 12:54:33 UTC
The branch stable/13 has been updated by trasz:

URL: https://cgit.FreeBSD.org/src/commit/?id=e19cb5cc3c2cdee4e4b5c6b75aff3da38d8e9b1e

commit e19cb5cc3c2cdee4e4b5c6b75aff3da38d8e9b1e
Author:     Edward Tomasz Napierala <trasz@FreeBSD.org>
AuthorDate: 2021-10-17 12:19:05 +0000
Commit:     Edward Tomasz Napierala <trasz@FreeBSD.org>
CommitDate: 2022-02-13 22:24:59 +0000

    linux: recognize TCP_INFO and ratelimit the warning
    
    This ratelimits the "unsupported getsockopt level 6 optname 11"
    warnings that happen all the time when watching Netflix.
    
    Sponsored By:   EPSRC
    Differential Revision:  https://reviews.freebsd.org/D32454
    
    (cherry picked from commit 99f563ed76f49c541e587a2f81bc43c62c86c0e5)
---
 sys/compat/linux/linux_socket.c | 4 ++++
 sys/compat/linux/linux_socket.h | 1 +
 2 files changed, 5 insertions(+)

diff --git a/sys/compat/linux/linux_socket.c b/sys/compat/linux/linux_socket.c
index a4c5bf0b581e..707426582bbc 100644
--- a/sys/compat/linux/linux_socket.c
+++ b/sys/compat/linux/linux_socket.c
@@ -574,6 +574,10 @@ linux_to_bsd_tcp_sockopt(int opt)
 		return (TCP_KEEPINTVL);
 	case LINUX_TCP_KEEPCNT:
 		return (TCP_KEEPCNT);
+	case LINUX_TCP_INFO:
+		LINUX_RATELIMIT_MSG_OPT1(
+		    "unsupported TCP socket option TCP_INFO (%d)", opt);
+		return (-2);
 	case LINUX_TCP_MD5SIG:
 		return (TCP_MD5SIG);
 	}
diff --git a/sys/compat/linux/linux_socket.h b/sys/compat/linux/linux_socket.h
index 32a19a348312..71fee5f9af68 100644
--- a/sys/compat/linux/linux_socket.h
+++ b/sys/compat/linux/linux_socket.h
@@ -313,6 +313,7 @@ int linux_accept(struct thread *td, struct linux_accept_args *args);
 #define	LINUX_TCP_KEEPIDLE	4
 #define	LINUX_TCP_KEEPINTVL	5
 #define	LINUX_TCP_KEEPCNT	6
+#define	LINUX_TCP_INFO		11
 #define	LINUX_TCP_MD5SIG	14
 
 #endif /* _LINUX_SOCKET_H_ */