netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
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

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

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1438484942.277866.12350@glenng-linux.sea.corp.google.com>
     [not found] ` <1438484942.277866.12350-ACJuPB1Uyt4EJhTZDIxEbXoUN1GumTyQ7j82oEJ37pA@public.gmane.org>
2015-08-03 16:25   ` [PATCH] openvswitch: Fix L4 checksum handling when dealing with IP fragments Pravin Shelar
     [not found]     ` <CALnjE+p-y8i5h1Dnk0BHnhdq94Ndys=uQ=UXy3uLWmNA48SeJg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-08-03 16:53       ` Glenn Griffin [this message]

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-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org \
    --cc=dev-yBygre7rU0TnMu66kgdUjQ@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=pshelar-l0M0P4e3n4LQT0dZR+AlfA@public.gmane.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).