@@ -962,10 +962,6 @@ alloc_new_skb:
sk->sk_allocation);
if (unlikely(skb == NULL))
err = -ENOBUFS;
- else
- /* only the initial fragment is
- time stamped */
- cork->tx_flags = 0;
}
if (skb == NULL)
goto error;
@@ -1010,6 +1006,9 @@ alloc_new_skb:
exthdrlen = 0;
csummode = CHECKSUM_NONE;
+ /* only the initial fragment is time stamped */
+ cork->tx_flags = 0;
+
/*
* Put the packet on the pending queue.
*/
@@ -732,6 +732,7 @@ static int ping_v4_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *m
ipc.tos = -1;
sock_tx_timestamp(sk, &ipc.tx_flags);
+ ipc.tx_flags |= skbflags_tx_tstamp(msg->msg_flags);
if (msg->msg_controllen) {
err = ip_cmsg_send(sock_net(sk), msg, &ipc, false);
@@ -365,6 +365,9 @@ static int raw_send_hdrinc(struct sock *sk, struct flowi4 *fl4,
skb->ip_summed = CHECKSUM_NONE;
+ sock_tx_timestamp(sk, &skb_shinfo(skb)->tx_flags);
+ skb_shinfo(skb)->tx_flags |= skbflags_tx_tstamp(flags);
+
skb->transport_header = skb->network_header;
err = -EFAULT;
if (memcpy_fromiovecend((void *)iph, from, 0, length))
@@ -606,6 +609,9 @@ back_from_confirm:
&rt, msg->msg_flags);
else {
+ sock_tx_timestamp(sk, &ipc.tx_flags);
+ ipc.tx_flags |= skbflags_tx_tstamp(msg->msg_flags);
+
if (!ipc.addr)
ipc.addr = fl4.daddr;
lock_sock(sk);
Add SO_TIMESTAMPING to sockets of type PF_INET[6]/SOCK_RAW. Add MSG_TSTAMP support to these sockets and ping sockets. Ping sockets already supported SO_TIMESTAMPING, though the feature was broken. SOCK_RAW support was tested: - socket option and flag - with and without IP_HDRINCL This fixes http://bugzilla.kernel.org/show_bug.cgi?id=77221 Signed-off-by: Willem de Bruijn <willemb@google.com> --- net/ipv4/ip_output.c | 7 +++---- net/ipv4/ping.c | 1 + net/ipv4/raw.c | 6 ++++++ 3 files changed, 10 insertions(+), 4 deletions(-)