* [PATCH 8/8] net_sched: sch_sfq: use proto_ports_offset() to support AH message
@ 2010-08-18 5:07 Changli Gao
2010-08-18 11:05 ` jamal
2010-08-20 0:17 ` David Miller
0 siblings, 2 replies; 3+ messages in thread
From: Changli Gao @ 2010-08-18 5:07 UTC (permalink / raw)
To: Jamal Hadi Salim; +Cc: David S. Miller, netdev, Changli Gao
Signed-off-by: Changli Gao <xiaosuo@gmail.com>
---
net/sched/sch_sfq.c | 33 ++++++++++++++++-----------------
1 file changed, 16 insertions(+), 17 deletions(-)
diff --git a/net/sched/sch_sfq.c b/net/sched/sch_sfq.c
index 201cbac..3cf478d 100644
--- a/net/sched/sch_sfq.c
+++ b/net/sched/sch_sfq.c
@@ -123,40 +123,39 @@ static unsigned sfq_hash(struct sfq_sched_data *q, struct sk_buff *skb)
case htons(ETH_P_IP):
{
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;
}
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:
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 8/8] net_sched: sch_sfq: use proto_ports_offset() to support AH message
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
2010-08-20 0:17 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: jamal @ 2010-08-18 11:05 UTC (permalink / raw)
To: Changli Gao; +Cc: David S. Miller, netdev
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:
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 8/8] net_sched: sch_sfq: use proto_ports_offset() to support AH message
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
@ 2010-08-20 0:17 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2010-08-20 0:17 UTC (permalink / raw)
To: xiaosuo; +Cc: hadi, netdev
From: Changli Gao <xiaosuo@gmail.com>
Date: Wed, 18 Aug 2010 13:07:35 +0800
> Signed-off-by: Changli Gao <xiaosuo@gmail.com>
Applied.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-08-20 0:17 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2010-08-20 0:17 ` David Miller
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).