diff options
author | Changli Gao <xiaosuo@gmail.com> | 2010-08-17 15:07:35 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-08-19 20:16:25 -0400 |
commit | b9959c2e4460b1df1d113d829180398588bb04b4 (patch) | |
tree | 417b3f0564e6df025f272005f971ec859216b815 /net/sched/sch_sfq.c | |
parent | aca071c1c1c07bcc0b100b7c58e59790d6be6a69 (diff) |
net_sched: sch_sfq: use proto_ports_offset() to support AH message
Signed-off-by: Changli Gao <xiaosuo@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched/sch_sfq.c')
-rw-r--r-- | net/sched/sch_sfq.c | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/net/sched/sch_sfq.c b/net/sched/sch_sfq.c index 201cbac2b32c..3cf478d012dd 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) | |||
123 | case htons(ETH_P_IP): | 123 | case htons(ETH_P_IP): |
124 | { | 124 | { |
125 | const struct iphdr *iph; | 125 | const struct iphdr *iph; |
126 | int poff; | ||
126 | 127 | ||
127 | if (!pskb_network_may_pull(skb, sizeof(*iph))) | 128 | if (!pskb_network_may_pull(skb, sizeof(*iph))) |
128 | goto err; | 129 | goto err; |
129 | iph = ip_hdr(skb); | 130 | iph = ip_hdr(skb); |
130 | h = (__force u32)iph->daddr; | 131 | h = (__force u32)iph->daddr; |
131 | h2 = (__force u32)iph->saddr ^ iph->protocol; | 132 | h2 = (__force u32)iph->saddr ^ iph->protocol; |
132 | if (!(iph->frag_off&htons(IP_MF|IP_OFFSET)) && | 133 | if (iph->frag_off & htons(IP_MF|IP_OFFSET)) |
133 | (iph->protocol == IPPROTO_TCP || | 134 | break; |
134 | iph->protocol == IPPROTO_UDP || | 135 | poff = proto_ports_offset(iph->protocol); |
135 | iph->protocol == IPPROTO_UDPLITE || | 136 | if (poff >= 0 && |
136 | iph->protocol == IPPROTO_SCTP || | 137 | pskb_network_may_pull(skb, iph->ihl * 4 + 4 + poff)) { |
137 | iph->protocol == IPPROTO_DCCP || | 138 | iph = ip_hdr(skb); |
138 | iph->protocol == IPPROTO_ESP) && | 139 | h2 ^= *(u32*)((void *)iph + iph->ihl * 4 + poff); |
139 | pskb_network_may_pull(skb, iph->ihl * 4 + 4)) | 140 | } |
140 | h2 ^= *(((u32*)iph) + iph->ihl); | ||
141 | break; | 141 | break; |
142 | } | 142 | } |
143 | case htons(ETH_P_IPV6): | 143 | case htons(ETH_P_IPV6): |
144 | { | 144 | { |
145 | struct ipv6hdr *iph; | 145 | struct ipv6hdr *iph; |
146 | int poff; | ||
146 | 147 | ||
147 | if (!pskb_network_may_pull(skb, sizeof(*iph))) | 148 | if (!pskb_network_may_pull(skb, sizeof(*iph))) |
148 | goto err; | 149 | goto err; |
149 | iph = ipv6_hdr(skb); | 150 | iph = ipv6_hdr(skb); |
150 | h = (__force u32)iph->daddr.s6_addr32[3]; | 151 | h = (__force u32)iph->daddr.s6_addr32[3]; |
151 | h2 = (__force u32)iph->saddr.s6_addr32[3] ^ iph->nexthdr; | 152 | h2 = (__force u32)iph->saddr.s6_addr32[3] ^ iph->nexthdr; |
152 | if ((iph->nexthdr == IPPROTO_TCP || | 153 | poff = proto_ports_offset(iph->nexthdr); |
153 | iph->nexthdr == IPPROTO_UDP || | 154 | if (poff >= 0 && |
154 | iph->nexthdr == IPPROTO_UDPLITE || | 155 | pskb_network_may_pull(skb, sizeof(*iph) + 4 + poff)) { |
155 | iph->nexthdr == IPPROTO_SCTP || | 156 | iph = ipv6_hdr(skb); |
156 | iph->nexthdr == IPPROTO_DCCP || | 157 | h2 ^= *(u32*)((void *)iph + sizeof(*iph) + poff); |
157 | iph->nexthdr == IPPROTO_ESP) && | 158 | } |
158 | pskb_network_may_pull(skb, sizeof(*iph) + 4)) | ||
159 | h2 ^= *(u32*)&iph[1]; | ||
160 | break; | 159 | break; |
161 | } | 160 | } |
162 | default: | 161 | default: |