Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1199016 > unrolled thread

Re: [PATCH] openvswitch: Fix L4 checksum handling when dealing with IP fragments

Started byPravin Shelar <pshelar@nicira.com>
First post2015-08-03 18:30 +0200
Last post2015-08-03 19:00 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH] openvswitch: Fix L4 checksum handling when dealing with  IP fragments Pravin Shelar <pshelar@nicira.com> - 2015-08-03 18:30 +0200
    Re: [PATCH] openvswitch: Fix L4 checksum handling when dealing with  IP fragments Glenn Griffin <ggriffin.kernel@gmail.com> - 2015-08-03 19:00 +0200

#1199016 — Re: [PATCH] openvswitch: Fix L4 checksum handling when dealing with IP fragments

FromPravin Shelar <pshelar@nicira.com>
Date2015-08-03 18:30 +0200
SubjectRe: [PATCH] openvswitch: Fix L4 checksum handling when dealing with IP fragments
Message-ID<pTqMG-8nK-5@gated-at.bofh.it>
On Sat, Aug 1, 2015 at 6:31 PM, Glenn Griffin <ggriffin.kernel@gmail.com> wrote:
> openvswitch modifies the L4 checksum of a packet when modifying
> the ip address. When an IP packet is fragmented only the first
> fragment contains an L4 header and checksum. Prior to this change
> openvswitch would modify all fragments, modifying application data
> in non-first fragments, causing checksum failures in the
> reassembled packet.
>
> Signed-off-by: Glenn Griffin <ggriffin.kernel@gmail.com>

Patch looks good. I have one following comment.
> ---
>  net/openvswitch/actions.c | 16 ++++++++++++----
>  1 file changed, 12 insertions(+), 4 deletions(-)
>
> diff --git a/net/openvswitch/actions.c b/net/openvswitch/actions.c
> index 8a8c0b8..bfffb1a 100644
> --- a/net/openvswitch/actions.c
> +++ b/net/openvswitch/actions.c
> @@ -273,28 +273,36 @@ static int set_eth_addr(struct sk_buff *skb, struct sw_flow_key *flow_key,
>         return 0;
>  }
>
> -static void set_ip_addr(struct sk_buff *skb, struct iphdr *nh,
> -                       __be32 *addr, __be32 new_addr)
> +static void update_ip_l4_checksum(struct sk_buff *skb, struct iphdr *nh,
> +                                 __be32 addr, __be32 new_addr)
>  {
>         int transport_len = skb->len - skb_transport_offset(skb);
>
> +       if (ntohs(nh->frag_off) & IP_OFFSET)
> +               return;

It is efficient to check frag-offset in network byte order.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1199040

FromGlenn Griffin <ggriffin.kernel@gmail.com>
Date2015-08-03 19:00 +0200
Message-ID<pTrfI-uN-9@gated-at.bofh.it>
In reply to#1199016
On Mon, Aug 03, 2015 at 09:25:53AM -0700, Pravin Shelar wrote:
> On Sat, Aug 1, 2015 at 6:31 PM, Glenn Griffin <ggriffin.kernel@gmail.com> wrote:
> > openvswitch modifies the L4 checksum of a packet when modifying
> > the ip address. When an IP packet is fragmented only the first
> > fragment contains an L4 header and checksum. Prior to this change
> > openvswitch would modify all fragments, modifying application data
> > in non-first fragments, causing checksum failures in the
> > reassembled packet.
> >
> > Signed-off-by: Glenn Griffin <ggriffin.kernel@gmail.com>
> 
> Patch looks good. I have one following comment.
> > ---
> >  net/openvswitch/actions.c | 16 ++++++++++++----
> >  1 file changed, 12 insertions(+), 4 deletions(-)
> >
> > diff --git a/net/openvswitch/actions.c b/net/openvswitch/actions.c
> > index 8a8c0b8..bfffb1a 100644
> > --- a/net/openvswitch/actions.c
> > +++ b/net/openvswitch/actions.c
> > @@ -273,28 +273,36 @@ static int set_eth_addr(struct sk_buff *skb, struct sw_flow_key *flow_key,
> >         return 0;
> >  }
> >
> > -static void set_ip_addr(struct sk_buff *skb, struct iphdr *nh,
> > -                       __be32 *addr, __be32 new_addr)
> > +static void update_ip_l4_checksum(struct sk_buff *skb, struct iphdr *nh,
> > +                                 __be32 addr, __be32 new_addr)
> >  {
> >         int transport_len = skb->len - skb_transport_offset(skb);
> >
> > +       if (ntohs(nh->frag_off) & IP_OFFSET)
> > +               return;
> 
> It is efficient to check frag-offset in network byte order.

I'll send a revised patch.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web