Commit 12fcdefb authored by Changli Gao's avatar Changli Gao Committed by David S. Miller

net: rps: use proto_ports_offset() to handle the AH message correctly

The SPI isn't at the beginning of an AH message.
Signed-off-by: default avatarChangli Gao <xiaosuo@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent e760702e
...@@ -2266,7 +2266,7 @@ static inline void ____napi_schedule(struct softnet_data *sd, ...@@ -2266,7 +2266,7 @@ static inline void ____napi_schedule(struct softnet_data *sd,
*/ */
__u32 __skb_get_rxhash(struct sk_buff *skb) __u32 __skb_get_rxhash(struct sk_buff *skb)
{ {
int nhoff, hash = 0; int nhoff, hash = 0, poff;
struct ipv6hdr *ip6; struct ipv6hdr *ip6;
struct iphdr *ip; struct iphdr *ip;
u8 ip_proto; u8 ip_proto;
...@@ -2306,24 +2306,15 @@ __u32 __skb_get_rxhash(struct sk_buff *skb) ...@@ -2306,24 +2306,15 @@ __u32 __skb_get_rxhash(struct sk_buff *skb)
goto done; goto done;
} }
switch (ip_proto) { ports.v32 = 0;
case IPPROTO_TCP: poff = proto_ports_offset(ip_proto);
case IPPROTO_UDP: if (poff >= 0) {
case IPPROTO_DCCP: nhoff += ihl * 4 + poff;
case IPPROTO_ESP: if (pskb_may_pull(skb, nhoff + 4)) {
case IPPROTO_AH: ports.v32 = * (__force u32 *) (skb->data + nhoff);
case IPPROTO_SCTP:
case IPPROTO_UDPLITE:
if (pskb_may_pull(skb, (ihl * 4) + 4 + nhoff)) {
ports.v32 = * (__force u32 *) (skb->data + nhoff +
(ihl * 4));
if (ports.v16[1] < ports.v16[0]) if (ports.v16[1] < ports.v16[0])
swap(ports.v16[0], ports.v16[1]); swap(ports.v16[0], ports.v16[1]);
break;
} }
default:
ports.v32 = 0;
break;
} }
/* get a consistent hash (same value on both flow directions) */ /* get a consistent hash (same value on both flow directions) */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment