git: dfbeda6cf4c8 - stable/13 - linux(4): Fix SO_LINGER l_onoff value
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 17 Jun 2022 19:41:08 UTC
The branch stable/13 has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=dfbeda6cf4c8bb9ad64ec79a0dea8b80e4b94b57 commit dfbeda6cf4c8bb9ad64ec79a0dea8b80e4b94b57 Author: Dmitry Chagin <dchagin@FreeBSD.org> AuthorDate: 2022-05-28 20:31:06 +0000 Commit: Dmitry Chagin <dchagin@FreeBSD.org> CommitDate: 2022-06-17 19:35:32 +0000 linux(4): Fix SO_LINGER l_onoff value On Linux l_onoff should be 1 when linger is used. MFC after: 2 weeks (cherry picked from commit e8d9d8082be339d046826e543e8e835c61e2d4b0) --- sys/compat/linux/linux_socket.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/sys/compat/linux/linux_socket.c b/sys/compat/linux/linux_socket.c index 0c003cd5729f..1214c2e1fa24 100644 --- a/sys/compat/linux/linux_socket.c +++ b/sys/compat/linux/linux_socket.c @@ -1992,6 +1992,22 @@ linux_getsockopt_so_peersec(struct thread *td, len, args)); } +static int +linux_getsockopt_so_linger(struct thread *td, + struct linux_getsockopt_args *args) +{ + struct linger ling; + socklen_t len; + int error; + + len = sizeof(ling); + error = kern_getsockopt(td, args->s, SOL_SOCKET, + SO_LINGER, &ling, UIO_SYSSPACE, &len); + if (error != 0) + return (error); + ling.l_onoff = ((ling.l_onoff & SO_LINGER) != 0); + return (linux_sockopt_copyout(td, &ling, len, args)); +} int linux_getsockopt(struct thread *td, struct linux_getsockopt_args *args) @@ -2075,6 +2091,9 @@ linux_getsockopt(struct thread *td, struct linux_getsockopt_args *args) return (linux_sockopt_copyout(td, &newval, len, args)); /* NOTREACHED */ + case SO_LINGER: + return (linux_getsockopt_so_linger(td, args)); + /* NOTREACHED */ default: break; }