提交 38afd6ad 编写于 作者: L Linus Torvalds

Merge master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6

...@@ -41,7 +41,7 @@ static unsigned int crypt_slow(const struct cipher_desc *desc, ...@@ -41,7 +41,7 @@ static unsigned int crypt_slow(const struct cipher_desc *desc,
struct scatter_walk *in, struct scatter_walk *in,
struct scatter_walk *out, unsigned int bsize) struct scatter_walk *out, unsigned int bsize)
{ {
unsigned int alignmask = crypto_tfm_alg_alignmask(desc->tfm); unsigned long alignmask = crypto_tfm_alg_alignmask(desc->tfm);
u8 buffer[bsize * 2 + alignmask]; u8 buffer[bsize * 2 + alignmask];
u8 *src = (u8 *)ALIGN((unsigned long)buffer, alignmask + 1); u8 *src = (u8 *)ALIGN((unsigned long)buffer, alignmask + 1);
u8 *dst = src + bsize; u8 *dst = src + bsize;
...@@ -160,7 +160,7 @@ static int crypt_iv_unaligned(struct cipher_desc *desc, ...@@ -160,7 +160,7 @@ static int crypt_iv_unaligned(struct cipher_desc *desc,
unsigned int nbytes) unsigned int nbytes)
{ {
struct crypto_tfm *tfm = desc->tfm; struct crypto_tfm *tfm = desc->tfm;
unsigned int alignmask = crypto_tfm_alg_alignmask(tfm); unsigned long alignmask = crypto_tfm_alg_alignmask(tfm);
u8 *iv = desc->info; u8 *iv = desc->info;
if (unlikely(((unsigned long)iv & alignmask))) { if (unlikely(((unsigned long)iv & alignmask))) {
...@@ -424,7 +424,7 @@ int crypto_init_cipher_ops(struct crypto_tfm *tfm) ...@@ -424,7 +424,7 @@ int crypto_init_cipher_ops(struct crypto_tfm *tfm)
} }
if (ops->cit_mode == CRYPTO_TFM_MODE_CBC) { if (ops->cit_mode == CRYPTO_TFM_MODE_CBC) {
unsigned int align; unsigned long align;
unsigned long addr; unsigned long addr;
switch (crypto_tfm_alg_blocksize(tfm)) { switch (crypto_tfm_alg_blocksize(tfm)) {
......
...@@ -75,7 +75,7 @@ static inline unsigned int crypto_cipher_ctxsize(struct crypto_alg *alg, ...@@ -75,7 +75,7 @@ static inline unsigned int crypto_cipher_ctxsize(struct crypto_alg *alg,
switch (flags & CRYPTO_TFM_MODE_MASK) { switch (flags & CRYPTO_TFM_MODE_MASK) {
case CRYPTO_TFM_MODE_CBC: case CRYPTO_TFM_MODE_CBC:
len = ALIGN(len, alg->cra_alignmask + 1); len = ALIGN(len, (unsigned long)alg->cra_alignmask + 1);
len += alg->cra_blocksize; len += alg->cra_blocksize;
break; break;
} }
......
...@@ -794,7 +794,9 @@ static void drain_rx_pools (amb_dev * dev) { ...@@ -794,7 +794,9 @@ static void drain_rx_pools (amb_dev * dev) {
drain_rx_pool (dev, pool); drain_rx_pool (dev, pool);
} }
static inline void fill_rx_pool (amb_dev * dev, unsigned char pool, int priority) { static inline void fill_rx_pool (amb_dev * dev, unsigned char pool,
unsigned int __nocast priority)
{
rx_in rx; rx_in rx;
amb_rxq * rxq; amb_rxq * rxq;
......
...@@ -1374,7 +1374,8 @@ static void reset_chip (struct fs_dev *dev) ...@@ -1374,7 +1374,8 @@ static void reset_chip (struct fs_dev *dev)
} }
} }
static void __devinit *aligned_kmalloc (int size, int flags, int alignment) static void __devinit *aligned_kmalloc (int size, unsigned int __nocast flags,
int alignment)
{ {
void *t; void *t;
...@@ -1464,7 +1465,8 @@ static inline int nr_buffers_in_freepool (struct fs_dev *dev, struct freepool *f ...@@ -1464,7 +1465,8 @@ static inline int nr_buffers_in_freepool (struct fs_dev *dev, struct freepool *f
does. I've seen "receive abort: no buffers" and things started does. I've seen "receive abort: no buffers" and things started
working again after that... -- REW */ working again after that... -- REW */
static void top_off_fp (struct fs_dev *dev, struct freepool *fp, int gfp_flags) static void top_off_fp (struct fs_dev *dev, struct freepool *fp,
unsigned int __nocast gfp_flags)
{ {
struct FS_BPENTRY *qe, *ne; struct FS_BPENTRY *qe, *ne;
struct sk_buff *skb; struct sk_buff *skb;
......
...@@ -57,7 +57,6 @@ ...@@ -57,7 +57,6 @@
#include <linux/config.h> #include <linux/config.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/version.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/skbuff.h> #include <linux/skbuff.h>
#include <linux/pci.h> #include <linux/pci.h>
......
...@@ -46,6 +46,7 @@ static char const rcsid[] = ...@@ -46,6 +46,7 @@ static char const rcsid[] =
#include <linux/init.h> #include <linux/init.h>
#include <linux/bitops.h> #include <linux/bitops.h>
#include <linux/wait.h> #include <linux/wait.h>
#include <linux/jiffies.h>
#include <asm/semaphore.h> #include <asm/semaphore.h>
#include <asm/io.h> #include <asm/io.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
...@@ -780,7 +781,7 @@ push_on_scq(struct idt77252_dev *card, struct vc_map *vc, struct sk_buff *skb) ...@@ -780,7 +781,7 @@ push_on_scq(struct idt77252_dev *card, struct vc_map *vc, struct sk_buff *skb)
return 0; return 0;
out: out:
if (jiffies - scq->trans_start > HZ) { if (time_after(jiffies, scq->trans_start + HZ)) {
printk("%s: Error pushing TBD for %d.%d\n", printk("%s: Error pushing TBD for %d.%d\n",
card->name, vc->tx_vcc->vpi, vc->tx_vcc->vci); card->name, vc->tx_vcc->vpi, vc->tx_vcc->vci);
#ifdef CONFIG_ATM_IDT77252_DEBUG #ifdef CONFIG_ATM_IDT77252_DEBUG
......
...@@ -16,9 +16,9 @@ ...@@ -16,9 +16,9 @@
#include <linux/skbuff.h> #include <linux/skbuff.h>
#include <linux/netdevice.h> #include <linux/netdevice.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/ioport.h> /* for request_region */
#include <linux/uio.h> #include <linux/uio.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/dma-mapping.h>
#include <linux/atm_zatm.h> #include <linux/atm_zatm.h>
#include <linux/capability.h> #include <linux/capability.h>
#include <linux/bitops.h> #include <linux/bitops.h>
...@@ -1257,22 +1257,22 @@ static int __init zatm_init(struct atm_dev *dev) ...@@ -1257,22 +1257,22 @@ static int __init zatm_init(struct atm_dev *dev)
static int __init zatm_start(struct atm_dev *dev) static int __init zatm_start(struct atm_dev *dev)
{ {
struct zatm_dev *zatm_dev; struct zatm_dev *zatm_dev = ZATM_DEV(dev);
struct pci_dev *pdev = zatm_dev->pci_dev;
unsigned long curr; unsigned long curr;
int pools,vccs,rx; int pools,vccs,rx;
int error,i,ld; int error, i, ld;
DPRINTK("zatm_start\n"); DPRINTK("zatm_start\n");
zatm_dev = ZATM_DEV(dev);
zatm_dev->rx_map = zatm_dev->tx_map = NULL; zatm_dev->rx_map = zatm_dev->tx_map = NULL;
for (i = 0; i < NR_MBX; i++) for (i = 0; i < NR_MBX; i++)
zatm_dev->mbx_start[i] = 0; zatm_dev->mbx_start[i] = 0;
if (request_irq(zatm_dev->irq,&zatm_int,SA_SHIRQ,DEV_LABEL,dev)) { error = request_irq(zatm_dev->irq, zatm_int, SA_SHIRQ, DEV_LABEL, dev);
printk(KERN_ERR DEV_LABEL "(itf %d): IRQ%d is already in use\n", if (error < 0) {
dev->number,zatm_dev->irq); printk(KERN_ERR DEV_LABEL "(itf %d): IRQ%d is already in use\n",
return -EAGAIN; dev->number,zatm_dev->irq);
goto done;
} }
request_region(zatm_dev->base,uPD98401_PORTS,DEV_LABEL);
/* define memory regions */ /* define memory regions */
pools = NR_POOLS; pools = NR_POOLS;
if (NR_SHAPERS*SHAPER_SIZE > pools*POOL_SIZE) if (NR_SHAPERS*SHAPER_SIZE > pools*POOL_SIZE)
...@@ -1299,51 +1299,66 @@ static int __init zatm_start(struct atm_dev *dev) ...@@ -1299,51 +1299,66 @@ static int __init zatm_start(struct atm_dev *dev)
"%ld VCs\n",dev->number,NR_SHAPERS,pools,rx, "%ld VCs\n",dev->number,NR_SHAPERS,pools,rx,
(zatm_dev->mem-curr*4)/VC_SIZE); (zatm_dev->mem-curr*4)/VC_SIZE);
/* create mailboxes */ /* create mailboxes */
for (i = 0; i < NR_MBX; i++) for (i = 0; i < NR_MBX; i++) {
if (mbx_entries[i]) { void *mbx;
unsigned long here; dma_addr_t mbx_dma;
here = (unsigned long) kmalloc(2*MBX_SIZE(i), if (!mbx_entries[i])
GFP_KERNEL); continue;
if (!here) { mbx = pci_alloc_consistent(pdev, 2*MBX_SIZE(i), &mbx_dma);
error = -ENOMEM; if (!mbx) {
goto out; error = -ENOMEM;
} goto out;
if ((here^(here+MBX_SIZE(i))) & ~0xffffUL)/* paranoia */
here = (here & ~0xffffUL)+0x10000;
zatm_dev->mbx_start[i] = here;
if ((here^virt_to_bus((void *) here)) & 0xffff) {
printk(KERN_ERR DEV_LABEL "(itf %d): system "
"bus incompatible with driver\n",
dev->number);
error = -ENODEV;
goto out;
}
DPRINTK("mbx@0x%08lx-0x%08lx\n",here,here+MBX_SIZE(i));
zatm_dev->mbx_end[i] = (here+MBX_SIZE(i)) & 0xffff;
zout(virt_to_bus((void *) here) >> 16,MSH(i));
zout(virt_to_bus((void *) here),MSL(i));
zout((here+MBX_SIZE(i)) & 0xffff,MBA(i));
zout(here & 0xffff,MTA(i));
zout(here & 0xffff,MWA(i));
} }
/*
* Alignment provided by pci_alloc_consistent() isn't enough
* for this device.
*/
if (((unsigned long)mbx ^ mbx_dma) & 0xffff) {
printk(KERN_ERR DEV_LABEL "(itf %d): system "
"bus incompatible with driver\n", dev->number);
pci_free_consistent(pdev, 2*MBX_SIZE(i), mbx, mbx_dma);
error = -ENODEV;
goto out;
}
DPRINTK("mbx@0x%08lx-0x%08lx\n", mbx, mbx + MBX_SIZE(i));
zatm_dev->mbx_start[i] = (unsigned long)mbx;
zatm_dev->mbx_dma[i] = mbx_dma;
zatm_dev->mbx_end[i] = (zatm_dev->mbx_start[i] + MBX_SIZE(i)) &
0xffff;
zout(mbx_dma >> 16, MSH(i));
zout(mbx_dma, MSL(i));
zout(zatm_dev->mbx_end[i], MBA(i));
zout((unsigned long)mbx & 0xffff, MTA(i));
zout((unsigned long)mbx & 0xffff, MWA(i));
}
error = start_tx(dev); error = start_tx(dev);
if (error) goto out; if (error)
goto out;
error = start_rx(dev); error = start_rx(dev);
if (error) goto out; if (error)
goto out_tx;
error = dev->phy->start(dev); error = dev->phy->start(dev);
if (error) goto out; if (error)
goto out_rx;
zout(0xffffffff,IMR); /* enable interrupts */ zout(0xffffffff,IMR); /* enable interrupts */
/* enable TX & RX */ /* enable TX & RX */
zout(zin(GMR) | uPD98401_GMR_SE | uPD98401_GMR_RE,GMR); zout(zin(GMR) | uPD98401_GMR_SE | uPD98401_GMR_RE,GMR);
return 0; done:
out: return error;
for (i = 0; i < NR_MBX; i++)
kfree(zatm_dev->mbx_start[i]); out_rx:
kfree(zatm_dev->rx_map); kfree(zatm_dev->rx_map);
out_tx:
kfree(zatm_dev->tx_map); kfree(zatm_dev->tx_map);
out:
while (i-- > 0) {
pci_free_consistent(pdev, 2*MBX_SIZE(i),
(void *)zatm_dev->mbx_start[i],
zatm_dev->mbx_dma[i]);
}
free_irq(zatm_dev->irq, dev); free_irq(zatm_dev->irq, dev);
return error; goto done;
} }
......
...@@ -73,6 +73,7 @@ struct zatm_dev { ...@@ -73,6 +73,7 @@ struct zatm_dev {
int chans; /* map size, must be 2^n */ int chans; /* map size, must be 2^n */
/*-------------------------------- mailboxes */ /*-------------------------------- mailboxes */
unsigned long mbx_start[NR_MBX];/* start addresses */ unsigned long mbx_start[NR_MBX];/* start addresses */
dma_addr_t mbx_dma[NR_MBX];
u16 mbx_end[NR_MBX]; /* end offset (in bytes) */ u16 mbx_end[NR_MBX]; /* end offset (in bytes) */
/*-------------------------------- other pointers */ /*-------------------------------- other pointers */
u32 pool_base; /* Free buffer pool dsc (word addr) */ u32 pool_base; /* Free buffer pool dsc (word addr) */
......
...@@ -2544,9 +2544,25 @@ config SHAPER ...@@ -2544,9 +2544,25 @@ config SHAPER
config NETCONSOLE config NETCONSOLE
tristate "Network console logging support (EXPERIMENTAL)" tristate "Network console logging support (EXPERIMENTAL)"
depends on NETDEVICES && EXPERIMENTAL depends on NETDEVICES && INET && EXPERIMENTAL
---help--- ---help---
If you want to log kernel messages over the network, enable this. If you want to log kernel messages over the network, enable this.
See <file:Documentation/networking/netconsole.txt> for details. See <file:Documentation/networking/netconsole.txt> for details.
config NETPOLL
def_bool NETCONSOLE
config NETPOLL_RX
bool "Netpoll support for trapping incoming packets"
default n
depends on NETPOLL
config NETPOLL_TRAP
bool "Netpoll traffic trapping"
default n
depends on NETPOLL
config NET_POLL_CONTROLLER
def_bool NETPOLL
endmenu endmenu
...@@ -132,7 +132,7 @@ static struct net_device_stats *eql_get_stats(struct net_device *dev); ...@@ -132,7 +132,7 @@ static struct net_device_stats *eql_get_stats(struct net_device *dev);
#define eql_is_slave(dev) ((dev->flags & IFF_SLAVE) == IFF_SLAVE) #define eql_is_slave(dev) ((dev->flags & IFF_SLAVE) == IFF_SLAVE)
#define eql_is_master(dev) ((dev->flags & IFF_MASTER) == IFF_MASTER) #define eql_is_master(dev) ((dev->flags & IFF_MASTER) == IFF_MASTER)
static void eql_kill_one_slave(slave_t *slave); static void eql_kill_one_slave(slave_queue_t *queue, slave_t *slave);
static void eql_timer(unsigned long param) static void eql_timer(unsigned long param)
{ {
...@@ -149,7 +149,7 @@ static void eql_timer(unsigned long param) ...@@ -149,7 +149,7 @@ static void eql_timer(unsigned long param)
if (slave->bytes_queued < 0) if (slave->bytes_queued < 0)
slave->bytes_queued = 0; slave->bytes_queued = 0;
} else { } else {
eql_kill_one_slave(slave); eql_kill_one_slave(&eql->queue, slave);
} }
} }
...@@ -214,9 +214,10 @@ static int eql_open(struct net_device *dev) ...@@ -214,9 +214,10 @@ static int eql_open(struct net_device *dev)
return 0; return 0;
} }
static void eql_kill_one_slave(slave_t *slave) static void eql_kill_one_slave(slave_queue_t *queue, slave_t *slave)
{ {
list_del(&slave->list); list_del(&slave->list);
queue->num_slaves--;
slave->dev->flags &= ~IFF_SLAVE; slave->dev->flags &= ~IFF_SLAVE;
dev_put(slave->dev); dev_put(slave->dev);
kfree(slave); kfree(slave);
...@@ -232,8 +233,7 @@ static void eql_kill_slave_queue(slave_queue_t *queue) ...@@ -232,8 +233,7 @@ static void eql_kill_slave_queue(slave_queue_t *queue)
list_for_each_safe(this, tmp, head) { list_for_each_safe(this, tmp, head) {
slave_t *s = list_entry(this, slave_t, list); slave_t *s = list_entry(this, slave_t, list);
eql_kill_one_slave(s); eql_kill_one_slave(queue, s);
queue->num_slaves--;
} }
spin_unlock_bh(&queue->lock); spin_unlock_bh(&queue->lock);
...@@ -318,7 +318,7 @@ static slave_t *__eql_schedule_slaves(slave_queue_t *queue) ...@@ -318,7 +318,7 @@ static slave_t *__eql_schedule_slaves(slave_queue_t *queue)
} }
} else { } else {
/* We found a dead slave, kill it. */ /* We found a dead slave, kill it. */
eql_kill_one_slave(slave); eql_kill_one_slave(queue, slave);
} }
} }
return best_slave; return best_slave;
...@@ -393,7 +393,7 @@ static int __eql_insert_slave(slave_queue_t *queue, slave_t *slave) ...@@ -393,7 +393,7 @@ static int __eql_insert_slave(slave_queue_t *queue, slave_t *slave)
duplicate_slave = __eql_find_slave_dev(queue, slave->dev); duplicate_slave = __eql_find_slave_dev(queue, slave->dev);
if (duplicate_slave != 0) if (duplicate_slave != 0)
eql_kill_one_slave(duplicate_slave); eql_kill_one_slave(queue, duplicate_slave);
list_add(&slave->list, &queue->all_slaves); list_add(&slave->list, &queue->all_slaves);
queue->num_slaves++; queue->num_slaves++;
...@@ -471,7 +471,7 @@ static int eql_emancipate(struct net_device *master_dev, slaving_request_t __use ...@@ -471,7 +471,7 @@ static int eql_emancipate(struct net_device *master_dev, slaving_request_t __use
slave_dev); slave_dev);
if (slave) { if (slave) {
eql_kill_one_slave(slave); eql_kill_one_slave(&eql->queue, slave);
ret = 0; ret = 0;
} }
} }
......
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
#include <linux/ioport.h> #include <linux/ioport.h>
#include <linux/ethtool.h> #include <linux/ethtool.h>
#include <linux/mii.h> #include <linux/mii.h>
#include <linux/jiffies.h>
#include <pcmcia/cs_types.h> #include <pcmcia/cs_types.h>
#include <pcmcia/cs.h> #include <pcmcia/cs.h>
...@@ -2092,7 +2093,7 @@ static void media_check(u_long arg) ...@@ -2092,7 +2093,7 @@ static void media_check(u_long arg)
} }
/* Ignore collisions unless we've had no rx's recently */ /* Ignore collisions unless we've had no rx's recently */
if (jiffies - dev->last_rx > HZ) { if (time_after(jiffies, dev->last_rx + HZ)) {
if (smc->tx_err || (smc->media_status & EPH_16COL)) if (smc->tx_err || (smc->media_status & EPH_16COL))
media |= EPH_16COL; media |= EPH_16COL;
} }
......
...@@ -152,6 +152,7 @@ ...@@ -152,6 +152,7 @@
#include <asm/io.h> /* for inb(), outb(), etc. */ #include <asm/io.h> /* for inb(), outb(), etc. */
#include <linux/time.h> /* for do_gettimeofday */ #include <linux/time.h> /* for do_gettimeofday */
#include <linux/in.h> /* sockaddr_in */ #include <linux/in.h> /* sockaddr_in */
#include <linux/jiffies.h> /* time_after() macro */
#include <asm/errno.h> #include <asm/errno.h>
#include <linux/ip.h> #include <linux/ip.h>
...@@ -773,7 +774,7 @@ static int update(struct wan_device* wandev) ...@@ -773,7 +774,7 @@ static int update(struct wan_device* wandev)
for(;;) { for(;;) {
if(card->u.f.update_comms_stats == 0) if(card->u.f.update_comms_stats == 0)
break; break;
if ((jiffies - timeout) > (1 * HZ)){ if (time_after(jiffies, timeout + 1 * HZ)){
card->u.f.update_comms_stats = 0; card->u.f.update_comms_stats = 0;
return -EAGAIN; return -EAGAIN;
} }
...@@ -4799,7 +4800,7 @@ static void trigger_unconfig_fr(struct net_device *dev) ...@@ -4799,7 +4800,7 @@ static void trigger_unconfig_fr(struct net_device *dev)
{ {
fr_channel_t *chan = dev->priv; fr_channel_t *chan = dev->priv;
volatile sdla_t *card = chan->card; volatile sdla_t *card = chan->card;
u32 timeout; unsigned long timeout;
fr508_flags_t* flags = card->flags; fr508_flags_t* flags = card->flags;
int reset_critical=0; int reset_critical=0;
...@@ -4821,7 +4822,7 @@ static void trigger_unconfig_fr(struct net_device *dev) ...@@ -4821,7 +4822,7 @@ static void trigger_unconfig_fr(struct net_device *dev)
if(!(card->u.f.timer_int_enabled & TMR_INT_ENABLED_UNCONFIG)) if(!(card->u.f.timer_int_enabled & TMR_INT_ENABLED_UNCONFIG))
break; break;
if ((jiffies - timeout) > (1 * HZ)){ if (time_after(jiffies, timeout + 1 * HZ)){
card->u.f.timer_int_enabled &= ~TMR_INT_ENABLED_UNCONFIG; card->u.f.timer_int_enabled &= ~TMR_INT_ENABLED_UNCONFIG;
printk(KERN_INFO "%s: Failed to delete DLCI %i\n", printk(KERN_INFO "%s: Failed to delete DLCI %i\n",
card->devname,chan->dlci); card->devname,chan->dlci);
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include <linux/wanrouter.h> /* WAN router definitions */ #include <linux/wanrouter.h> /* WAN router definitions */
#include <linux/wanpipe.h> /* WANPIPE common user API definitions */ #include <linux/wanpipe.h> /* WANPIPE common user API definitions */
#include <linux/if_arp.h> /* ARPHRD_* defines */ #include <linux/if_arp.h> /* ARPHRD_* defines */
#include <linux/jiffies.h> /* time_after() macro */
#include <linux/inetdevice.h> #include <linux/inetdevice.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
...@@ -164,7 +165,7 @@ int wpft1_init (sdla_t* card, wandev_conf_t* conf) ...@@ -164,7 +165,7 @@ int wpft1_init (sdla_t* card, wandev_conf_t* conf)
timeout = jiffies; timeout = jiffies;
while (mb->return_code != 'I') /* Wait 1s for board to initialize */ while (mb->return_code != 'I') /* Wait 1s for board to initialize */
if ((jiffies - timeout) > 1*HZ) break; if (time_after(jiffies, timeout + 1*HZ)) break;
if (mb->return_code != 'I') { if (mb->return_code != 'I') {
printk(KERN_INFO printk(KERN_INFO
......
...@@ -101,6 +101,7 @@ ...@@ -101,6 +101,7 @@
#include <linux/if_arp.h> /* ARPHRD_* defines */ #include <linux/if_arp.h> /* ARPHRD_* defines */
#include <asm/byteorder.h> /* htons(), etc. */ #include <asm/byteorder.h> /* htons(), etc. */
#include <linux/in.h> /* sockaddr_in */ #include <linux/in.h> /* sockaddr_in */
#include <linux/jiffies.h> /* time_after() macro */
#include <asm/uaccess.h> #include <asm/uaccess.h>
...@@ -482,7 +483,7 @@ static int update(struct wan_device *wandev) ...@@ -482,7 +483,7 @@ static int update(struct wan_device *wandev)
if(ppp_priv_area->update_comms_stats == 0){ if(ppp_priv_area->update_comms_stats == 0){
break; break;
} }
if ((jiffies - timeout) > (1 * HZ)){ if (time_after(jiffies, timeout + 1 * HZ)){
ppp_priv_area->update_comms_stats = 0; ppp_priv_area->update_comms_stats = 0;
ppp_priv_area->timer_int_enabled &= ppp_priv_area->timer_int_enabled &=
~TMR_INT_ENABLED_UPDATE; ~TMR_INT_ENABLED_UPDATE;
......
...@@ -91,6 +91,7 @@ ...@@ -91,6 +91,7 @@
#include <linux/wanrouter.h> /* WAN router definitions */ #include <linux/wanrouter.h> /* WAN router definitions */
#include <linux/wanpipe.h> /* WANPIPE common user API definitions */ #include <linux/wanpipe.h> /* WANPIPE common user API definitions */
#include <linux/workqueue.h> #include <linux/workqueue.h>
#include <linux/jiffies.h> /* time_after() macro */
#include <asm/byteorder.h> /* htons(), etc. */ #include <asm/byteorder.h> /* htons(), etc. */
#include <asm/atomic.h> #include <asm/atomic.h>
#include <linux/delay.h> /* Experimental delay */ #include <linux/delay.h> /* Experimental delay */
...@@ -867,7 +868,7 @@ static int update(struct wan_device* wandev) ...@@ -867,7 +868,7 @@ static int update(struct wan_device* wandev)
if (!(card->u.x.timer_int_enabled & TMR_INT_ENABLED_UPDATE)){ if (!(card->u.x.timer_int_enabled & TMR_INT_ENABLED_UPDATE)){
break; break;
} }
if ((jiffies-timeout) > 1*HZ){ if (time_after(jiffies, timeout + 1*HZ)){
card->u.x.timer_int_enabled &= ~TMR_INT_ENABLED_UPDATE; card->u.x.timer_int_enabled &= ~TMR_INT_ENABLED_UPDATE;
return -EAGAIN; return -EAGAIN;
} }
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include <linux/wanrouter.h> /* WAN router definitions */ #include <linux/wanrouter.h> /* WAN router definitions */
#include <linux/wanpipe.h> /* WANPIPE common user API definitions */ #include <linux/wanpipe.h> /* WANPIPE common user API definitions */
#include <linux/if_arp.h> /* ARPHRD_* defines */ #include <linux/if_arp.h> /* ARPHRD_* defines */
#include <linux/jiffies.h> /* time_after() macro */
#include <linux/in.h> /* sockaddr_in */ #include <linux/in.h> /* sockaddr_in */
#include <linux/inet.h> #include <linux/inet.h>
...@@ -270,9 +271,9 @@ int wsppp_init (sdla_t* card, wandev_conf_t* conf) ...@@ -270,9 +271,9 @@ int wsppp_init (sdla_t* card, wandev_conf_t* conf)
ready to accept commands. We expect this to be completed in less ready to accept commands. We expect this to be completed in less
than 1 second. */ than 1 second. */
timeout = jiffies; timeout = jiffies + 1 * HZ;
while (mb->return_code != 'I') /* Wait 1s for board to initialize */ while (mb->return_code != 'I') /* Wait 1s for board to initialize */
if ((jiffies - timeout) > 1*HZ) break; if (time_after(jiffies, timeout)) break;
if (mb->return_code != 'I') { if (mb->return_code != 'I') {
printk(KERN_INFO printk(KERN_INFO
...@@ -493,11 +494,11 @@ static int update(struct wan_device* wandev) ...@@ -493,11 +494,11 @@ static int update(struct wan_device* wandev)
chdlc_priv_area->timer_int_enabled = TMR_INT_ENABLED_UPDATE; chdlc_priv_area->timer_int_enabled = TMR_INT_ENABLED_UPDATE;
/* wait a maximum of 1 second for the statistics to be updated */ /* wait a maximum of 1 second for the statistics to be updated */
timeout = jiffies; timeout = jiffies + 1 * HZ;
for(;;) { for(;;) {
if(chdlc_priv_area->update_comms_stats == 0) if(chdlc_priv_area->update_comms_stats == 0)
break; break;
if ((jiffies - timeout) > (1 * HZ)){ if (time_after(jiffies, timeout)){
chdlc_priv_area->update_comms_stats = 0; chdlc_priv_area->update_comms_stats = 0;
chdlc_priv_area->timer_int_enabled &= chdlc_priv_area->timer_int_enabled &=
~TMR_INT_ENABLED_UPDATE; ~TMR_INT_ENABLED_UPDATE;
......
...@@ -448,19 +448,19 @@ static void speedtch_check_status(struct speedtch_instance_data *instance) ...@@ -448,19 +448,19 @@ static void speedtch_check_status(struct speedtch_instance_data *instance)
case 0: case 0:
atm_dev->signal = ATM_PHY_SIG_LOST; atm_dev->signal = ATM_PHY_SIG_LOST;
if (instance->last_status) if (instance->last_status)
atm_info(usbatm, "ADSL line is down\n"); atm_info(usbatm, "%s\n", "ADSL line is down");
/* It may never resync again unless we ask it to... */ /* It may never resync again unless we ask it to... */
ret = speedtch_start_synchro(instance); ret = speedtch_start_synchro(instance);
break; break;
case 0x08: case 0x08:
atm_dev->signal = ATM_PHY_SIG_UNKNOWN; atm_dev->signal = ATM_PHY_SIG_UNKNOWN;
atm_info(usbatm, "ADSL line is blocked?\n"); atm_info(usbatm, "%s\n", "ADSL line is blocked?");
break; break;
case 0x10: case 0x10:
atm_dev->signal = ATM_PHY_SIG_LOST; atm_dev->signal = ATM_PHY_SIG_LOST;
atm_info(usbatm, "ADSL line is synchronising\n"); atm_info(usbatm, "%s\n", "ADSL line is synchronising");
break; break;
case 0x20: case 0x20:
...@@ -502,7 +502,7 @@ static void speedtch_status_poll(unsigned long data) ...@@ -502,7 +502,7 @@ static void speedtch_status_poll(unsigned long data)
if (instance->poll_delay < MAX_POLL_DELAY) if (instance->poll_delay < MAX_POLL_DELAY)
mod_timer(&instance->status_checker.timer, jiffies + msecs_to_jiffies(instance->poll_delay)); mod_timer(&instance->status_checker.timer, jiffies + msecs_to_jiffies(instance->poll_delay));
else else
atm_warn(instance->usbatm, "Too many failures - disabling line status polling\n"); atm_warn(instance->usbatm, "%s\n", "Too many failures - disabling line status polling");
} }
static void speedtch_resubmit_int(unsigned long data) static void speedtch_resubmit_int(unsigned long data)
...@@ -545,9 +545,9 @@ static void speedtch_handle_int(struct urb *int_urb, struct pt_regs *regs) ...@@ -545,9 +545,9 @@ static void speedtch_handle_int(struct urb *int_urb, struct pt_regs *regs)
if ((count == 6) && !memcmp(up_int, instance->int_data, 6)) { if ((count == 6) && !memcmp(up_int, instance->int_data, 6)) {
del_timer(&instance->status_checker.timer); del_timer(&instance->status_checker.timer);
atm_info(usbatm, "DSL line goes up\n"); atm_info(usbatm, "%s\n", "DSL line goes up");
} else if ((count == 6) && !memcmp(down_int, instance->int_data, 6)) { } else if ((count == 6) && !memcmp(down_int, instance->int_data, 6)) {
atm_info(usbatm, "DSL line goes down\n"); atm_info(usbatm, "%s\n", "DSL line goes down");
} else { } else {
int i; int i;
......
...@@ -197,6 +197,9 @@ struct ip_conntrack_expect ...@@ -197,6 +197,9 @@ struct ip_conntrack_expect
/* Timer function; deletes the expectation. */ /* Timer function; deletes the expectation. */
struct timer_list timeout; struct timer_list timeout;
/* Usage count. */
atomic_t use;
#ifdef CONFIG_IP_NF_NAT_NEEDED #ifdef CONFIG_IP_NF_NAT_NEEDED
/* This is the original per-proto part, used to map the /* This is the original per-proto part, used to map the
* expected connection the way the recipient expects. */ * expected connection the way the recipient expects. */
......
...@@ -30,9 +30,10 @@ extern int ip_conntrack_helper_register(struct ip_conntrack_helper *); ...@@ -30,9 +30,10 @@ extern int ip_conntrack_helper_register(struct ip_conntrack_helper *);
extern void ip_conntrack_helper_unregister(struct ip_conntrack_helper *); extern void ip_conntrack_helper_unregister(struct ip_conntrack_helper *);
/* Allocate space for an expectation: this is mandatory before calling /* Allocate space for an expectation: this is mandatory before calling
ip_conntrack_expect_related. */ ip_conntrack_expect_related. You will have to call put afterwards. */
extern struct ip_conntrack_expect *ip_conntrack_expect_alloc(void); extern struct ip_conntrack_expect *
extern void ip_conntrack_expect_free(struct ip_conntrack_expect *exp); ip_conntrack_expect_alloc(struct ip_conntrack *master);
extern void ip_conntrack_expect_put(struct ip_conntrack_expect *exp);
/* Add an expected connection: can have more than one per connection */ /* Add an expected connection: can have more than one per connection */
extern int ip_conntrack_expect_related(struct ip_conntrack_expect *exp); extern int ip_conntrack_expect_related(struct ip_conntrack_expect *exp);
......
...@@ -502,7 +502,8 @@ static inline struct sk_buff *skb_share_check(struct sk_buff *skb, ...@@ -502,7 +502,8 @@ static inline struct sk_buff *skb_share_check(struct sk_buff *skb,
* *
* %NULL is returned on a memory allocation failure. * %NULL is returned on a memory allocation failure.
*/ */
static inline struct sk_buff *skb_unshare(struct sk_buff *skb, int pri) static inline struct sk_buff *skb_unshare(struct sk_buff *skb,
unsigned int __nocast pri)
{ {
might_sleep_if(pri & __GFP_WAIT); might_sleep_if(pri & __GFP_WAIT);
if (skb_cloned(skb)) { if (skb_cloned(skb)) {
......
...@@ -41,19 +41,14 @@ enum ...@@ -41,19 +41,14 @@ enum
TCF_META_ID_LOADAVG_1, TCF_META_ID_LOADAVG_1,
TCF_META_ID_LOADAVG_2, TCF_META_ID_LOADAVG_2,
TCF_META_ID_DEV, TCF_META_ID_DEV,
TCF_META_ID_INDEV,
TCF_META_ID_REALDEV,
TCF_META_ID_PRIORITY, TCF_META_ID_PRIORITY,
TCF_META_ID_PROTOCOL, TCF_META_ID_PROTOCOL,
TCF_META_ID_SECURITY, /* obsolete */
TCF_META_ID_PKTTYPE, TCF_META_ID_PKTTYPE,
TCF_META_ID_PKTLEN, TCF_META_ID_PKTLEN,
TCF_META_ID_DATALEN, TCF_META_ID_DATALEN,
TCF_META_ID_MACLEN, TCF_META_ID_MACLEN,
TCF_META_ID_NFMARK, TCF_META_ID_NFMARK,
TCF_META_ID_TCINDEX, TCF_META_ID_TCINDEX,
TCF_META_ID_TCVERDICT,
TCF_META_ID_TCCLASSID,
TCF_META_ID_RTCLASSID, TCF_META_ID_RTCLASSID,
TCF_META_ID_RTIIF, TCF_META_ID_RTIIF,
TCF_META_ID_SK_FAMILY, TCF_META_ID_SK_FAMILY,
......
...@@ -167,15 +167,12 @@ void sctp_unhash_established(struct sctp_association *); ...@@ -167,15 +167,12 @@ void sctp_unhash_established(struct sctp_association *);
void sctp_hash_endpoint(struct sctp_endpoint *); void sctp_hash_endpoint(struct sctp_endpoint *);
void sctp_unhash_endpoint(struct sctp_endpoint *); void sctp_unhash_endpoint(struct sctp_endpoint *);
struct sock *sctp_err_lookup(int family, struct sk_buff *, struct sock *sctp_err_lookup(int family, struct sk_buff *,
struct sctphdr *, struct sctp_endpoint **, struct sctphdr *, struct sctp_association **,
struct sctp_association **,
struct sctp_transport **); struct sctp_transport **);
void sctp_err_finish(struct sock *, struct sctp_endpoint *, void sctp_err_finish(struct sock *, struct sctp_association *);
struct sctp_association *);
void sctp_icmp_frag_needed(struct sock *, struct sctp_association *, void sctp_icmp_frag_needed(struct sock *, struct sctp_association *,
struct sctp_transport *t, __u32 pmtu); struct sctp_transport *t, __u32 pmtu);
void sctp_icmp_proto_unreachable(struct sock *sk, void sctp_icmp_proto_unreachable(struct sock *sk,
struct sctp_endpoint *ep,
struct sctp_association *asoc, struct sctp_association *asoc,
struct sctp_transport *t); struct sctp_transport *t);
......
...@@ -803,7 +803,7 @@ struct xfrm_algo_desc { ...@@ -803,7 +803,7 @@ struct xfrm_algo_desc {
/* XFRM tunnel handlers. */ /* XFRM tunnel handlers. */
struct xfrm_tunnel { struct xfrm_tunnel {
int (*handler)(struct sk_buff *skb); int (*handler)(struct sk_buff *skb);
void (*err_handler)(struct sk_buff *skb, void *info); void (*err_handler)(struct sk_buff *skb, __u32 info);
}; };
struct xfrm6_tunnel { struct xfrm6_tunnel {
......
...@@ -209,22 +209,6 @@ endmenu ...@@ -209,22 +209,6 @@ endmenu
endmenu endmenu
config NETPOLL
def_bool NETCONSOLE
config NETPOLL_RX
bool "Netpoll support for trapping incoming packets"
default n
depends on NETPOLL
config NETPOLL_TRAP
bool "Netpoll traffic trapping"
default n
depends on NETPOLL
config NET_POLL_CONTROLLER
def_bool NETPOLL
source "net/ax25/Kconfig" source "net/ax25/Kconfig"
source "net/irda/Kconfig" source "net/irda/Kconfig"
source "net/bluetooth/Kconfig" source "net/bluetooth/Kconfig"
......
...@@ -60,7 +60,7 @@ config ATM_BR2684 ...@@ -60,7 +60,7 @@ config ATM_BR2684
tristate "RFC1483/2684 Bridged protocols" tristate "RFC1483/2684 Bridged protocols"
depends on ATM && INET depends on ATM && INET
help help
ATM PVCs can carry ethernet PDUs according to rfc2684 (formerly 1483) ATM PVCs can carry ethernet PDUs according to RFC2684 (formerly 1483)
This device will act like an ethernet from the kernels point of view, This device will act like an ethernet from the kernels point of view,
with the traffic being carried by ATM PVCs (currently 1 PVC/device). with the traffic being carried by ATM PVCs (currently 1 PVC/device).
This is sometimes used over DSL lines. If in doubt, say N. This is sometimes used over DSL lines. If in doubt, say N.
...@@ -69,6 +69,6 @@ config ATM_BR2684_IPFILTER ...@@ -69,6 +69,6 @@ config ATM_BR2684_IPFILTER
bool "Per-VC IP filter kludge" bool "Per-VC IP filter kludge"
depends on ATM_BR2684 depends on ATM_BR2684
help help
This is an experimental mechanism for users who need to terminating a This is an experimental mechanism for users who need to terminate a
large number of IP-only vcc's. Do not enable this unless you are sure large number of IP-only vcc's. Do not enable this unless you are sure
you know what you are doing. you know what you are doing.
...@@ -118,10 +118,6 @@ static int svc_bind(struct socket *sock,struct sockaddr *sockaddr, ...@@ -118,10 +118,6 @@ static int svc_bind(struct socket *sock,struct sockaddr *sockaddr,
goto out; goto out;
} }
vcc = ATM_SD(sock); vcc = ATM_SD(sock);
if (test_bit(ATM_VF_SESSION, &vcc->flags)) {
error = -EINVAL;
goto out;
}
addr = (struct sockaddr_atmsvc *) sockaddr; addr = (struct sockaddr_atmsvc *) sockaddr;
if (addr->sas_family != AF_ATMSVC) { if (addr->sas_family != AF_ATMSVC) {
error = -EAFNOSUPPORT; error = -EAFNOSUPPORT;
......
...@@ -138,7 +138,7 @@ config BRIDGE_EBT_VLAN ...@@ -138,7 +138,7 @@ config BRIDGE_EBT_VLAN
# #
config BRIDGE_EBT_ARPREPLY config BRIDGE_EBT_ARPREPLY
tristate "ebt: arp reply target support" tristate "ebt: arp reply target support"
depends on BRIDGE_NF_EBTABLES depends on BRIDGE_NF_EBTABLES && INET
help help
This option adds the arp reply target, which allows This option adds the arp reply target, which allows
automatically sending arp replies to arp requests. automatically sending arp replies to arp requests.
......
...@@ -7,9 +7,10 @@ obj-y := sock.o request_sock.o skbuff.o iovec.o datagram.o stream.o scm.o \ ...@@ -7,9 +7,10 @@ obj-y := sock.o request_sock.o skbuff.o iovec.o datagram.o stream.o scm.o \
obj-$(CONFIG_SYSCTL) += sysctl_net_core.o obj-$(CONFIG_SYSCTL) += sysctl_net_core.o
obj-y += flow.o dev.o ethtool.o dev_mcast.o dst.o \ obj-y += dev.o ethtool.o dev_mcast.o dst.o \
neighbour.o rtnetlink.o utils.o link_watch.o filter.o neighbour.o rtnetlink.o utils.o link_watch.o filter.o
obj-$(CONFIG_XFRM) += flow.o
obj-$(CONFIG_SYSFS) += net-sysfs.o obj-$(CONFIG_SYSFS) += net-sysfs.o
obj-$(CONFIG_NETFILTER) += netfilter.o obj-$(CONFIG_NETFILTER) += netfilter.o
obj-$(CONFIG_NET_DIVERT) += dv.o obj-$(CONFIG_NET_DIVERT) += dv.o
......
...@@ -377,8 +377,8 @@ struct sk_buff *skb_clone(struct sk_buff *skb, unsigned int __nocast gfp_mask) ...@@ -377,8 +377,8 @@ struct sk_buff *skb_clone(struct sk_buff *skb, unsigned int __nocast gfp_mask)
C(tc_index); C(tc_index);
#ifdef CONFIG_NET_CLS_ACT #ifdef CONFIG_NET_CLS_ACT
n->tc_verd = SET_TC_VERD(skb->tc_verd,0); n->tc_verd = SET_TC_VERD(skb->tc_verd,0);
n->tc_verd = CLR_TC_OK2MUNGE(skb->tc_verd); n->tc_verd = CLR_TC_OK2MUNGE(n->tc_verd);
n->tc_verd = CLR_TC_MUNGED(skb->tc_verd); n->tc_verd = CLR_TC_MUNGED(n->tc_verd);
C(input_dev); C(input_dev);
C(tc_classid); C(tc_classid);
#endif #endif
......
...@@ -54,9 +54,9 @@ config IP_ADVANCED_ROUTER ...@@ -54,9 +54,9 @@ config IP_ADVANCED_ROUTER
choice choice
prompt "Choose IP: FIB lookup algorithm (choose FIB_HASH if unsure)" prompt "Choose IP: FIB lookup algorithm (choose FIB_HASH if unsure)"
depends on IP_ADVANCED_ROUTER depends on IP_ADVANCED_ROUTER
default IP_FIB_HASH default ASK_IP_FIB_HASH
config IP_FIB_HASH config ASK_IP_FIB_HASH
bool "FIB_HASH" bool "FIB_HASH"
---help--- ---help---
Current FIB is very proven and good enough for most users. Current FIB is very proven and good enough for most users.
...@@ -82,12 +82,8 @@ config IP_FIB_TRIE ...@@ -82,12 +82,8 @@ config IP_FIB_TRIE
endchoice endchoice
# If the user does not enable advanced routing, he gets the safe
# default of the fib-hash algorithm.
config IP_FIB_HASH config IP_FIB_HASH
bool def_bool ASK_IP_FIB_HASH || !IP_ADVANCED_ROUTER
depends on !IP_ADVANCED_ROUTER
default y
config IP_MULTIPLE_TABLES config IP_MULTIPLE_TABLES
bool "IP: policy routing" bool "IP: policy routing"
...@@ -239,7 +235,6 @@ config IP_PNP_RARP ...@@ -239,7 +235,6 @@ config IP_PNP_RARP
# bool ' IP: ARP support' CONFIG_IP_PNP_ARP # bool ' IP: ARP support' CONFIG_IP_PNP_ARP
config NET_IPIP config NET_IPIP
tristate "IP: tunneling" tristate "IP: tunneling"
select INET_TUNNEL
---help--- ---help---
Tunneling means encapsulating data of one protocol type within Tunneling means encapsulating data of one protocol type within
another protocol and sending it over a channel that understands the another protocol and sending it over a channel that understands the
...@@ -256,7 +251,6 @@ config NET_IPIP ...@@ -256,7 +251,6 @@ config NET_IPIP
config NET_IPGRE config NET_IPGRE
tristate "IP: GRE tunnels over IP" tristate "IP: GRE tunnels over IP"
select XFRM
help help
Tunneling means encapsulating data of one protocol type within Tunneling means encapsulating data of one protocol type within
another protocol and sending it over a channel that understands the another protocol and sending it over a channel that understands the
......
...@@ -1157,7 +1157,7 @@ static int __init ipv4_proc_init(void) ...@@ -1157,7 +1157,7 @@ static int __init ipv4_proc_init(void)
#ifdef CONFIG_IP_FIB_TRIE #ifdef CONFIG_IP_FIB_TRIE
if (fib_stat_proc_init()) if (fib_stat_proc_init())
goto out_fib_stat; goto out_fib_stat;
#endif #endif
if (ip_misc_proc_init()) if (ip_misc_proc_init())
goto out_misc; goto out_misc;
out: out:
......
此差异已折叠。
...@@ -273,7 +273,7 @@ static void ipip_tunnel_uninit(struct net_device *dev) ...@@ -273,7 +273,7 @@ static void ipip_tunnel_uninit(struct net_device *dev)
dev_put(dev); dev_put(dev);
} }
static void ipip_err(struct sk_buff *skb, void *__unused) static void ipip_err(struct sk_buff *skb, u32 info)
{ {
#ifndef I_WISH_WORLD_WERE_PERFECT #ifndef I_WISH_WORLD_WERE_PERFECT
...@@ -852,11 +852,39 @@ static int __init ipip_fb_tunnel_init(struct net_device *dev) ...@@ -852,11 +852,39 @@ static int __init ipip_fb_tunnel_init(struct net_device *dev)
return 0; return 0;
} }
#ifdef CONFIG_INET_TUNNEL
static struct xfrm_tunnel ipip_handler = { static struct xfrm_tunnel ipip_handler = {
.handler = ipip_rcv, .handler = ipip_rcv,
.err_handler = ipip_err, .err_handler = ipip_err,
}; };
static inline int ipip_register(void)
{
return xfrm4_tunnel_register(&ipip_handler);
}
static inline int ipip_unregister(void)
{
return xfrm4_tunnel_deregister(&ipip_handler);
}
#else
static struct net_protocol ipip_protocol = {
.handler = ipip_rcv,
.err_handler = ipip_err,
.no_policy = 1,
};
static inline int ipip_register(void)
{
return inet_add_protocol(&ipip_protocol, IPPROTO_IPIP);
}
static inline int ipip_unregister(void)
{
return inet_del_protocol(&ipip_protocol, IPPROTO_IPIP);
}
#endif
static char banner[] __initdata = static char banner[] __initdata =
KERN_INFO "IPv4 over IPv4 tunneling driver\n"; KERN_INFO "IPv4 over IPv4 tunneling driver\n";
...@@ -866,7 +894,7 @@ static int __init ipip_init(void) ...@@ -866,7 +894,7 @@ static int __init ipip_init(void)
printk(banner); printk(banner);
if (xfrm4_tunnel_register(&ipip_handler) < 0) { if (ipip_register() < 0) {
printk(KERN_INFO "ipip init: can't register tunnel\n"); printk(KERN_INFO "ipip init: can't register tunnel\n");
return -EAGAIN; return -EAGAIN;
} }
...@@ -888,13 +916,13 @@ static int __init ipip_init(void) ...@@ -888,13 +916,13 @@ static int __init ipip_init(void)
err2: err2:
free_netdev(ipip_fb_tunnel_dev); free_netdev(ipip_fb_tunnel_dev);
err1: err1:
xfrm4_tunnel_deregister(&ipip_handler); ipip_unregister();
goto out; goto out;
} }
static void __exit ipip_fini(void) static void __exit ipip_fini(void)
{ {
if (xfrm4_tunnel_deregister(&ipip_handler) < 0) if (ipip_unregister() < 0)
printk(KERN_INFO "ipip close: can't deregister tunnel\n"); printk(KERN_INFO "ipip close: can't deregister tunnel\n");
unregister_netdev(ipip_fb_tunnel_dev); unregister_netdev(ipip_fb_tunnel_dev);
......
...@@ -101,14 +101,13 @@ static int help(struct sk_buff **pskb, ...@@ -101,14 +101,13 @@ static int help(struct sk_buff **pskb,
if (port == 0 || len > 5) if (port == 0 || len > 5)
break; break;
exp = ip_conntrack_expect_alloc(); exp = ip_conntrack_expect_alloc(ct);
if (exp == NULL) { if (exp == NULL) {
ret = NF_DROP; ret = NF_DROP;
goto out; goto out;
} }
exp->expectfn = NULL; exp->expectfn = NULL;
exp->master = ct;
exp->tuple.src.ip = ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.ip; exp->tuple.src.ip = ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.ip;
exp->tuple.src.u.tcp.port = 0; exp->tuple.src.u.tcp.port = 0;
...@@ -126,10 +125,9 @@ static int help(struct sk_buff **pskb, ...@@ -126,10 +125,9 @@ static int help(struct sk_buff **pskb,
ret = ip_nat_amanda_hook(pskb, ctinfo, ret = ip_nat_amanda_hook(pskb, ctinfo,
tmp - amanda_buffer, tmp - amanda_buffer,
len, exp); len, exp);
else if (ip_conntrack_expect_related(exp) != 0) { else if (ip_conntrack_expect_related(exp) != 0)
ip_conntrack_expect_free(exp);
ret = NF_DROP; ret = NF_DROP;
} ip_conntrack_expect_put(exp);
} }
out: out:
......
...@@ -137,19 +137,12 @@ ip_ct_invert_tuple(struct ip_conntrack_tuple *inverse, ...@@ -137,19 +137,12 @@ ip_ct_invert_tuple(struct ip_conntrack_tuple *inverse,
/* ip_conntrack_expect helper functions */ /* ip_conntrack_expect helper functions */
static void destroy_expect(struct ip_conntrack_expect *exp)
{
ip_conntrack_put(exp->master);
IP_NF_ASSERT(!timer_pending(&exp->timeout));
kmem_cache_free(ip_conntrack_expect_cachep, exp);
CONNTRACK_STAT_INC(expect_delete);
}
static void unlink_expect(struct ip_conntrack_expect *exp) static void unlink_expect(struct ip_conntrack_expect *exp)
{ {
ASSERT_WRITE_LOCK(&ip_conntrack_lock); ASSERT_WRITE_LOCK(&ip_conntrack_lock);
IP_NF_ASSERT(!timer_pending(&exp->timeout));
list_del(&exp->list); list_del(&exp->list);
/* Logically in destroy_expect, but we hold the lock here. */ CONNTRACK_STAT_INC(expect_delete);
exp->master->expecting--; exp->master->expecting--;
} }
...@@ -160,7 +153,7 @@ static void expectation_timed_out(unsigned long ul_expect) ...@@ -160,7 +153,7 @@ static void expectation_timed_out(unsigned long ul_expect)
write_lock_bh(&ip_conntrack_lock); write_lock_bh(&ip_conntrack_lock);
unlink_expect(exp); unlink_expect(exp);
write_unlock_bh(&ip_conntrack_lock); write_unlock_bh(&ip_conntrack_lock);
destroy_expect(exp); ip_conntrack_expect_put(exp);
} }
/* If an expectation for this connection is found, it gets delete from /* If an expectation for this connection is found, it gets delete from
...@@ -198,7 +191,7 @@ static void remove_expectations(struct ip_conntrack *ct) ...@@ -198,7 +191,7 @@ static void remove_expectations(struct ip_conntrack *ct)
list_for_each_entry_safe(i, tmp, &ip_conntrack_expect_list, list) { list_for_each_entry_safe(i, tmp, &ip_conntrack_expect_list, list) {
if (i->master == ct && del_timer(&i->timeout)) { if (i->master == ct && del_timer(&i->timeout)) {
unlink_expect(i); unlink_expect(i);
destroy_expect(i); ip_conntrack_expect_put(i);
} }
} }
} }
...@@ -537,7 +530,7 @@ init_conntrack(const struct ip_conntrack_tuple *tuple, ...@@ -537,7 +530,7 @@ init_conntrack(const struct ip_conntrack_tuple *tuple,
if (exp) { if (exp) {
if (exp->expectfn) if (exp->expectfn)
exp->expectfn(conntrack, exp); exp->expectfn(conntrack, exp);
destroy_expect(exp); ip_conntrack_expect_put(exp);
} }
return &conntrack->tuplehash[IP_CT_DIR_ORIGINAL]; return &conntrack->tuplehash[IP_CT_DIR_ORIGINAL];
...@@ -729,14 +722,14 @@ void ip_conntrack_unexpect_related(struct ip_conntrack_expect *exp) ...@@ -729,14 +722,14 @@ void ip_conntrack_unexpect_related(struct ip_conntrack_expect *exp)
if (expect_matches(i, exp) && del_timer(&i->timeout)) { if (expect_matches(i, exp) && del_timer(&i->timeout)) {
unlink_expect(i); unlink_expect(i);
write_unlock_bh(&ip_conntrack_lock); write_unlock_bh(&ip_conntrack_lock);
destroy_expect(i); ip_conntrack_expect_put(i);
return; return;
} }
} }
write_unlock_bh(&ip_conntrack_lock); write_unlock_bh(&ip_conntrack_lock);
} }
struct ip_conntrack_expect *ip_conntrack_expect_alloc(void) struct ip_conntrack_expect *ip_conntrack_expect_alloc(struct ip_conntrack *me)
{ {
struct ip_conntrack_expect *new; struct ip_conntrack_expect *new;
...@@ -745,18 +738,23 @@ struct ip_conntrack_expect *ip_conntrack_expect_alloc(void) ...@@ -745,18 +738,23 @@ struct ip_conntrack_expect *ip_conntrack_expect_alloc(void)
DEBUGP("expect_related: OOM allocating expect\n"); DEBUGP("expect_related: OOM allocating expect\n");
return NULL; return NULL;
} }
new->master = NULL; new->master = me;
atomic_inc(&new->master->ct_general.use);
atomic_set(&new->use, 1);
return new; return new;
} }
void ip_conntrack_expect_free(struct ip_conntrack_expect *expect) void ip_conntrack_expect_put(struct ip_conntrack_expect *exp)
{ {
kmem_cache_free(ip_conntrack_expect_cachep, expect); if (atomic_dec_and_test(&exp->use)) {
ip_conntrack_put(exp->master);
kmem_cache_free(ip_conntrack_expect_cachep, exp);
}
} }
static void ip_conntrack_expect_insert(struct ip_conntrack_expect *exp) static void ip_conntrack_expect_insert(struct ip_conntrack_expect *exp)
{ {
atomic_inc(&exp->master->ct_general.use); atomic_inc(&exp->use);
exp->master->expecting++; exp->master->expecting++;
list_add(&exp->list, &ip_conntrack_expect_list); list_add(&exp->list, &ip_conntrack_expect_list);
...@@ -778,7 +776,7 @@ static void evict_oldest_expect(struct ip_conntrack *master) ...@@ -778,7 +776,7 @@ static void evict_oldest_expect(struct ip_conntrack *master)
if (i->master == master) { if (i->master == master) {
if (del_timer(&i->timeout)) { if (del_timer(&i->timeout)) {
unlink_expect(i); unlink_expect(i);
destroy_expect(i); ip_conntrack_expect_put(i);
} }
break; break;
} }
...@@ -810,8 +808,6 @@ int ip_conntrack_expect_related(struct ip_conntrack_expect *expect) ...@@ -810,8 +808,6 @@ int ip_conntrack_expect_related(struct ip_conntrack_expect *expect)
/* Refresh timer: if it's dying, ignore.. */ /* Refresh timer: if it's dying, ignore.. */
if (refresh_timer(i)) { if (refresh_timer(i)) {
ret = 0; ret = 0;
/* We don't need the one they've given us. */
ip_conntrack_expect_free(expect);
goto out; goto out;
} }
} else if (expect_clash(i, expect)) { } else if (expect_clash(i, expect)) {
...@@ -881,7 +877,7 @@ void ip_conntrack_helper_unregister(struct ip_conntrack_helper *me) ...@@ -881,7 +877,7 @@ void ip_conntrack_helper_unregister(struct ip_conntrack_helper *me)
list_for_each_entry_safe(exp, tmp, &ip_conntrack_expect_list, list) { list_for_each_entry_safe(exp, tmp, &ip_conntrack_expect_list, list) {
if (exp->master->helper == me && del_timer(&exp->timeout)) { if (exp->master->helper == me && del_timer(&exp->timeout)) {
unlink_expect(exp); unlink_expect(exp);
destroy_expect(exp); ip_conntrack_expect_put(exp);
} }
} }
/* Get rid of expecteds, set helpers to NULL. */ /* Get rid of expecteds, set helpers to NULL. */
...@@ -1111,6 +1107,9 @@ void ip_conntrack_cleanup(void) ...@@ -1111,6 +1107,9 @@ void ip_conntrack_cleanup(void)
schedule(); schedule();
goto i_see_dead_people; goto i_see_dead_people;
} }
/* wait until all references to ip_conntrack_untracked are dropped */
while (atomic_read(&ip_conntrack_untracked.ct_general.use) > 1)
schedule();
kmem_cache_destroy(ip_conntrack_cachep); kmem_cache_destroy(ip_conntrack_cachep);
kmem_cache_destroy(ip_conntrack_expect_cachep); kmem_cache_destroy(ip_conntrack_expect_cachep);
......
...@@ -376,7 +376,7 @@ static int help(struct sk_buff **pskb, ...@@ -376,7 +376,7 @@ static int help(struct sk_buff **pskb,
fb_ptr + matchoff, matchlen, ntohl(th->seq) + matchoff); fb_ptr + matchoff, matchlen, ntohl(th->seq) + matchoff);
/* Allocate expectation which will be inserted */ /* Allocate expectation which will be inserted */
exp = ip_conntrack_expect_alloc(); exp = ip_conntrack_expect_alloc(ct);
if (exp == NULL) { if (exp == NULL) {
ret = NF_DROP; ret = NF_DROP;
goto out; goto out;
...@@ -403,8 +403,7 @@ static int help(struct sk_buff **pskb, ...@@ -403,8 +403,7 @@ static int help(struct sk_buff **pskb,
networks, or the packet filter itself). */ networks, or the packet filter itself). */
if (!loose) { if (!loose) {
ret = NF_ACCEPT; ret = NF_ACCEPT;
ip_conntrack_expect_free(exp); goto out_put_expect;
goto out_update_nl;
} }
exp->tuple.dst.ip = htonl((array[0] << 24) | (array[1] << 16) exp->tuple.dst.ip = htonl((array[0] << 24) | (array[1] << 16)
| (array[2] << 8) | array[3]); | (array[2] << 8) | array[3]);
...@@ -419,7 +418,6 @@ static int help(struct sk_buff **pskb, ...@@ -419,7 +418,6 @@ static int help(struct sk_buff **pskb,
{ 0xFFFFFFFF, { .tcp = { 0xFFFF } }, 0xFF }}); { 0xFFFFFFFF, { .tcp = { 0xFFFF } }, 0xFF }});
exp->expectfn = NULL; exp->expectfn = NULL;
exp->master = ct;
/* Now, NAT might want to mangle the packet, and register the /* Now, NAT might want to mangle the packet, and register the
* (possibly changed) expectation itself. */ * (possibly changed) expectation itself. */
...@@ -428,13 +426,15 @@ static int help(struct sk_buff **pskb, ...@@ -428,13 +426,15 @@ static int help(struct sk_buff **pskb,
matchoff, matchlen, exp, &seq); matchoff, matchlen, exp, &seq);
else { else {
/* Can't expect this? Best to drop packet now. */ /* Can't expect this? Best to drop packet now. */
if (ip_conntrack_expect_related(exp) != 0) { if (ip_conntrack_expect_related(exp) != 0)
ip_conntrack_expect_free(exp);
ret = NF_DROP; ret = NF_DROP;
} else else
ret = NF_ACCEPT; ret = NF_ACCEPT;
} }
out_put_expect:
ip_conntrack_expect_put(exp);
out_update_nl: out_update_nl:
/* Now if this ends in \n, update ftp info. Seq may have been /* Now if this ends in \n, update ftp info. Seq may have been
* adjusted by NAT code. */ * adjusted by NAT code. */
......
...@@ -197,7 +197,7 @@ static int help(struct sk_buff **pskb, ...@@ -197,7 +197,7 @@ static int help(struct sk_buff **pskb,
continue; continue;
} }
exp = ip_conntrack_expect_alloc(); exp = ip_conntrack_expect_alloc(ct);
if (exp == NULL) { if (exp == NULL) {
ret = NF_DROP; ret = NF_DROP;
goto out; goto out;
...@@ -221,16 +221,14 @@ static int help(struct sk_buff **pskb, ...@@ -221,16 +221,14 @@ static int help(struct sk_buff **pskb,
{ { 0, { 0 } }, { { 0, { 0 } },
{ 0xFFFFFFFF, { .tcp = { 0xFFFF } }, 0xFF }}); { 0xFFFFFFFF, { .tcp = { 0xFFFF } }, 0xFF }});
exp->expectfn = NULL; exp->expectfn = NULL;
exp->master = ct;
if (ip_nat_irc_hook) if (ip_nat_irc_hook)
ret = ip_nat_irc_hook(pskb, ctinfo, ret = ip_nat_irc_hook(pskb, ctinfo,
addr_beg_p - ib_ptr, addr_beg_p - ib_ptr,
addr_end_p - addr_beg_p, addr_end_p - addr_beg_p,
exp); exp);
else if (ip_conntrack_expect_related(exp) != 0) { else if (ip_conntrack_expect_related(exp) != 0)
ip_conntrack_expect_free(exp);
ret = NF_DROP; ret = NF_DROP;
} ip_conntrack_expect_put(exp);
goto out; goto out;
} /* for .. NUM_DCCPROTO */ } /* for .. NUM_DCCPROTO */
} /* while data < ... */ } /* while data < ... */
......
...@@ -985,7 +985,7 @@ EXPORT_SYMBOL(ip_ct_refresh_acct); ...@@ -985,7 +985,7 @@ EXPORT_SYMBOL(ip_ct_refresh_acct);
EXPORT_SYMBOL(ip_ct_protos); EXPORT_SYMBOL(ip_ct_protos);
EXPORT_SYMBOL(ip_ct_find_proto); EXPORT_SYMBOL(ip_ct_find_proto);
EXPORT_SYMBOL(ip_conntrack_expect_alloc); EXPORT_SYMBOL(ip_conntrack_expect_alloc);
EXPORT_SYMBOL(ip_conntrack_expect_free); EXPORT_SYMBOL(ip_conntrack_expect_put);
EXPORT_SYMBOL(ip_conntrack_expect_related); EXPORT_SYMBOL(ip_conntrack_expect_related);
EXPORT_SYMBOL(ip_conntrack_unexpect_related); EXPORT_SYMBOL(ip_conntrack_unexpect_related);
EXPORT_SYMBOL(ip_conntrack_tuple_taken); EXPORT_SYMBOL(ip_conntrack_tuple_taken);
......
...@@ -65,7 +65,7 @@ static int tftp_help(struct sk_buff **pskb, ...@@ -65,7 +65,7 @@ static int tftp_help(struct sk_buff **pskb,
DUMP_TUPLE(&ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple); DUMP_TUPLE(&ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple);
DUMP_TUPLE(&ct->tuplehash[IP_CT_DIR_REPLY].tuple); DUMP_TUPLE(&ct->tuplehash[IP_CT_DIR_REPLY].tuple);
exp = ip_conntrack_expect_alloc(); exp = ip_conntrack_expect_alloc(ct);
if (exp == NULL) if (exp == NULL)
return NF_DROP; return NF_DROP;
...@@ -75,17 +75,15 @@ static int tftp_help(struct sk_buff **pskb, ...@@ -75,17 +75,15 @@ static int tftp_help(struct sk_buff **pskb,
exp->mask.dst.u.udp.port = 0xffff; exp->mask.dst.u.udp.port = 0xffff;
exp->mask.dst.protonum = 0xff; exp->mask.dst.protonum = 0xff;
exp->expectfn = NULL; exp->expectfn = NULL;
exp->master = ct;
DEBUGP("expect: "); DEBUGP("expect: ");
DUMP_TUPLE(&exp->tuple); DUMP_TUPLE(&exp->tuple);
DUMP_TUPLE(&exp->mask); DUMP_TUPLE(&exp->mask);
if (ip_nat_tftp_hook) if (ip_nat_tftp_hook)
ret = ip_nat_tftp_hook(pskb, ctinfo, exp); ret = ip_nat_tftp_hook(pskb, ctinfo, exp);
else if (ip_conntrack_expect_related(exp) != 0) { else if (ip_conntrack_expect_related(exp) != 0)
ip_conntrack_expect_free(exp);
ret = NF_DROP; ret = NF_DROP;
} ip_conntrack_expect_put(exp);
break; break;
case TFTP_OPCODE_DATA: case TFTP_OPCODE_DATA:
case TFTP_OPCODE_ACK: case TFTP_OPCODE_ACK:
......
...@@ -56,10 +56,8 @@ static unsigned int help(struct sk_buff **pskb, ...@@ -56,10 +56,8 @@ static unsigned int help(struct sk_buff **pskb,
break; break;
} }
if (port == 0) { if (port == 0)
ip_conntrack_expect_free(exp);
return NF_DROP; return NF_DROP;
}
sprintf(buffer, "%u", port); sprintf(buffer, "%u", port);
ret = ip_nat_mangle_udp_packet(pskb, exp->master, ctinfo, ret = ip_nat_mangle_udp_packet(pskb, exp->master, ctinfo,
......
...@@ -143,10 +143,8 @@ static unsigned int ip_nat_ftp(struct sk_buff **pskb, ...@@ -143,10 +143,8 @@ static unsigned int ip_nat_ftp(struct sk_buff **pskb,
break; break;
} }
if (port == 0) { if (port == 0)
ip_conntrack_expect_free(exp);
return NF_DROP; return NF_DROP;
}
if (!mangle[type](pskb, newip, port, matchoff, matchlen, ct, ctinfo, if (!mangle[type](pskb, newip, port, matchoff, matchlen, ct, ctinfo,
seq)) { seq)) {
......
...@@ -65,10 +65,8 @@ static unsigned int help(struct sk_buff **pskb, ...@@ -65,10 +65,8 @@ static unsigned int help(struct sk_buff **pskb,
break; break;
} }
if (port == 0) { if (port == 0)
ip_conntrack_expect_free(exp);
return NF_DROP; return NF_DROP;
}
/* strlen("\1DCC CHAT chat AAAAAAAA P\1\n")=27 /* strlen("\1DCC CHAT chat AAAAAAAA P\1\n")=27
* strlen("\1DCC SCHAT chat AAAAAAAA P\1\n")=28 * strlen("\1DCC SCHAT chat AAAAAAAA P\1\n")=28
......
...@@ -35,16 +35,17 @@ icmp_unique_tuple(struct ip_conntrack_tuple *tuple, ...@@ -35,16 +35,17 @@ icmp_unique_tuple(struct ip_conntrack_tuple *tuple,
const struct ip_conntrack *conntrack) const struct ip_conntrack *conntrack)
{ {
static u_int16_t id; static u_int16_t id;
unsigned int range_size unsigned int range_size;
= (unsigned int)range->max.icmp.id - range->min.icmp.id + 1;
unsigned int i; unsigned int i;
range_size = ntohs(range->max.icmp.id) - ntohs(range->min.icmp.id) + 1;
/* If no range specified... */ /* If no range specified... */
if (!(range->flags & IP_NAT_RANGE_PROTO_SPECIFIED)) if (!(range->flags & IP_NAT_RANGE_PROTO_SPECIFIED))
range_size = 0xFFFF; range_size = 0xFFFF;
for (i = 0; i < range_size; i++, id++) { for (i = 0; i < range_size; i++, id++) {
tuple->src.u.icmp.id = range->min.icmp.id + (id % range_size); tuple->src.u.icmp.id = htons(ntohs(range->min.icmp.id) +
(id % range_size));
if (!ip_nat_used_tuple(tuple, conntrack)) if (!ip_nat_used_tuple(tuple, conntrack))
return 1; return 1;
} }
......
...@@ -40,7 +40,8 @@ tcp_unique_tuple(struct ip_conntrack_tuple *tuple, ...@@ -40,7 +40,8 @@ tcp_unique_tuple(struct ip_conntrack_tuple *tuple,
enum ip_nat_manip_type maniptype, enum ip_nat_manip_type maniptype,
const struct ip_conntrack *conntrack) const struct ip_conntrack *conntrack)
{ {
static u_int16_t port, *portptr; static u_int16_t port;
u_int16_t *portptr;
unsigned int range_size, min, i; unsigned int range_size, min, i;
if (maniptype == IP_NAT_MANIP_SRC) if (maniptype == IP_NAT_MANIP_SRC)
......
...@@ -41,7 +41,8 @@ udp_unique_tuple(struct ip_conntrack_tuple *tuple, ...@@ -41,7 +41,8 @@ udp_unique_tuple(struct ip_conntrack_tuple *tuple,
enum ip_nat_manip_type maniptype, enum ip_nat_manip_type maniptype,
const struct ip_conntrack *conntrack) const struct ip_conntrack *conntrack)
{ {
static u_int16_t port, *portptr; static u_int16_t port;
u_int16_t *portptr;
unsigned int range_size, min, i; unsigned int range_size, min, i;
if (maniptype == IP_NAT_MANIP_SRC) if (maniptype == IP_NAT_MANIP_SRC)
......
...@@ -45,10 +45,8 @@ static unsigned int help(struct sk_buff **pskb, ...@@ -45,10 +45,8 @@ static unsigned int help(struct sk_buff **pskb,
exp->saved_proto.udp.port = exp->tuple.dst.u.tcp.port; exp->saved_proto.udp.port = exp->tuple.dst.u.tcp.port;
exp->dir = IP_CT_DIR_REPLY; exp->dir = IP_CT_DIR_REPLY;
exp->expectfn = ip_nat_follow_master; exp->expectfn = ip_nat_follow_master;
if (ip_conntrack_expect_related(exp) != 0) { if (ip_conntrack_expect_related(exp) != 0)
ip_conntrack_expect_free(exp);
return NF_DROP; return NF_DROP;
}
return NF_ACCEPT; return NF_ACCEPT;
} }
......
...@@ -78,10 +78,9 @@ static int ipip_rcv(struct sk_buff *skb) ...@@ -78,10 +78,9 @@ static int ipip_rcv(struct sk_buff *skb)
static void ipip_err(struct sk_buff *skb, u32 info) static void ipip_err(struct sk_buff *skb, u32 info)
{ {
struct xfrm_tunnel *handler = ipip_handler; struct xfrm_tunnel *handler = ipip_handler;
u32 arg = info;
if (handler) if (handler)
handler->err_handler(skb, &arg); handler->err_handler(skb, info);
} }
static int ipip_init_state(struct xfrm_state *x) static int ipip_init_state(struct xfrm_state *x)
......
...@@ -91,7 +91,6 @@ config INET6_TUNNEL ...@@ -91,7 +91,6 @@ config INET6_TUNNEL
config IPV6_TUNNEL config IPV6_TUNNEL
tristate "IPv6: IPv6-in-IPv6 tunnel" tristate "IPv6: IPv6-in-IPv6 tunnel"
depends on IPV6 depends on IPV6
select INET6_TUNNEL
---help--- ---help---
Support for IPv6-in-IPv6 tunnels described in RFC 2473. Support for IPv6-in-IPv6 tunnels described in RFC 2473.
......
...@@ -1110,11 +1110,39 @@ ip6ip6_fb_tnl_dev_init(struct net_device *dev) ...@@ -1110,11 +1110,39 @@ ip6ip6_fb_tnl_dev_init(struct net_device *dev)
return 0; return 0;
} }
#ifdef CONFIG_INET6_TUNNEL
static struct xfrm6_tunnel ip6ip6_handler = { static struct xfrm6_tunnel ip6ip6_handler = {
.handler = ip6ip6_rcv, .handler = ip6ip6_rcv,
.err_handler = ip6ip6_err, .err_handler = ip6ip6_err,
}; };
static inline int ip6ip6_register(void)
{
return xfrm6_tunnel_register(&ip6ip6_handler);
}
static inline int ip6ip6_unregister(void)
{
return xfrm6_tunnel_unregister(&ip6ip6_handler);
}
#else
static struct inet6_protocol xfrm6_tunnel_protocol = {
.handler = ip6ip6_rcv,
.err_handler = ip6ip6_err,
.flags = INET6_PROTO_NOPOLICY|INET6_PROTO_FINAL,
};
static inline int ip6ip6_register(void)
{
return inet6_add_protocol(&xfrm6_tunnel_protocol, IPPROTO_IPV6);
}
static inline int ip6ip6_unregister(void)
{
return inet6_del_protocol(&xfrm6_tunnel_protocol, IPPROTO_IPV6);
}
#endif
/** /**
* ip6_tunnel_init - register protocol and reserve needed resources * ip6_tunnel_init - register protocol and reserve needed resources
* *
...@@ -1125,7 +1153,7 @@ static int __init ip6_tunnel_init(void) ...@@ -1125,7 +1153,7 @@ static int __init ip6_tunnel_init(void)
{ {
int err; int err;
if (xfrm6_tunnel_register(&ip6ip6_handler) < 0) { if (ip6ip6_register() < 0) {
printk(KERN_ERR "ip6ip6 init: can't register tunnel\n"); printk(KERN_ERR "ip6ip6 init: can't register tunnel\n");
return -EAGAIN; return -EAGAIN;
} }
...@@ -1144,7 +1172,7 @@ static int __init ip6_tunnel_init(void) ...@@ -1144,7 +1172,7 @@ static int __init ip6_tunnel_init(void)
} }
return 0; return 0;
fail: fail:
xfrm6_tunnel_deregister(&ip6ip6_handler); ip6ip6_unregister();
return err; return err;
} }
...@@ -1154,7 +1182,7 @@ static int __init ip6_tunnel_init(void) ...@@ -1154,7 +1182,7 @@ static int __init ip6_tunnel_init(void)
static void __exit ip6_tunnel_cleanup(void) static void __exit ip6_tunnel_cleanup(void)
{ {
if (xfrm6_tunnel_deregister(&ip6ip6_handler) < 0) if (ip6ip6_unregister() < 0)
printk(KERN_INFO "ip6ip6 close: can't deregister tunnel\n"); printk(KERN_INFO "ip6ip6 close: can't deregister tunnel\n");
unregister_netdev(ip6ip6_fb_tnl_dev); unregister_netdev(ip6ip6_fb_tnl_dev);
......
...@@ -76,7 +76,9 @@ static DECLARE_MUTEX(ipqnl_sem); ...@@ -76,7 +76,9 @@ static DECLARE_MUTEX(ipqnl_sem);
static void static void
ipq_issue_verdict(struct ipq_queue_entry *entry, int verdict) ipq_issue_verdict(struct ipq_queue_entry *entry, int verdict)
{ {
local_bh_disable();
nf_reinject(entry->skb, entry->info, verdict); nf_reinject(entry->skb, entry->info, verdict);
local_bh_enable();
kfree(entry); kfree(entry);
} }
......
...@@ -373,9 +373,10 @@ ip6t_log_packet(unsigned int hooknum, ...@@ -373,9 +373,10 @@ ip6t_log_packet(unsigned int hooknum,
in ? in->name : "", in ? in->name : "",
out ? out->name : ""); out ? out->name : "");
if (in && !out) { if (in && !out) {
unsigned int len;
/* MAC logging for input chain only. */ /* MAC logging for input chain only. */
printk("MAC="); printk("MAC=");
if (skb->dev && skb->dev->hard_header_len && if (skb->dev && (len = skb->dev->hard_header_len) &&
skb->mac.raw != skb->nh.raw) { skb->mac.raw != skb->nh.raw) {
unsigned char *p = skb->mac.raw; unsigned char *p = skb->mac.raw;
int i; int i;
...@@ -384,9 +385,11 @@ ip6t_log_packet(unsigned int hooknum, ...@@ -384,9 +385,11 @@ ip6t_log_packet(unsigned int hooknum,
(p -= ETH_HLEN) < skb->head) (p -= ETH_HLEN) < skb->head)
p = NULL; p = NULL;
if (p != NULL) if (p != NULL) {
for (i = 0; i < skb->dev->hard_header_len; i++) for (i = 0; i < len; i++)
printk("%02x", p[i]); printk("%02x%s", p[i],
i == len - 1 ? "" : ":");
}
printk(" "); printk(" ");
if (skb->dev->type == ARPHRD_SIT) { if (skb->dev->type == ARPHRD_SIT) {
......
...@@ -648,7 +648,8 @@ void netlink_detachskb(struct sock *sk, struct sk_buff *skb) ...@@ -648,7 +648,8 @@ void netlink_detachskb(struct sock *sk, struct sk_buff *skb)
sock_put(sk); sock_put(sk);
} }
static inline struct sk_buff *netlink_trim(struct sk_buff *skb, int allocation) static inline struct sk_buff *netlink_trim(struct sk_buff *skb,
unsigned int __nocast allocation)
{ {
int delta; int delta;
...@@ -717,7 +718,7 @@ struct netlink_broadcast_data { ...@@ -717,7 +718,7 @@ struct netlink_broadcast_data {
int failure; int failure;
int congested; int congested;
int delivered; int delivered;
int allocation; unsigned int allocation;
struct sk_buff *skb, *skb2; struct sk_buff *skb, *skb2;
}; };
......
...@@ -27,17 +27,17 @@ ...@@ -27,17 +27,17 @@
* lvalue rvalue * lvalue rvalue
* +-----------+ +-----------+ * +-----------+ +-----------+
* | type: INT | | type: INT | * | type: INT | | type: INT |
* def | id: INDEV | | id: VALUE | * def | id: DEV | | id: VALUE |
* | data: | | data: 3 | * | data: | | data: 3 |
* +-----------+ +-----------+ * +-----------+ +-----------+
* | | * | |
* ---> meta_ops[INT][INDEV](...) | * ---> meta_ops[INT][DEV](...) |
* | | * | |
* ----------- | * ----------- |
* V V * V V
* +-----------+ +-----------+ * +-----------+ +-----------+
* | type: INT | | type: INT | * | type: INT | | type: INT |
* obj | id: INDEV | | id: VALUE | * obj | id: DEV | | id: VALUE |
* | data: 2 |<--data got filled out | data: 3 | * | data: 2 |<--data got filled out | data: 3 |
* +-----------+ +-----------+ * +-----------+ +-----------+
* | | * | |
...@@ -170,26 +170,6 @@ META_COLLECTOR(var_dev) ...@@ -170,26 +170,6 @@ META_COLLECTOR(var_dev)
*err = var_dev(skb->dev, dst); *err = var_dev(skb->dev, dst);
} }
META_COLLECTOR(int_indev)
{
*err = int_dev(skb->input_dev, dst);
}
META_COLLECTOR(var_indev)
{
*err = var_dev(skb->input_dev, dst);
}
META_COLLECTOR(int_realdev)
{
*err = int_dev(skb->real_dev, dst);
}
META_COLLECTOR(var_realdev)
{
*err = var_dev(skb->real_dev, dst);
}
/************************************************************************** /**************************************************************************
* skb attributes * skb attributes
**************************************************************************/ **************************************************************************/
...@@ -245,18 +225,6 @@ META_COLLECTOR(int_tcindex) ...@@ -245,18 +225,6 @@ META_COLLECTOR(int_tcindex)
dst->value = skb->tc_index; dst->value = skb->tc_index;
} }
#ifdef CONFIG_NET_CLS_ACT
META_COLLECTOR(int_tcverd)
{
dst->value = skb->tc_verd;
}
META_COLLECTOR(int_tcclassid)
{
dst->value = skb->tc_classid;
}
#endif
/************************************************************************** /**************************************************************************
* Routing * Routing
**************************************************************************/ **************************************************************************/
...@@ -505,8 +473,6 @@ struct meta_ops ...@@ -505,8 +473,6 @@ struct meta_ops
static struct meta_ops __meta_ops[TCF_META_TYPE_MAX+1][TCF_META_ID_MAX+1] = { static struct meta_ops __meta_ops[TCF_META_TYPE_MAX+1][TCF_META_ID_MAX+1] = {
[TCF_META_TYPE_VAR] = { [TCF_META_TYPE_VAR] = {
[META_ID(DEV)] = META_FUNC(var_dev), [META_ID(DEV)] = META_FUNC(var_dev),
[META_ID(INDEV)] = META_FUNC(var_indev),
[META_ID(REALDEV)] = META_FUNC(var_realdev),
[META_ID(SK_BOUND_IF)] = META_FUNC(var_sk_bound_if), [META_ID(SK_BOUND_IF)] = META_FUNC(var_sk_bound_if),
}, },
[TCF_META_TYPE_INT] = { [TCF_META_TYPE_INT] = {
...@@ -515,8 +481,6 @@ static struct meta_ops __meta_ops[TCF_META_TYPE_MAX+1][TCF_META_ID_MAX+1] = { ...@@ -515,8 +481,6 @@ static struct meta_ops __meta_ops[TCF_META_TYPE_MAX+1][TCF_META_ID_MAX+1] = {
[META_ID(LOADAVG_1)] = META_FUNC(int_loadavg_1), [META_ID(LOADAVG_1)] = META_FUNC(int_loadavg_1),
[META_ID(LOADAVG_2)] = META_FUNC(int_loadavg_2), [META_ID(LOADAVG_2)] = META_FUNC(int_loadavg_2),
[META_ID(DEV)] = META_FUNC(int_dev), [META_ID(DEV)] = META_FUNC(int_dev),
[META_ID(INDEV)] = META_FUNC(int_indev),
[META_ID(REALDEV)] = META_FUNC(int_realdev),
[META_ID(PRIORITY)] = META_FUNC(int_priority), [META_ID(PRIORITY)] = META_FUNC(int_priority),
[META_ID(PROTOCOL)] = META_FUNC(int_protocol), [META_ID(PROTOCOL)] = META_FUNC(int_protocol),
[META_ID(PKTTYPE)] = META_FUNC(int_pkttype), [META_ID(PKTTYPE)] = META_FUNC(int_pkttype),
...@@ -527,10 +491,6 @@ static struct meta_ops __meta_ops[TCF_META_TYPE_MAX+1][TCF_META_ID_MAX+1] = { ...@@ -527,10 +491,6 @@ static struct meta_ops __meta_ops[TCF_META_TYPE_MAX+1][TCF_META_ID_MAX+1] = {
[META_ID(NFMARK)] = META_FUNC(int_nfmark), [META_ID(NFMARK)] = META_FUNC(int_nfmark),
#endif #endif
[META_ID(TCINDEX)] = META_FUNC(int_tcindex), [META_ID(TCINDEX)] = META_FUNC(int_tcindex),
#ifdef CONFIG_NET_CLS_ACT
[META_ID(TCVERDICT)] = META_FUNC(int_tcverd),
[META_ID(TCCLASSID)] = META_FUNC(int_tcclassid),
#endif
#ifdef CONFIG_NET_CLS_ROUTE #ifdef CONFIG_NET_CLS_ROUTE
[META_ID(RTCLASSID)] = META_FUNC(int_rtclassid), [META_ID(RTCLASSID)] = META_FUNC(int_rtclassid),
#endif #endif
......
...@@ -55,9 +55,6 @@ static int em_text_change(struct tcf_proto *tp, void *data, int len, ...@@ -55,9 +55,6 @@ static int em_text_change(struct tcf_proto *tp, void *data, int len,
struct ts_config *ts_conf; struct ts_config *ts_conf;
int flags = 0; int flags = 0;
printk("Configuring text: %s from %d:%d to %d:%d len %d\n", conf->algo, conf->from_offset,
conf->from_layer, conf->to_offset, conf->to_layer, conf->pattern_len);
if (len < sizeof(*conf) || len < (sizeof(*conf) + conf->pattern_len)) if (len < sizeof(*conf) || len < (sizeof(*conf) + conf->pattern_len))
return -EINVAL; return -EINVAL;
......
...@@ -331,11 +331,10 @@ static struct sk_buff *pfifo_fast_dequeue(struct Qdisc* qdisc) ...@@ -331,11 +331,10 @@ static struct sk_buff *pfifo_fast_dequeue(struct Qdisc* qdisc)
int prio; int prio;
struct sk_buff_head *list = qdisc_priv(qdisc); struct sk_buff_head *list = qdisc_priv(qdisc);
for (prio = 0; prio < PFIFO_FAST_BANDS; prio++, list++) { for (prio = 0; prio < PFIFO_FAST_BANDS; prio++) {
struct sk_buff *skb = __qdisc_dequeue_head(qdisc, list); if (!skb_queue_empty(list + prio)) {
if (skb) {
qdisc->q.qlen--; qdisc->q.qlen--;
return skb; return __qdisc_dequeue_head(qdisc, list + prio);
} }
} }
......
...@@ -351,7 +351,6 @@ void sctp_icmp_frag_needed(struct sock *sk, struct sctp_association *asoc, ...@@ -351,7 +351,6 @@ void sctp_icmp_frag_needed(struct sock *sk, struct sctp_association *asoc,
* *
*/ */
void sctp_icmp_proto_unreachable(struct sock *sk, void sctp_icmp_proto_unreachable(struct sock *sk,
struct sctp_endpoint *ep,
struct sctp_association *asoc, struct sctp_association *asoc,
struct sctp_transport *t) struct sctp_transport *t)
{ {
...@@ -367,7 +366,6 @@ void sctp_icmp_proto_unreachable(struct sock *sk, ...@@ -367,7 +366,6 @@ void sctp_icmp_proto_unreachable(struct sock *sk,
/* Common lookup code for icmp/icmpv6 error handler. */ /* Common lookup code for icmp/icmpv6 error handler. */
struct sock *sctp_err_lookup(int family, struct sk_buff *skb, struct sock *sctp_err_lookup(int family, struct sk_buff *skb,
struct sctphdr *sctphdr, struct sctphdr *sctphdr,
struct sctp_endpoint **epp,
struct sctp_association **app, struct sctp_association **app,
struct sctp_transport **tpp) struct sctp_transport **tpp)
{ {
...@@ -375,11 +373,10 @@ struct sock *sctp_err_lookup(int family, struct sk_buff *skb, ...@@ -375,11 +373,10 @@ struct sock *sctp_err_lookup(int family, struct sk_buff *skb,
union sctp_addr daddr; union sctp_addr daddr;
struct sctp_af *af; struct sctp_af *af;
struct sock *sk = NULL; struct sock *sk = NULL;
struct sctp_endpoint *ep = NULL;
struct sctp_association *asoc = NULL; struct sctp_association *asoc = NULL;
struct sctp_transport *transport = NULL; struct sctp_transport *transport = NULL;
*app = NULL; *epp = NULL; *tpp = NULL; *app = NULL; *tpp = NULL;
af = sctp_get_af_specific(family); af = sctp_get_af_specific(family);
if (unlikely(!af)) { if (unlikely(!af)) {
...@@ -394,26 +391,15 @@ struct sock *sctp_err_lookup(int family, struct sk_buff *skb, ...@@ -394,26 +391,15 @@ struct sock *sctp_err_lookup(int family, struct sk_buff *skb,
* packet. * packet.
*/ */
asoc = __sctp_lookup_association(&saddr, &daddr, &transport); asoc = __sctp_lookup_association(&saddr, &daddr, &transport);
if (!asoc) { if (!asoc)
/* If there is no matching association, see if it matches any return NULL;
* endpoint. This may happen for an ICMP error generated in
* response to an INIT_ACK.
*/
ep = __sctp_rcv_lookup_endpoint(&daddr);
if (!ep) {
return NULL;
}
}
if (asoc) { sk = asoc->base.sk;
sk = asoc->base.sk;
if (ntohl(sctphdr->vtag) != asoc->c.peer_vtag) { if (ntohl(sctphdr->vtag) != asoc->c.peer_vtag) {
ICMP_INC_STATS_BH(ICMP_MIB_INERRORS); ICMP_INC_STATS_BH(ICMP_MIB_INERRORS);
goto out; goto out;
} }
} else
sk = ep->base.sk;
sctp_bh_lock_sock(sk); sctp_bh_lock_sock(sk);
...@@ -423,7 +409,6 @@ struct sock *sctp_err_lookup(int family, struct sk_buff *skb, ...@@ -423,7 +409,6 @@ struct sock *sctp_err_lookup(int family, struct sk_buff *skb,
if (sock_owned_by_user(sk)) if (sock_owned_by_user(sk))
NET_INC_STATS_BH(LINUX_MIB_LOCKDROPPEDICMPS); NET_INC_STATS_BH(LINUX_MIB_LOCKDROPPEDICMPS);
*epp = ep;
*app = asoc; *app = asoc;
*tpp = transport; *tpp = transport;
return sk; return sk;
...@@ -432,21 +417,16 @@ struct sock *sctp_err_lookup(int family, struct sk_buff *skb, ...@@ -432,21 +417,16 @@ struct sock *sctp_err_lookup(int family, struct sk_buff *skb,
sock_put(sk); sock_put(sk);
if (asoc) if (asoc)
sctp_association_put(asoc); sctp_association_put(asoc);
if (ep)
sctp_endpoint_put(ep);
return NULL; return NULL;
} }
/* Common cleanup code for icmp/icmpv6 error handler. */ /* Common cleanup code for icmp/icmpv6 error handler. */
void sctp_err_finish(struct sock *sk, struct sctp_endpoint *ep, void sctp_err_finish(struct sock *sk, struct sctp_association *asoc)
struct sctp_association *asoc)
{ {
sctp_bh_unlock_sock(sk); sctp_bh_unlock_sock(sk);
sock_put(sk); sock_put(sk);
if (asoc) if (asoc)
sctp_association_put(asoc); sctp_association_put(asoc);
if (ep)
sctp_endpoint_put(ep);
} }
/* /*
...@@ -471,7 +451,6 @@ void sctp_v4_err(struct sk_buff *skb, __u32 info) ...@@ -471,7 +451,6 @@ void sctp_v4_err(struct sk_buff *skb, __u32 info)
int type = skb->h.icmph->type; int type = skb->h.icmph->type;
int code = skb->h.icmph->code; int code = skb->h.icmph->code;
struct sock *sk; struct sock *sk;
struct sctp_endpoint *ep;
struct sctp_association *asoc; struct sctp_association *asoc;
struct sctp_transport *transport; struct sctp_transport *transport;
struct inet_sock *inet; struct inet_sock *inet;
...@@ -488,7 +467,7 @@ void sctp_v4_err(struct sk_buff *skb, __u32 info) ...@@ -488,7 +467,7 @@ void sctp_v4_err(struct sk_buff *skb, __u32 info)
savesctp = skb->h.raw; savesctp = skb->h.raw;
skb->nh.iph = iph; skb->nh.iph = iph;
skb->h.raw = (char *)sh; skb->h.raw = (char *)sh;
sk = sctp_err_lookup(AF_INET, skb, sh, &ep, &asoc, &transport); sk = sctp_err_lookup(AF_INET, skb, sh, &asoc, &transport);
/* Put back, the original pointers. */ /* Put back, the original pointers. */
skb->nh.raw = saveip; skb->nh.raw = saveip;
skb->h.raw = savesctp; skb->h.raw = savesctp;
...@@ -515,7 +494,7 @@ void sctp_v4_err(struct sk_buff *skb, __u32 info) ...@@ -515,7 +494,7 @@ void sctp_v4_err(struct sk_buff *skb, __u32 info)
} }
else { else {
if (ICMP_PROT_UNREACH == code) { if (ICMP_PROT_UNREACH == code) {
sctp_icmp_proto_unreachable(sk, ep, asoc, sctp_icmp_proto_unreachable(sk, asoc,
transport); transport);
goto out_unlock; goto out_unlock;
} }
...@@ -544,7 +523,7 @@ void sctp_v4_err(struct sk_buff *skb, __u32 info) ...@@ -544,7 +523,7 @@ void sctp_v4_err(struct sk_buff *skb, __u32 info)
} }
out_unlock: out_unlock:
sctp_err_finish(sk, ep, asoc); sctp_err_finish(sk, asoc);
} }
/* /*
......
...@@ -91,7 +91,6 @@ SCTP_STATIC void sctp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, ...@@ -91,7 +91,6 @@ SCTP_STATIC void sctp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
struct ipv6hdr *iph = (struct ipv6hdr *)skb->data; struct ipv6hdr *iph = (struct ipv6hdr *)skb->data;
struct sctphdr *sh = (struct sctphdr *)(skb->data + offset); struct sctphdr *sh = (struct sctphdr *)(skb->data + offset);
struct sock *sk; struct sock *sk;
struct sctp_endpoint *ep;
struct sctp_association *asoc; struct sctp_association *asoc;
struct sctp_transport *transport; struct sctp_transport *transport;
struct ipv6_pinfo *np; struct ipv6_pinfo *np;
...@@ -105,7 +104,7 @@ SCTP_STATIC void sctp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, ...@@ -105,7 +104,7 @@ SCTP_STATIC void sctp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
savesctp = skb->h.raw; savesctp = skb->h.raw;
skb->nh.ipv6h = iph; skb->nh.ipv6h = iph;
skb->h.raw = (char *)sh; skb->h.raw = (char *)sh;
sk = sctp_err_lookup(AF_INET6, skb, sh, &ep, &asoc, &transport); sk = sctp_err_lookup(AF_INET6, skb, sh, &asoc, &transport);
/* Put back, the original pointers. */ /* Put back, the original pointers. */
skb->nh.raw = saveip; skb->nh.raw = saveip;
skb->h.raw = savesctp; skb->h.raw = savesctp;
...@@ -124,7 +123,7 @@ SCTP_STATIC void sctp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, ...@@ -124,7 +123,7 @@ SCTP_STATIC void sctp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
goto out_unlock; goto out_unlock;
case ICMPV6_PARAMPROB: case ICMPV6_PARAMPROB:
if (ICMPV6_UNK_NEXTHDR == code) { if (ICMPV6_UNK_NEXTHDR == code) {
sctp_icmp_proto_unreachable(sk, ep, asoc, transport); sctp_icmp_proto_unreachable(sk, asoc, transport);
goto out_unlock; goto out_unlock;
} }
break; break;
...@@ -142,7 +141,7 @@ SCTP_STATIC void sctp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, ...@@ -142,7 +141,7 @@ SCTP_STATIC void sctp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
} }
out_unlock: out_unlock:
sctp_err_finish(sk, ep, asoc); sctp_err_finish(sk, asoc);
out: out:
if (likely(idev != NULL)) if (likely(idev != NULL))
in6_dev_put(idev); in6_dev_put(idev);
......
...@@ -127,8 +127,12 @@ static int sctp_dbg_objcnt_read(char *buffer, char **start, off_t offset, ...@@ -127,8 +127,12 @@ static int sctp_dbg_objcnt_read(char *buffer, char **start, off_t offset,
/* Initialize the objcount in the proc filesystem. */ /* Initialize the objcount in the proc filesystem. */
void sctp_dbg_objcnt_init(void) void sctp_dbg_objcnt_init(void)
{ {
create_proc_read_entry("sctp_dbg_objcnt", 0, proc_net_sctp, struct proc_dir_entry *ent;
ent = create_proc_read_entry("sctp_dbg_objcnt", 0, proc_net_sctp,
sctp_dbg_objcnt_read, NULL); sctp_dbg_objcnt_read, NULL);
if (!ent)
printk(KERN_WARNING
"sctp_dbg_objcnt: Unable to create /proc entry.\n");
} }
/* Cleanup the objcount entry in the proc filesystem. */ /* Cleanup the objcount entry in the proc filesystem. */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册