linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH bpf] bpf: clear skb->tstamp in bpf_redirect when necessary
@ 2019-12-13 15:46 Lorenz Bauer
  2019-12-13 17:49 ` Eric Dumazet
  2019-12-13 18:08 ` [PATCH bpf v2] " Lorenz Bauer
  0 siblings, 2 replies; 5+ messages in thread
From: Lorenz Bauer @ 2019-12-13 15:46 UTC (permalink / raw)
  To: ast, daniel, David S. Miller, Jesus Sanchez-Palencia,
	Richard Cochran, Eric Dumazet, netdev, bpf, linux-kernel
  Cc: kernel-team, Lorenz Bauer

Redirecting a packet from ingress to egress by using bpf_redirect
breaks if the egress interface has an fq qdisc installed. This is the same
problem as fixed in 8203e2d8 ("net: clear skb->tstamp in forwarding paths").

Clear skb->tstamp when redirecting into the egress path.

Fixes: 80b14de ("net: Add a new socket option for a future transmit time.")
Fixes: fb420d5 ("tcp/fq: move back to CLOCK_MONOTONIC")
Signed-off-by: Lorenz Bauer <lmb@cloudflare.com>
---
 net/core/filter.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/core/filter.c b/net/core/filter.c
index f1e703eed3d2..d914257763b5 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -2055,6 +2055,7 @@ static inline int __bpf_tx_skb(struct net_device *dev, struct sk_buff *skb)
 	}
 
 	skb->dev = dev;
+	skb->tstamp = 0;
 
 	dev_xmit_recursion_inc();
 	ret = dev_queue_xmit(skb);
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH bpf] bpf: clear skb->tstamp in bpf_redirect when necessary
  2019-12-13 15:46 [PATCH bpf] bpf: clear skb->tstamp in bpf_redirect when necessary Lorenz Bauer
@ 2019-12-13 17:49 ` Eric Dumazet
  2019-12-13 18:08 ` [PATCH bpf v2] " Lorenz Bauer
  1 sibling, 0 replies; 5+ messages in thread
From: Eric Dumazet @ 2019-12-13 17:49 UTC (permalink / raw)
  To: Lorenz Bauer, ast, daniel, David S. Miller,
	Jesus Sanchez-Palencia, Richard Cochran, Eric Dumazet, netdev,
	bpf, linux-kernel
  Cc: kernel-team



On 12/13/19 7:46 AM, Lorenz Bauer wrote:
> Redirecting a packet from ingress to egress by using bpf_redirect
> breaks if the egress interface has an fq qdisc installed. This is the same
> problem as fixed in 8203e2d8 ("net: clear skb->tstamp in forwarding paths").
> 
> Clear skb->tstamp when redirecting into the egress path.
> 
> Fixes: 80b14de ("net: Add a new socket option for a future transmit time.")

Please use 12 digits sha1


> Fixes: fb420d5 ("tcp/fq: move back to CLOCK_MONOTONIC")
> Signed-off-by: Lorenz Bauer <lmb@cloudflare.com>

Thanks for fixing this !


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH bpf v2] bpf: clear skb->tstamp in bpf_redirect when necessary
  2019-12-13 15:46 [PATCH bpf] bpf: clear skb->tstamp in bpf_redirect when necessary Lorenz Bauer
  2019-12-13 17:49 ` Eric Dumazet
@ 2019-12-13 18:08 ` Lorenz Bauer
  2019-12-13 21:09   ` Eric Dumazet
  1 sibling, 1 reply; 5+ messages in thread
From: Lorenz Bauer @ 2019-12-13 18:08 UTC (permalink / raw)
  To: ast, daniel, davem, Eric Dumazet, netdev, bpf, linux-kernel
  Cc: kernel-team, Lorenz Bauer

Redirecting a packet from ingress to egress by using bpf_redirect
breaks if the egress interface has an fq qdisc installed. This is the same
problem as fixed in 'commit 8203e2d844d3 ("net: clear skb->tstamp in forwarding paths")

Clear skb->tstamp when redirecting into the egress path.

Fixes: 80b14dee2bea ("net: Add a new socket option for a future transmit time.")
Fixes: fb420d5d91c1 ("tcp/fq: move back to CLOCK_MONOTONIC")
Signed-off-by: Lorenz Bauer <lmb@cloudflare.com>
---
 net/core/filter.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/core/filter.c b/net/core/filter.c
index f1e703eed3d2..d914257763b5 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -2055,6 +2055,7 @@ static inline int __bpf_tx_skb(struct net_device *dev, struct sk_buff *skb)
 	}
 
 	skb->dev = dev;
+	skb->tstamp = 0;
 
 	dev_xmit_recursion_inc();
 	ret = dev_queue_xmit(skb);
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH bpf v2] bpf: clear skb->tstamp in bpf_redirect when necessary
  2019-12-13 18:08 ` [PATCH bpf v2] " Lorenz Bauer
