aboutsummaryrefslogtreecommitdiff
path: root/sys/compat/linux
diff options
context:
space:
mode:
authorDmitry Chagin <dchagin@FreeBSD.org>2022-05-28 20:46:38 +0000
committerDmitry Chagin <dchagin@FreeBSD.org>2022-05-28 20:46:38 +0000
commit53494b918d63a5b31793ce7f66569d4bd03f5817 (patch)
treea9c54f43a5163873adaa140948c116832da34340 /sys/compat/linux
parent0eda2ceab7820aeba79029b59b3fe9b28a66c766 (diff)
downloadsrc-53494b918d63a5b31793ce7f66569d4bd03f5817.tar.gz
src-53494b918d63a5b31793ce7f66569d4bd03f5817.zip
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
Diffstat (limited to 'sys/compat/linux')
-rw-r--r--sys/compat/linux/linux_socket.c14
1 files changed, 13 insertions, 1 deletions
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;