X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=net%2Fcore%2Fdv.c;h=29ee77f15932465115d64f7f5d01d395e69af6d6;hb=43bc926fffd92024b46cafaf7350d669ba9ca884;hp=c1340cc53b754ed3e6ab7523fba552e1dcdd79e8;hpb=5273a3df6485dc2ad6aa7ddd441b9a21970f003b;p=linux-2.6.git diff --git a/net/core/dv.c b/net/core/dv.c index c1340cc53..29ee77f15 100644 --- a/net/core/dv.c +++ b/net/core/dv.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -52,26 +53,17 @@ int alloc_divert_blk(struct net_device *dev) { int alloc_size = (sizeof(struct divert_blk) + 3) & ~3; + dev->divert = NULL; if (dev->type == ARPHRD_ETHER) { - printk(KERN_DEBUG "divert: allocating divert_blk for %s\n", - dev->name); - - dev->divert = (struct divert_blk *) - kmalloc(alloc_size, GFP_KERNEL); + dev->divert = kzalloc(alloc_size, GFP_KERNEL); if (dev->divert == NULL) { - printk(KERN_DEBUG "divert: unable to allocate divert_blk for %s\n", + printk(KERN_INFO "divert: unable to allocate divert_blk for %s\n", dev->name); return -ENOMEM; - } else { - memset(dev->divert, 0, sizeof(struct divert_blk)); } dev_hold(dev); - } else { - printk(KERN_DEBUG "divert: not allocating divert_blk for non-ethernet device %s\n", - dev->name); - - dev->divert = NULL; } + return 0; } @@ -85,11 +77,6 @@ void free_divert_blk(struct net_device *dev) kfree(dev->divert); dev->divert=NULL; dev_put(dev); - printk(KERN_DEBUG "divert: freeing divert_blk for %s\n", - dev->name); - } else { - printk(KERN_DEBUG "divert: no divert_blk to free, %s not ethernet\n", - dev->name); } } @@ -192,8 +179,12 @@ out: /* * control function of the diverter */ +#if 0 #define DVDBG(a) \ printk(KERN_DEBUG "divert_ioctl() line %d %s\n", __LINE__, (a)) +#else +#define DVDBG(a) +#endif int divert_ioctl(unsigned int cmd, struct divert_cf __user *arg) { @@ -450,12 +441,12 @@ int divert_ioctl(unsigned int cmd, struct divert_cf __user *arg) */ #define ETH_DIVERT_FRAME(skb) \ - memcpy(skb->mac.ethernet, skb->dev->dev_addr, ETH_ALEN); \ + memcpy(eth_hdr(skb), skb->dev->dev_addr, ETH_ALEN); \ skb->pkt_type=PACKET_HOST void divert_frame(struct sk_buff *skb) { - struct ethhdr *eth = skb->mac.ethernet; + struct ethhdr *eth = eth_hdr(skb); struct iphdr *iph; struct tcphdr *tcph; struct udphdr *udph; @@ -464,7 +455,7 @@ void divert_frame(struct sk_buff *skb) unsigned char *skb_data_end = skb->data + skb->len; /* Packet is already aimed at us, return */ - if (!memcmp(eth, skb->dev->dev_addr, ETH_ALEN)) + if (!compare_ether_addr(eth->h_dest, skb->dev->dev_addr)) return; /* proto is not IP, do nothing */ @@ -553,6 +544,3 @@ void divert_frame(struct sk_buff *skb) break; } } - -EXPORT_SYMBOL(alloc_divert_blk); -EXPORT_SYMBOL(free_divert_blk);