git: 53494b918d63 - main - linux(4): Overwrite SO_TIMESTAMP counterpart
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 28 May 2022 20:53:27 UTC
The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=53494b918d63a5b31793ce7f66569d4bd03f5817 commit 53494b918d63a5b31793ce7f66569d4bd03f5817 Author: Dmitry Chagin <dchagin@FreeBSD.org> AuthorDate: 2022-05-28 20:46:38 +0000 Commit: Dmitry Chagin <dchagin@FreeBSD.org> CommitDate: 2022-05-28 20:46:38 +0000 linux(4): Overwrite SO_TIMESTAMP counterpart A socket cannot mix SO_TIMESTAMP and SO_TIMESTAMPNS: the two modes are mutually exclusive. MFC after: 2 weeks --- sys/compat/linux/linux_socket.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/sys/compat/linux/linux_socket.c b/sys/compat/linux/linux_socket.c index 401e1bc5c88f..3fea532d676d 100644 --- a/sys/compat/linux/linux_socket.c +++ b/sys/compat/linux/linux_socket.c @@ -1984,7 +1984,7 @@ linux_setsockopt(struct thread *td, struct linux_setsockopt_args *args) struct sockaddr *sa; struct timeval tv; socklen_t len; - int error, level, name; + int error, level, name, val; level = linux_to_bsd_sockopt_level(args->level); switch (level) { @@ -2007,10 +2007,22 @@ linux_setsockopt(struct thread *td, struct linux_setsockopt_args *args) name, &tv, UIO_SYSSPACE, sizeof(tv))); /* NOTREACHED */ case SO_TIMESTAMP: + /* overwrite SO_BINTIME */ + val = 0; + error = kern_setsockopt(td, args->s, level, + SO_BINTIME, &val, UIO_SYSSPACE, sizeof(val)); + if (error != 0) + return (error); pem = pem_find(p); pem->so_timestamp = args->optname; break; case SO_BINTIME: + /* overwrite SO_TIMESTAMP */ + val = 0; + error = kern_setsockopt(td, args->s, level, + SO_TIMESTAMP, &val, UIO_SYSSPACE, sizeof(val)); + if (error != 0) + return (error); pem = pem_find(p); pem->so_timestampns = args->optname; break;