>> If using ns_capable, skb->tstamp must continue to be scrubbed when traversing >> network namespaces. > > > I was planning to follow Eric's suggestion and move the tstamp scrubbing out > of > skb_scrub_packet() into ____dev_forward_skb() instead. Would that break when > traversing namespaces?
That implies namespace traversal, so sounds perfect for this purpose. >> >>> @@ -2130,6 +2137,15 @@ int __sock_cmsg_send(struct sock *sk, struct msghdr >>> *msg, struct cmsghdr *cmsg, >>> sockc->tsflags &= ~SOF_TIMESTAMPING_TX_RECORD_MASK; >>> sockc->tsflags |= tsflags; >>> break; >>> + case SO_TXTIME: >>> + if (!ns_capable(sock_net(sk)->user_ns, CAP_NET_ADMIN)) >>> + return -EPERM; >>> + if (!sock_flag(sk, SOCK_TXTIME)) >>> + return -EINVAL; >> >> No need for ns_capable check on each packet when already required to >> toggle socket option. > > > Ok. SO_MARK is doing the same so it might have "mis-inspired" me. I should > probably fix both. The SO_MARK cmsg does need a check on each invocation, because it is not conditional on a sock_flag like SO_TXTIME.