[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c412ce79-1a37-963f-3633-2eba92ef05c4@mojatatu.com>
Date: Tue, 24 Dec 2019 07:45:08 -0500
From: Jamal Hadi Salim <jhs@...atatu.com>
To: shmulik@...anetworks.com, Cong Wang <xiyou.wangcong@...il.com>,
Jiri Pirko <jiri@...nulli.us>
Cc: "David S . Miller" <davem@...emloft.net>, netdev@...r.kernel.org,
shmulik.ladkani@...il.com,
Shmulik Ladkani <sladkani@...ofpoint.com>
Subject: Re: [PATCH net-next] net/sched: act_mirred: Ensure mac_len is pulled
prior redirect to a non mac_header_xmit target device
On 2019-12-23 7:33 a.m., shmulik@...anetworks.com wrote:
> From: Shmulik Ladkani <sladkani@...ofpoint.com>
>
> There's no skb_pull performed when a mirred action is set at egress of a
> mac device, with a target device/action that expects skb->data to point
> at the network header.
>
> As a result, either the target device is errornously given an skb with
> data pointing to the mac (egress case), or the net stack receives the
> skb with data pointing to the mac (ingress case).
>
> E.g:
> # tc qdisc add dev eth9 root handle 1: prio
> # tc filter add dev eth9 parent 1: prio 9 protocol ip handle 9 basic \
> action mirred egress redirect dev tun0
>
> (tun0 is a tun device. result: tun0 errornously gets the eth header
> instead of the iph)
>
Shmulik - are you able to add a tdc testcase? It will be helpful to
catch future regressions.
I did basic testing i.e have an app reading tun0 from user space
then mirrored(not redirect) packets to tun0 for before and after
patch.
> Revise the push/pull logic of tcf_mirred_act() to not rely on the
> skb_at_tc_ingress() vs tcf_mirred_act_wants_ingress() comparison, as it
> does not cover all "pull" cases.
>
> Instead, calculate whether the required action on the target device
> requires the data to point at the network header, and compare this to
> whether skb->data points to network header - and make the push/pull
> adjustments as necessary.
>
> Signed-off-by: Shmulik Ladkani <sladkani@...ofpoint.com>
Tested-by: Jamal Hadi Salim <jhs@...atatu.com>
Acked-by: Jamal Hadi Salim <jhs@...atatu.com>
cheers,
jamal
Powered by blists - more mailing lists