From 24e2dda4bfe43b95137ddfa0cb2a496dc6b27308 Mon Sep 17 00:00:00 2001 From: Changli Gao Date: Tue, 17 Aug 2010 20:34:40 +0000 Subject: [PATCH] --- yaml --- r: 213887 b: refs/heads/master c: 3d04ebb6ab2ac9a3bea7644f0d13cdf65002b870 h: refs/heads/master i: 213885: 21bf831d1f263862cdb4169178ebc2eaf05ab045 213883: dce27a56fd11dfafc15caf8d9c8bcad8c795a4b4 213879: 18ad95f6a1c355b51831bc70b76b94921f6b8d61 213871: 258e52853bc89480631ac353998a177283b7ce2e 213855: 14e1cd7efad4fe8f13fd0b75e58dcf05cfb65895 213823: 074bdce7e4c33c6c63d931e604d95ac9b05a1e96 213759: 63195d22733190b098815a12e7d9bd25340af21e v: v3 --- [refs] | 2 +- trunk/net/ipv4/netfilter/ipt_CLUSTERIP.c | 31 ++++++++++++------------ 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/[refs] b/[refs] index 2ef69a1a2dbd..8bf39b5f8754 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 78d3307eded853f01c5e9aaa8c0768c2f75825a3 +refs/heads/master: 3d04ebb6ab2ac9a3bea7644f0d13cdf65002b870 diff --git a/trunk/net/ipv4/netfilter/ipt_CLUSTERIP.c b/trunk/net/ipv4/netfilter/ipt_CLUSTERIP.c index 3a43cf36db87..1e26a4897655 100644 --- a/trunk/net/ipv4/netfilter/ipt_CLUSTERIP.c +++ b/trunk/net/ipv4/netfilter/ipt_CLUSTERIP.c @@ -29,6 +29,7 @@ #include #include #include +#include #define CLUSTERIP_VERSION "0.8" @@ -231,24 +232,22 @@ clusterip_hashfn(const struct sk_buff *skb, { const struct iphdr *iph = ip_hdr(skb); unsigned long hashval; - u_int16_t sport, dport; - const u_int16_t *ports; - - switch (iph->protocol) { - case IPPROTO_TCP: - case IPPROTO_UDP: - case IPPROTO_UDPLITE: - case IPPROTO_SCTP: - case IPPROTO_DCCP: - case IPPROTO_ICMP: - ports = (const void *)iph+iph->ihl*4; - sport = ports[0]; - dport = ports[1]; - break; - default: + u_int16_t sport = 0, dport = 0; + int poff; + + poff = proto_ports_offset(iph->protocol); + if (poff >= 0) { + const u_int16_t *ports; + u16 _ports[2]; + + ports = skb_header_pointer(skb, iph->ihl * 4 + poff, 4, _ports); + if (ports) { + sport = ports[0]; + dport = ports[1]; + } + } else { if (net_ratelimit()) pr_info("unknown protocol %u\n", iph->protocol); - sport = dport = 0; } switch (config->hash_mode) {