@ 2019-12-13 21:09   ` Eric Dumazet
  2019-12-13 23:25     ` Alexei Starovoitov
  0 siblings, 1 reply; 5+ messages in thread
From: Eric Dumazet @ 2019-12-13 21:09 UTC (permalink / raw)
  To: Lorenz Bauer, ast, daniel, davem, Eric Dumazet, netdev, bpf,
	linux-kernel
  Cc: kernel-team



On 12/13/19 10:08 AM, Lorenz Bauer wrote:
> Redirecting a packet from ingress to egress by using bpf_redirect
> breaks if the egress interface has an fq qdisc installed. This is the same
> problem as fixed in 'commit 8203e2d844d3 ("net: clear skb->tstamp in forwarding paths")
> 
> Clear skb->tstamp when redirecting into the egress path.
> 
> Fixes: 80b14dee2bea ("net: Add a new socket option for a future transmit time.")
> Fixes: fb420d5d91c1 ("tcp/fq: move back to CLOCK_MONOTONIC")
> Signed-off-by: Lorenz Bauer <lmb@cloudflare.com>
> ---
>  net/core/filter.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/net/core/filter.c b/net/core/filter.c
> index f1e703eed3d2..d914257763b5 100644
> --- a/net/core/filter.c
> +++ b/net/core/filter.c
> @@ -2055,6 +2055,7 @@ static inline int __bpf_tx_skb(struct net_device *dev, struct sk_buff *skb)
>  	}
>  
>  	skb->dev = dev;
> +	skb->tstamp = 0;
>  
>  	dev_xmit_recursion_inc();
>  	ret = dev_queue_xmit(skb);
> 

Thanks !

Reviewed-by: Eric Dumazet <edumazet@google.com>


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH bpf v2] bpf: clear skb->tstamp in bpf_redirect when necessary
  2019-12-13 21:09   ` Eric Dumazet
@ 2019-12-13 23:25     ` Alexei Starovoitov
  0 siblings, 0 replies; 5+ messages in thread
From: Alexei Starovoitov @ 2019-12-13 23:25 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: Lorenz Bauer, Alexei Starovoitov, Daniel Borkmann,
	David S. Miller, Eric Dumazet, Network Development, bpf, LKML,
	kernel-team

On Fri, Dec 13, 2019 at 1:09 PM Eric Dumazet <eric.dumazet@gmail.com> wrote:
>
>
>
> On 12/13/19 10:08 AM, Lorenz Bauer wrote:
> > Redirecting a packet from ingress to egress by using bpf_redirect
> > breaks if the egress interface has an fq qdisc installed. This is the same
> > problem as fixed in 'commit 8203e2d844d3 ("net: clear skb->tstamp in forwarding paths")
> >
> > Clear skb->tstamp when redirecting into the egress path.
> >
> > Fixes: 80b14dee2bea ("net: Add a new socket option for a future transmit time.")
> > Fixes: fb420d5d91c1 ("tcp/fq: move back to CLOCK_MONOTONIC")
> > Signed-off-by: Lorenz Bauer <lmb@cloudflare.com>
> > ---
> >  net/core/filter.c | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/net/core/filter.c b/net/core/filter.c
> > index f1e703eed3d2..d914257763b5 100644
> > --- a/net/core/filter.c
> > +++ b/net/core/filter.c
> > @@ -2055,6 +2055,7 @@ static inline int __bpf_tx_skb(struct net_device *dev, struct sk_buff *skb)
> >       }
> >
> >       skb->dev = dev;
> > +     skb->tstamp = 0;
> >
> >       dev_xmit_recursion_inc();
> >       ret = dev_queue_xmit(skb);
> >
>
> Thanks !
>
> Reviewed-by: Eric Dumazet <edumazet@google.com>

Applied. Thanks

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-12-13 23:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-13 15:46 [PATCH bpf] bpf: clear skb->tstamp in bpf_redirect when necessary Lorenz Bauer
2019-12-13 17:49 ` Eric Dumazet
2019-12-13 18:08 ` [PATCH bpf v2] " Lorenz Bauer
2019-12-13 21:09   ` Eric Dumazet
2019-12-13 23:25     ` Alexei Starovoitov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).