Re: [PATCH net-next] sock: correctly test SOCK_TIMESTAMP in sock_recv_ts_and_drops()

2017-04-02 Thread David Miller
From: Eric Dumazet 
Date: Fri, 31 Mar 2017 14:59:25 -0700

> From: Eric Dumazet 
> 
> 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 
> Cc: Paolo Abeni 

Applied, thanks.


Re: [PATCH net-next] sock: correctly test SOCK_TIMESTAMP in sock_recv_ts_and_drops()

2017-03-31 Thread Paolo Abeni
On Fri, 2017-03-31 at 14:59 -0700, Eric Dumazet wrote:
> From: Eric Dumazet 
> 
> 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 
> Cc: Paolo Abeni 
> ---
>  include/net/sock.h |2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/net/sock.h b/include/net/sock.h
> index 
> 8e53158a7d957ea2a480cc449606dca2480b1259..66349e49d468646ce724485bb8e74952825f0d6c
>  100644
> --- a/include/net/sock.h
> +++ b/include/net/sock.h
> @@ -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;
> 

Oh, my bad! 

Thanks Eric for fixing this.

Acked-by: Paolo Abeni 




[PATCH net-next] sock: correctly test SOCK_TIMESTAMP in sock_recv_ts_and_drops()

2017-03-31 Thread Eric Dumazet
From: Eric Dumazet 

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 
Cc: Paolo Abeni 
---
 include/net/sock.h |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/net/sock.h b/include/net/sock.h
index 
8e53158a7d957ea2a480cc449606dca2480b1259..66349e49d468646ce724485bb8e74952825f0d6c
 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -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;