diff mbox series

[bpf,v2] bpf: clear skb->tstamp in bpf_redirect when necessary

Message ID 20191213180817.2510-1-lmb@cloudflare.com
State Accepted
Delegated to: BPF Maintainers
Headers show
Series [bpf,v2] bpf: clear skb->tstamp in bpf_redirect when necessary | expand

Commit Message

Lorenz Bauer Dec. 13, 2019, 6:08 p.m. UTC
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(+)

Comments

Eric Dumazet Dec. 13, 2019, 9:09 p.m. UTC | #1
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>
Alexei Starovoitov Dec. 13, 2019, 11:25 p.m. UTC | #2
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
diff mbox series

Patch

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);