Thread (43 messages) flat view 43 messages, 8 authors, 2018-02-13

Re: [RFC v2 net-next 01/10] net: Add a new socket option for a future transmit time.

From: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
Date: 2018-01-23 20:03:29
Also in: intel-wired-lan

quoted
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.
quoted
quoted
@@ -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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help