netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: jamal <hadi@cyberus.ca>
To: Changli Gao <xiaosuo@gmail.com>
Cc: "David S. Miller" <davem@davemloft.net>, netdev@vger.kernel.org
Subject: Re: [PATCH 8/8] net_sched: sch_sfq: use proto_ports_offset() to support AH message
Date: Wed, 18 Aug 2010 07:05:31 -0400	[thread overview]
Message-ID: <1282129531.23601.20.camel@bigi> (raw)
In-Reply-To: <1282108055-3702-1-git-send-email-xiaosuo@gmail.com>

On Wed, 2010-08-18 at 13:07 +0800, Changli Gao wrote:

>  		const struct iphdr *iph;
> +		int poff;
>  
>  		if (!pskb_network_may_pull(skb, sizeof(*iph)))
>  			goto err;
>  		iph = ip_hdr(skb);
>  		h = (__force u32)iph->daddr;
>  		h2 = (__force u32)iph->saddr ^ iph->protocol;
> -		if (!(iph->frag_off&htons(IP_MF|IP_OFFSET)) &&
> -		    (iph->protocol == IPPROTO_TCP ||
> -		     iph->protocol == IPPROTO_UDP ||
> -		     iph->protocol == IPPROTO_UDPLITE ||
> -		     iph->protocol == IPPROTO_SCTP ||
> -		     iph->protocol == IPPROTO_DCCP ||
> -		     iph->protocol == IPPROTO_ESP) &&
> -		     pskb_network_may_pull(skb, iph->ihl * 4 + 4))
> -			h2 ^= *(((u32*)iph) + iph->ihl);
> +		if (iph->frag_off & htons(IP_MF|IP_OFFSET))
> +			break;
> +		poff = proto_ports_offset(iph->protocol);
> +		if (poff >= 0 &&
> +		    pskb_network_may_pull(skb, iph->ihl * 4 + 4 + poff)) {
> +			iph = ip_hdr(skb);
> +			h2 ^= *(u32*)((void *)iph + iph->ihl * 4 + poff);
> +		}
>  		break;

Same comment with this one as earlier patch? Or it may be too early
here ;->

cheers,
jamal

>  	case htons(ETH_P_IPV6):
>  	{
>  		struct ipv6hdr *iph;
> +		int poff;
>  
>  		if (!pskb_network_may_pull(skb, sizeof(*iph)))
>  			goto err;
>  		iph = ipv6_hdr(skb);
>  		h = (__force u32)iph->daddr.s6_addr32[3];
>  		h2 = (__force u32)iph->saddr.s6_addr32[3] ^ iph->nexthdr;
> -		if ((iph->nexthdr == IPPROTO_TCP ||
> -		     iph->nexthdr == IPPROTO_UDP ||
> -		     iph->nexthdr == IPPROTO_UDPLITE ||
> -		     iph->nexthdr == IPPROTO_SCTP ||
> -		     iph->nexthdr == IPPROTO_DCCP ||
> -		     iph->nexthdr == IPPROTO_ESP) &&
> -		    pskb_network_may_pull(skb, sizeof(*iph) + 4))
> -			h2 ^= *(u32*)&iph[1];
> +		poff = proto_ports_offset(iph->nexthdr);
> +		if (poff >= 0 &&
> +		    pskb_network_may_pull(skb, sizeof(*iph) + 4 + poff)) {
> +			iph = ipv6_hdr(skb);
> +			h2 ^= *(u32*)((void *)iph + sizeof(*iph) + poff);
> +		}
>  		break;
>  	}
>  	default:


  reply	other threads:[~2010-08-18 11:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-18  5:07 [PATCH 8/8] net_sched: sch_sfq: use proto_ports_offset() to support AH message Changli Gao
2010-08-18 11:05 ` jamal [this message]
2010-08-20  0:17 ` David Miller

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=1282129531.23601.20.camel@bigi \
    --to=hadi@cyberus.ca \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=xiaosuo@gmail.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 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).