*
*/
#include <linux/module.h>
+#include <linux/config.h>
#include <linux/proc_fs.h>
#include <linux/jhash.h>
#include <linux/bitops.h>
struct clusterip_config *c;
char buffer[16];
- c = kzalloc(sizeof(*c), GFP_ATOMIC);
+ c = kmalloc(sizeof(*c), GFP_ATOMIC);
if (!c)
return NULL;
+ memset(c, 0, sizeof(*c));
c->dev = dev;
c->clusterip = ip;
memcpy(&c->clustermac, &i->clustermac, ETH_ALEN);
struct iphdr *iph = skb->nh.iph;
unsigned long hashval;
u_int16_t sport, dport;
- u_int16_t *ports;
+ struct tcphdr *th;
+ struct udphdr *uh;
+ struct icmphdr *ih;
switch (iph->protocol) {
case IPPROTO_TCP:
+ th = (void *)iph+iph->ihl*4;
+ sport = ntohs(th->source);
+ dport = ntohs(th->dest);
+ break;
case IPPROTO_UDP:
- case IPPROTO_SCTP:
- case IPPROTO_DCCP:
+ uh = (void *)iph+iph->ihl*4;
+ sport = ntohs(uh->source);
+ dport = ntohs(uh->dest);
+ break;
case IPPROTO_ICMP:
- ports = (void *)iph+iph->ihl*4;
- sport = ports[0];
- dport = ports[1];
+ ih = (void *)iph+iph->ihl*4;
+ sport = ntohs(ih->un.echo.id);
+ dport = (ih->type<<8)|ih->code;
break;
default:
if (net_ratelimit()) {