dect
/
linux-2.6
Archived
13
0
Fork 0

netfilter: ipt_CLUSTERIP: 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>
This commit is contained in:
Changli Gao 2010-08-17 20:34:40 +00:00 committed by David S. Miller
parent 78d3307ede
commit 3d04ebb6ab
1 changed files with 14 additions and 15 deletions

View File

@ -29,6 +29,7 @@
#include <net/netfilter/nf_conntrack.h> #include <net/netfilter/nf_conntrack.h>
#include <net/net_namespace.h> #include <net/net_namespace.h>
#include <net/checksum.h> #include <net/checksum.h>
#include <net/ip.h>
#define CLUSTERIP_VERSION "0.8" #define CLUSTERIP_VERSION "0.8"
@ -231,24 +232,22 @@ clusterip_hashfn(const struct sk_buff *skb,
{ {
const struct iphdr *iph = ip_hdr(skb); const struct iphdr *iph = ip_hdr(skb);
unsigned long hashval; unsigned long hashval;
u_int16_t sport, dport; u_int16_t sport = 0, dport = 0;
const u_int16_t *ports; int poff;
switch (iph->protocol) { poff = proto_ports_offset(iph->protocol);
case IPPROTO_TCP: if (poff >= 0) {
case IPPROTO_UDP: const u_int16_t *ports;
case IPPROTO_UDPLITE: u16 _ports[2];
case IPPROTO_SCTP:
case IPPROTO_DCCP: ports = skb_header_pointer(skb, iph->ihl * 4 + poff, 4, _ports);
case IPPROTO_ICMP: if (ports) {
ports = (const void *)iph+iph->ihl*4; sport = ports[0];
sport = ports[0]; dport = ports[1];
dport = ports[1]; }
break; } else {
default:
if (net_ratelimit()) if (net_ratelimit())
pr_info("unknown protocol %u\n", iph->protocol); pr_info("unknown protocol %u\n", iph->protocol);
sport = dport = 0;
} }
switch (config->hash_mode) { switch (config->hash_mode) {