net-timestamp: only report sw timestamp if reporting bit is set
Subsystems (3)
Willem de Bruijn
maintainerPATCH 1/1 net-timestamp: only report sw timestamp if reporting bit is set
The timestamping API has separate bits for generating and reporting timestamps. A software timestamp should only be reported for a packet when the packet has the relevant generation flag (SKBTX_..) set and the socket has reporting bit SOF_TIMESTAMPING_SOFTWARE set.
The second check was accidentally removed. Reinstitute the original behavior.
Tested:
Without this patch, Documentation/networking/txtimestamp reports timestamps regardless of whether SOF_TIMESTAMPING_SOFTWARE is set. After the patch, it only reports them when the flag is set.
--- include/net/sock.h | 4 +--- net/socket.c | 3 +-- 2 files changed, 2 insertions(+), 5 deletions(-)
include/net/sock.h +1 -3
@@ -2165,9 +2165,7 @@ sock_recv_timestamp(struct msghdr *msg, struct sock *sk, struct sk_buff *skb)*/ if (sock_flag (sk,SOCK_RCVTSTAMP ) || (sk->sk_tsflags &SOF_TIMESTAMPING_RX_SOFTWARE ) || - (kt.tv64 && - (sk->sk_tsflags &SOF_TIMESTAMPING_SOFTWARE || -skb_shinfo (skb)->tx_flags &SKBTX_ANY_SW_TSTAMP )) || + (kt.tv64 && sk->sk_tsflags &SOF_TIMESTAMPING_SOFTWARE ) || (hwtstamps->hwtstamp.tv64 && (sk->sk_tsflags &SOF_TIMESTAMPING_RAW_HARDWARE )))__sock_recv_timestamp (msg, sk, skb);
net/socket.c +1 -2
@@ -734,8 +734,7 @@ void __sock_recv_timestamp(struct msghdr *msg, struct sock *sk, }memset (&tss,0 ,sizeof (tss)); -if ((sk->sk_tsflags &SOF_TIMESTAMPING_SOFTWARE || -skb_shinfo (skb)->tx_flags &SKBTX_ANY_SW_TSTAMP ) && +if ((sk->sk_tsflags &SOF_TIMESTAMPING_SOFTWARE ) &&ktime_to_timespec_cond (skb->tstamp, tss.ts +0 )) empty =0 ; if (shhwtstamps &&
Signature · 1 line
2.1.0.rc2.206.gedb03e5
David Miller
maintainerFrom: Willem de Bruijn <[email protected]>
Date: Wed, 3 Sep 2014 12:01:18 -0400
Quoted 8 lines
The timestamping API has separate bits for generating and reporting timestamps. A software timestamp should only be reported for a packet when the packet has the relevant generation flag (
SKBTX_..) set and the socket has reporting bitSOF_TIMESTAMPING_SOFTWAREset.The second check was accidentally removed. Reinstitute the original behavior.
Quoted 8 lines
Tested:
Without this patch,Documentation/networking/txtimestampreports timestamps regardless of whetherSOF_TIMESTAMPING_SOFTWAREis set. After the patch, it only reports them when the flag is set.Fixes f24b9be5957b ("net-timestamp: extend SCM_TIMESTAMPING ancillary data struct")Signed-off-by Willem de Bruijn <[email protected]>
Applied and queued up for -stable, thanks Willem.