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 5/8] net_sched: cls_flow: use proto_ports_offset() to support AH message
Date: Wed, 18 Aug 2010 07:02:44 -0400 [thread overview]
Message-ID: <1282129364.23601.17.camel@bigi> (raw)
In-Reply-To: <1282107908-3585-1-git-send-email-xiaosuo@gmail.com>
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
next prev parent reply other threads:[~2010-08-18 11:02 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-18 5:05 [PATCH 5/8] net_sched: cls_flow: use proto_ports_offset() to support AH message Changli Gao
2010-08-18 11:02 ` jamal [this message]
2010-08-18 12:42 ` Changli Gao
2010-08-18 12:54 ` jamal
2010-08-18 13:18 ` Changli Gao
2010-08-18 13:53 ` jamal
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=1282129364.23601.17.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).