[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CALnjE+owxmLQXLZoAU4oNXToDA1hb4uvr8nj9KXCiKgcRhEOvQ@mail.gmail.com>
Date: Mon, 17 Aug 2015 11:33:59 -0700
From: Pravin Shelar <pshelar@...ira.com>
To: Simon Horman <simon.horman@...ronome.com>
Cc: Jesse Gross <jesse@...ira.com>, netdev <netdev@...r.kernel.org>,
"dev@...nvswitch.org" <dev@...nvswitch.org>
Subject: Re: [PATCH/RFC] openvswitch: Retain parsed IPv6 header fields in flow
on error skipping extension headers
On Thu, Aug 13, 2015 at 6:30 PM, Simon Horman
<simon.horman@...ronome.com> wrote:
> When an error occurs skipping IPv6 extension headers retain the already
> parsed IP protocol and IPv6 addresses in the flow. Also assume that the
> packet is not a fragment in the absence of information to the contrary;
> that is always use the frag_off value set by ipv6_skip_exthdr().
>
> This allows matching on the IP protocol and IPv6 addresses of packets
> with malformed extension headers.
>
> Signed-off-by: Simon Horman <simon.horman@...ronome.com>
>
> ---
>
> * Some consideration should be given to unwanted side effects of this patch
> as it affects the handling of malformed packets.
>
> Signed-off-by: Simon Horman <simon.horman@...ronome.com>
> ---
> net/openvswitch/flow.c | 11 +++++++----
> 1 file changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/net/openvswitch/flow.c b/net/openvswitch/flow.c
> index 8db22ef73626..3c5336c5d4ea 100644
> --- a/net/openvswitch/flow.c
> +++ b/net/openvswitch/flow.c
> @@ -271,8 +271,6 @@ static int parse_ipv6hdr(struct sk_buff *skb, struct sw_flow_key *key)
> key->ipv6.addr.dst = nh->daddr;
>
> payload_ofs = ipv6_skip_exthdr(skb, payload_ofs, &nexthdr, &frag_off);
> - if (unlikely(payload_ofs < 0))
> - return -EINVAL;
>
> if (frag_off) {
> if (frag_off & htons(~0x7))
> @@ -283,6 +281,13 @@ static int parse_ipv6hdr(struct sk_buff *skb, struct sw_flow_key *key)
> key->ip.frag = OVS_FRAG_TYPE_NONE;
> }
>
> + /* Delayed handling of error in ipv6_skip_exthdr() as it
> + * always sets frag_off to a valid value which may be
> + * used to set key->ip.frag above.
> + */
> + if (unlikely(payload_ofs < 0))
> + return -EINVAL;
> +
check_header() function called above also return -EINVAL, That could
confuse caller checking for error code. So we need different error
code here.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists