提交 b9959c2e 编写于 作者: C Changli Gao 提交者: David S. Miller

net_sched: sch_sfq: use proto_ports_offset() to support AH message

Signed-off-by: NChangli Gao <xiaosuo@gmail.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 aca071c1
...@@ -123,40 +123,39 @@ static unsigned sfq_hash(struct sfq_sched_data *q, struct sk_buff *skb) ...@@ -123,40 +123,39 @@ static unsigned sfq_hash(struct sfq_sched_data *q, struct sk_buff *skb)
case htons(ETH_P_IP): case htons(ETH_P_IP):
{ {
const struct iphdr *iph; const struct iphdr *iph;
int poff;
if (!pskb_network_may_pull(skb, sizeof(*iph))) if (!pskb_network_may_pull(skb, sizeof(*iph)))
goto err; goto err;
iph = ip_hdr(skb); iph = ip_hdr(skb);
h = (__force u32)iph->daddr; h = (__force u32)iph->daddr;
h2 = (__force u32)iph->saddr ^ iph->protocol; h2 = (__force u32)iph->saddr ^ iph->protocol;
if (!(iph->frag_off&htons(IP_MF|IP_OFFSET)) && if (iph->frag_off & htons(IP_MF|IP_OFFSET))
(iph->protocol == IPPROTO_TCP || break;
iph->protocol == IPPROTO_UDP || poff = proto_ports_offset(iph->protocol);
iph->protocol == IPPROTO_UDPLITE || if (poff >= 0 &&
iph->protocol == IPPROTO_SCTP || pskb_network_may_pull(skb, iph->ihl * 4 + 4 + poff)) {
iph->protocol == IPPROTO_DCCP || iph = ip_hdr(skb);
iph->protocol == IPPROTO_ESP) && h2 ^= *(u32*)((void *)iph + iph->ihl * 4 + poff);
pskb_network_may_pull(skb, iph->ihl * 4 + 4)) }
h2 ^= *(((u32*)iph) + iph->ihl);
break; break;
} }
case htons(ETH_P_IPV6): case htons(ETH_P_IPV6):
{ {
struct ipv6hdr *iph; struct ipv6hdr *iph;
int poff;
if (!pskb_network_may_pull(skb, sizeof(*iph))) if (!pskb_network_may_pull(skb, sizeof(*iph)))
goto err; goto err;
iph = ipv6_hdr(skb); iph = ipv6_hdr(skb);
h = (__force u32)iph->daddr.s6_addr32[3]; h = (__force u32)iph->daddr.s6_addr32[3];
h2 = (__force u32)iph->saddr.s6_addr32[3] ^ iph->nexthdr; h2 = (__force u32)iph->saddr.s6_addr32[3] ^ iph->nexthdr;
if ((iph->nexthdr == IPPROTO_TCP || poff = proto_ports_offset(iph->nexthdr);
iph->nexthdr == IPPROTO_UDP || if (poff >= 0 &&
iph->nexthdr == IPPROTO_UDPLITE || pskb_network_may_pull(skb, sizeof(*iph) + 4 + poff)) {
iph->nexthdr == IPPROTO_SCTP || iph = ipv6_hdr(skb);
iph->nexthdr == IPPROTO_DCCP || h2 ^= *(u32*)((void *)iph + sizeof(*iph) + poff);
iph->nexthdr == IPPROTO_ESP) && }
pskb_network_may_pull(skb, sizeof(*iph) + 4))
h2 ^= *(u32*)&iph[1];
break; break;
} }
default: default:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册