sock: correctly test SOCK_TIMESTAMP in sock_recv_ts_and_drops()
authorEric Dumazet <edumazet@google.com>
Fri, 31 Mar 2017 21:59:25 +0000 (14:59 -0700)
committerDavid S. Miller <davem@davemloft.net>
Mon, 3 Apr 2017 02:34:55 +0000 (19:34 -0700)
It seems the code does not match the intent.

This broke packetdrill, and probably other programs.

Fixes: 6c7c98bad488 ("sock: avoid dirtying sk_stamp, if possible")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Paolo Abeni <pabeni@redhat.com>
Acked-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/sock.h

index 8e53158a7d957ea2a480cc449606dca2480b1259..66349e49d468646ce724485bb8e74952825f0d6c 100644 (file)
@@ -2250,7 +2250,7 @@ static inline void sock_recv_ts_and_drops(struct msghdr *msg, struct sock *sk,
 
        if (sk->sk_flags & FLAGS_TS_OR_DROPS || sk->sk_tsflags & TSFLAGS_ANY)
                __sock_recv_ts_and_drops(msg, sk, skb);
-       else if (unlikely(sk->sk_flags & SOCK_TIMESTAMP))
+       else if (unlikely(sock_flag(sk, SOCK_TIMESTAMP)))
                sk->sk_stamp = skb->tstamp;
        else if (unlikely(sk->sk_stamp == SK_DEFAULT_STAMP))
                sk->sk_stamp = 0;