diff --git a/sys/amd64/linux32/linux.h b/sys/amd64/linux32/linux.h index 2c269d33e6c..c18ee22061b 100644 --- a/sys/amd64/linux32/linux.h +++ b/sys/amd64/linux32/linux.h @@ -725,6 +725,13 @@ union l_semun { #define LINUX_IP_ADD_MEMBERSHIP 35 #define LINUX_IP_DROP_MEMBERSHIP 36 +#define LINUX_TCP_NODELAY 1 +#define LINUX_TCP_MAXSEG 2 +#define LINUX_TCP_KEEPIDLE 4 +#define LINUX_TCP_KEEPINTVL 5 +#define LINUX_TCP_KEEPCNT 6 +#define LINUX_TCP_MD5SIG 14 + struct l_sockaddr { l_ushort sa_family; char sa_data[14]; diff --git a/sys/compat/linux/linux_socket.c b/sys/compat/linux/linux_socket.c index 7271a18385a..cd288f8edd8 100644 --- a/sys/compat/linux/linux_socket.c +++ b/sys/compat/linux/linux_socket.c @@ -56,6 +56,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #ifdef INET6 #include #include @@ -325,6 +326,27 @@ linux_to_bsd_so_sockopt(int opt) return (-1); } +static int +linux_to_bsd_tcp_sockopt(int opt) +{ + + switch (opt) { + case LINUX_TCP_NODELAY: + return (TCP_NODELAY); + case LINUX_TCP_MAXSEG: + return (TCP_MAXSEG); + case LINUX_TCP_KEEPIDLE: + return (TCP_KEEPIDLE); + case LINUX_TCP_KEEPINTVL: + return (TCP_KEEPINTVL); + case LINUX_TCP_KEEPCNT: + return (TCP_KEEPCNT); + case LINUX_TCP_MD5SIG: + return (TCP_MD5SIG); + } + return (-1); +} + static int linux_to_bsd_msg_flags(int flags) { @@ -1496,8 +1518,7 @@ linux_setsockopt(struct thread *td, struct linux_setsockopt_args *args) name = linux_to_bsd_ip_sockopt(args->optname); break; case IPPROTO_TCP: - /* Linux TCP option values match BSD's */ - name = args->optname; + name = linux_to_bsd_tcp_sockopt(args->optname); break; default: name = -1; @@ -1591,8 +1612,7 @@ linux_getsockopt(struct thread *td, struct linux_getsockopt_args *args) name = linux_to_bsd_ip_sockopt(args->optname); break; case IPPROTO_TCP: - /* Linux TCP option values match BSD's */ - name = args->optname; + name = linux_to_bsd_tcp_sockopt(args->optname); break; default: name = -1; diff --git a/sys/i386/linux/linux.h b/sys/i386/linux/linux.h index 799259c653d..8a5505ad895 100644 --- a/sys/i386/linux/linux.h +++ b/sys/i386/linux/linux.h @@ -701,6 +701,13 @@ union l_semun { #define LINUX_IP_ADD_MEMBERSHIP 35 #define LINUX_IP_DROP_MEMBERSHIP 36 +#define LINUX_TCP_NODELAY 1 +#define LINUX_TCP_MAXSEG 2 +#define LINUX_TCP_KEEPIDLE 4 +#define LINUX_TCP_KEEPINTVL 5 +#define LINUX_TCP_KEEPCNT 6 +#define LINUX_TCP_MD5SIG 14 + struct l_sockaddr { l_ushort sa_family; char sa_data[14];