Skip to contentSkip to conversation

bpf: clear skb->tstamp in bpf_redirect when necessary

PATCH Superseded Lorenz Bauer 3 participants 5 messages Dec 13, 2019

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bpf: clear skb->tstamp in bpf_redirect when necessary

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")
---
 net/core/filter.c | 1 +
 1 file changed, 1 insertion(+)
net/core/filter.c +1 -0
index f1e703eed3d2..d914257763b5 100644
@@ -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);
Signature · 1 line
2.20.1
#1 lore raw
Quoted 7 lines · 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.")

Please use 12 digits sha1

Quoted 2 lines
Fixes fb420d5 ("tcp/fq: move back to CLOCK_MONOTONIC")

Thanks for fixing this !

#2 lore raw

PATCH v2 1/1 bpf: clear skb->tstamp in bpf_redirect when necessary

In reply to 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")
---
 net/core/filter.c | 1 +
 1 file changed, 1 insertion(+)
net/core/filter.c +1 -0
index f1e703eed3d2..d914257763b5 100644
@@ -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);
Signature · 1 line
2.20.1
Reviewed-by on v2 1/1
#3 lore raw
Quoted 19 lines · 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")
---
 net/core/filter.c | 1 +
 1 file changed, 1 insertion(+)
net/core/filter.c +0 -0
index f1e703eed3d2..d914257763b5 100644

net/core/filter.c static inline int __bpf_tx_skb(struct net_device *dev, struct sk_buff *skb) · line 2061

Quoted 7 lines
net/core/filter.c +1 -0
@@ -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 !

#4 lore raw
Quoted 27 lines · Eric Dumazet
Quoted 23 lines · 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")
---
 net/core/filter.c | 1 +
 1 file changed, 1 insertion(+)
net/core/filter.c +1 -0
index f1e703eed3d2..d914257763b5 100644
@@ -2055,6 +2055,7 @@ static inline int __bpf_tx_skb(struct net_device *dev, struct sk_buff *skb)
      }
 
      skb->dev = dev;
+     skb->tstamp = 0;
 
Quoted 7 lines

net/core/filter.c static inline int __bpf_tx_skb(struct net_device *dev, struct sk_buff *skb) · line 2061

Quoted 3 lines
net/core/filter.c +0 -0
      dev_xmit_recursion_inc();
      ret = dev_queue_xmit(skb);

Thanks !

Applied. Thanks