act_mirred: clear skb->tstamp on redirect

If sch_fq is used at ingress, skbs that might have been
timestamped by net_timestamp_set() if a packet capture
is requesting timestamps could be delayed by arbitrary
amount of time, since sch_fq time base is MONOTONIC.

Fix this problem by moving code from sch_netem.c to act_mirred.c.

Fixes: fb420d5d91 ("tcp/fq: move back to CLOCK_MONOTONIC")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Eric Dumazet 2018-11-10 16:22:29 -08:00 committed by David S. Miller
parent a9049ff921
commit 7236ead1b1
2 changed files with 2 additions and 10 deletions

View File

@ -258,7 +258,8 @@ static int tcf_mirred_act(struct sk_buff *skb, const struct tc_action *a,
if (is_redirect) { if (is_redirect) {
skb2->tc_redirected = 1; skb2->tc_redirected = 1;
skb2->tc_from_ingress = skb2->tc_at_ingress; skb2->tc_from_ingress = skb2->tc_at_ingress;
if (skb2->tc_from_ingress)
skb2->tstamp = 0;
/* let's the caller reinsert the packet, if possible */ /* let's the caller reinsert the packet, if possible */
if (use_reinsert) { if (use_reinsert) {
res->ingress = want_ingress; res->ingress = want_ingress;

View File

@ -648,15 +648,6 @@ deliver:
*/ */
skb->dev = qdisc_dev(sch); skb->dev = qdisc_dev(sch);
#ifdef CONFIG_NET_CLS_ACT
/*
* If it's at ingress let's pretend the delay is
* from the network (tstamp will be updated).
*/
if (skb->tc_redirected && skb->tc_from_ingress)
skb->tstamp = 0;
#endif
if (q->slot.slot_next) { if (q->slot.slot_next) {
q->slot.packets_left--; q->slot.packets_left--;
q->slot.bytes_left -= qdisc_pkt_len(skb); q->slot.bytes_left -= qdisc_pkt_len(skb);