[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <9AAE0902D5BC7E449B7C8E4E778ABCD0195CB0@AMSPEX01CL01.citrite.net>
Date: Fri, 29 Nov 2013 09:10:01 +0000
From: Paul Durrant <Paul.Durrant@...rix.com>
To: annie li <annie.li@...cle.com>
CC: "xen-devel@...ts.xen.org" <xen-devel@...ts.xen.org>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
Wei Liu <wei.liu2@...rix.com>,
Ian Campbell <Ian.Campbell@...rix.com>,
David Vrabel <david.vrabel@...rix.com>
Subject: RE: [PATCH net v2] xen-netback: fix fragment detection in checksum
setup
> -----Original Message-----
> From: annie li [mailto:annie.li@...cle.com]
> Sent: 29 November 2013 05:36
> To: Paul Durrant
> Cc: xen-devel@...ts.xen.org; netdev@...r.kernel.org; Wei Liu; Ian Campbell;
> David Vrabel
> Subject: Re: [PATCH net v2] xen-netback: fix fragment detection in checksum
> setup
>
>
> On 2013/11/28 21:23, Paul Durrant wrote:
> > The code to detect fragments in checksum_setup() was missing for IPv4
> and
> > too eager for IPv6. (It transpires that Windows seems to send IPv6 packets
> > with a fragment header even if they are not a fragment - i.e. offset is zero,
> > and M bit is not set).
> >
> > Signed-off-by: Paul Durrant <paul.durrant@...rix.com>
> > Cc: Wei Liu <wei.liu2@...rix.com>
> > Cc: Ian Campbell <ian.campbell@...rix.com>
> > Cc: David Vrabel <david.vrabel@...rix.com>
> > ---
> > v2
> >
> > - Added comments noting what fragment/offset masks mean
> >
> > drivers/net/xen-netback/netback.c | 33
> ++++++++++++++++++++++++++++++---
> > 1 file changed, 30 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/net/xen-netback/netback.c b/drivers/net/xen-
> netback/netback.c
> > index 919b650..c7464d8 100644
> > --- a/drivers/net/xen-netback/netback.c
> > +++ b/drivers/net/xen-netback/netback.c
> > @@ -1165,15 +1165,28 @@ static int checksum_setup_ip(struct xenvif *vif,
> struct sk_buff *skb,
> > struct iphdr *iph = (void *)skb->data;
> > unsigned int header_size;
> > unsigned int off;
> > + bool fragment;
> > int err = -EPROTO;
> >
> > + fragment = false;
>
> Is it better to initialize fragment directly as following?
> bool fragment = false;
>
I think that's a matter of personal taste. I tend to favour this style.
Paul
> > +
> > off = sizeof(struct iphdr);
> >
> > header_size = skb->network_header + off + MAX_IPOPTLEN;
> > maybe_pull_tail(skb, header_size);
> >
> > + /* 3fff -> fragment offset != 0 OR more fragments */
> > + if (ntohs(iph->frag_off) & 0x3fff)
> > + fragment = true;
> > +
> > off = iph->ihl * 4;
> >
> > + if (fragment) {
> > + if (net_ratelimit())
> > + netdev_err(vif->dev, "Packet is a fragment!\n");
> > + goto out;
> > + }
> > +
> > switch (iph->protocol) {
> > case IPPROTO_TCP:
> > if (!skb_partial_csum_set(skb, off,
> > @@ -1237,6 +1250,7 @@ static int checksum_setup_ipv6(struct xenvif *vif,
> struct sk_buff *skb,
> > bool fragment;
> > bool done;
> >
> > + fragment = false;
> > done = false;
>
> Same as above for "done" and "fragment"...
>
> Thanks
> Annie
Powered by blists - more mailing lists