[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1282129364.23601.17.camel@bigi>
Date: Wed, 18 Aug 2010 07:02:44 -0400
From: jamal <hadi@...erus.ca>
To: Changli Gao <xiaosuo@...il.com>
Cc: "David S. Miller" <davem@...emloft.net>, netdev@...r.kernel.org
Subject: Re: [PATCH 5/8] net_sched: cls_flow: use proto_ports_offset() to
support AH message
On Wed, 2010-08-18 at 13:05 +0800, Changli Gao wrote:
> -static int has_ports(u8 protocol)
> -{
> - switch (protocol) {
> - case IPPROTO_TCP:
> - case IPPROTO_UDP:
> - case IPPROTO_UDPLITE:
> - case IPPROTO_SCTP:
> - case IPPROTO_DCCP:
> - case IPPROTO_ESP:
> - return 1;
> - default:
> - return 0;
> - }
> -}
> -
> static u32 flow_get_proto_src(struct sk_buff *skb)
> {
> switch (skb->protocol) {
> case htons(ETH_P_IP): {
> struct iphdr *iph;
> + int poff;
>
> if (!pskb_network_may_pull(skb, sizeof(*iph)))
> break;
> iph = ip_hdr(skb);
> - if (!(iph->frag_off&htons(IP_MF|IP_OFFSET)) &&
> - has_ports(iph->protocol) &&
> - pskb_network_may_pull(skb, iph->ihl * 4 + 2))
> - return ntohs(*(__be16 *)((void *)iph + iph->ihl * 4));
> + if (iph->frag_off & htons(IP_MF|IP_OFFSET))
> + break;
> + poff = proto_ports_offset(iph->protocol);
> + if (poff >= 0 &&
I dont think this maintains the same semantic. Ex: In the original code
AH returns 0. In your case it returns 4 and passes the above test.
Same with the other spot.
cheers,
jamal
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists