All of lore.kernel.org
 help / color / mirror / Atom feed
From: Glenn Griffin <ggriffin.kernel@gmail.com>
To: Pravin Shelar <pshelar@nicira.com>
Cc: "David S. Miller" <davem@davemloft.net>,
	netdev <netdev@vger.kernel.org>,
	"dev@openvswitch.org" <dev@openvswitch.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] openvswitch: Fix L4 checksum handling when dealing with IP fragments
Date: Mon, 3 Aug 2015 09:53:39 -0700	[thread overview]
Message-ID: <20150803165339.GA11291@google.com> (raw)
In-Reply-To: <CALnjE+p-y8i5h1Dnk0BHnhdq94Ndys=uQ=UXy3uLWmNA48SeJg@mail.gmail.com>

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.

WARNING: multiple messages have this Message-ID (diff)
From: Glenn Griffin <ggriffin.kernel-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Pravin Shelar <pshelar-l0M0P4e3n4LQT0dZR+AlfA@public.gmane.org>
Cc: "dev-yBygre7rU0TnMu66kgdUjQ@public.gmane.org"
	<dev-yBygre7rU0TnMu66kgdUjQ@public.gmane.org>,
	netdev <netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"David S. Miller" <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>,
	LKML <linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: [PATCH] openvswitch: Fix L4 checksum handling when dealing with IP fragments
Date: Mon, 3 Aug 2015 09:53:39 -0700	[thread overview]
Message-ID: <20150803165339.GA11291@google.com> (raw)
In-Reply-To: <CALnjE+p-y8i5h1Dnk0BHnhdq94Ndys=uQ=UXy3uLWmNA48SeJg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

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.
_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

  reply	other threads:[~2015-08-03 16:53 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1438484942.277866.12350@glenng-linux.sea.corp.google.com>
2015-08-03 16:25 ` [PATCH] openvswitch: Fix L4 checksum handling when dealing with IP fragments Pravin Shelar
2015-08-03 16:25   ` Pravin Shelar
2015-08-03 16:53   ` Glenn Griffin [this message]
2015-08-03 16:53     ` Glenn Griffin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150803165339.GA11291@google.com \
    --to=ggriffin.kernel@gmail.com \
    --cc=davem@davemloft.net \
    --cc=dev@openvswitch.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pshelar@nicira.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.