Commit 8c8b9504 authored by David S. Miller's avatar David S. Miller

Merge nuts.ninka.net:/home/davem/src/BK/network-2.5

into nuts.ninka.net:/home/davem/src/BK/net-2.5
parents d498eb57 8b7468f3
...@@ -96,16 +96,30 @@ void sn_delete_polled_interrupt(int irq); ...@@ -96,16 +96,30 @@ void sn_delete_polled_interrupt(int irq);
#define USE_TPD_POOL #define USE_TPD_POOL
/* #undef CONFIG_ATM_HE_USE_SUNI */ /* #undef CONFIG_ATM_HE_USE_SUNI */
/* 2.2 kernel support */ /* compatibility */
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,43) #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,69)
#define dev_kfree_skb_irq(skb) dev_kfree_skb(skb) typedef void irqreturn_t;
#define dev_kfree_skb_any(skb) dev_kfree_skb(skb) #define IRQ_NONE
#undef USE_TASKLET #define IRQ_HANDLED
#define IRQ_RETVAL(x)
#endif #endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,2,18) #if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,9)
#define set_current_state(x) current->state = (x); #define __devexit_p(func) func
#endif
#ifndef MODULE_LICENSE
#define MODULE_LICENSE(x)
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,3)
#define pci_set_drvdata(pci_dev, data) (pci_dev)->driver_data = (data)
#define pci_get_drvdata(pci_dev) (pci_dev)->driver_data
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,44)
#define pci_pool_create(a, b, c, d, e) pci_pool_create(a, b, c, d, e, SLAB_KERNEL)
#endif #endif
#include "he.h" #include "he.h"
...@@ -135,11 +149,7 @@ static void he_close(struct atm_vcc *vcc); ...@@ -135,11 +149,7 @@ static void he_close(struct atm_vcc *vcc);
static int he_send(struct atm_vcc *vcc, struct sk_buff *skb); static int he_send(struct atm_vcc *vcc, struct sk_buff *skb);
static int he_sg_send(struct atm_vcc *vcc, unsigned long start, unsigned long size); static int he_sg_send(struct atm_vcc *vcc, unsigned long start, unsigned long size);
static int he_ioctl(struct atm_dev *dev, unsigned int cmd, void *arg); static int he_ioctl(struct atm_dev *dev, unsigned int cmd, void *arg);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,69)
static irqreturn_t he_irq_handler(int irq, void *dev_id, struct pt_regs *regs); static irqreturn_t he_irq_handler(int irq, void *dev_id, struct pt_regs *regs);
#else
static void he_irq_handler(int irq, void *dev_id, struct pt_regs *regs);
#endif
static void he_tasklet(unsigned long data); static void he_tasklet(unsigned long data);
static int he_proc_read(struct atm_dev *dev,loff_t *pos,char *page); static int he_proc_read(struct atm_dev *dev,loff_t *pos,char *page);
static int he_start(struct atm_dev *dev); static int he_start(struct atm_dev *dev);
...@@ -357,9 +367,7 @@ he_init_one(struct pci_dev *pci_dev, const struct pci_device_id *pci_ent) ...@@ -357,9 +367,7 @@ he_init_one(struct pci_dev *pci_dev, const struct pci_device_id *pci_ent)
printk(KERN_INFO "he: %s\n", version); printk(KERN_INFO "he: %s\n", version);
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,3,43)
if (pci_enable_device(pci_dev)) return -EIO; if (pci_enable_device(pci_dev)) return -EIO;
#endif
if (pci_set_dma_mask(pci_dev, HE_DMA_MASK) != 0) if (pci_set_dma_mask(pci_dev, HE_DMA_MASK) != 0)
{ {
printk(KERN_WARNING "he: no suitable dma available\n"); printk(KERN_WARNING "he: no suitable dma available\n");
...@@ -368,11 +376,7 @@ he_init_one(struct pci_dev *pci_dev, const struct pci_device_id *pci_ent) ...@@ -368,11 +376,7 @@ he_init_one(struct pci_dev *pci_dev, const struct pci_device_id *pci_ent)
atm_dev = atm_dev_register(DEV_LABEL, &he_ops, -1, 0); atm_dev = atm_dev_register(DEV_LABEL, &he_ops, -1, 0);
if (!atm_dev) return -ENODEV; if (!atm_dev) return -ENODEV;
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,4,3)
pci_set_drvdata(pci_dev, atm_dev); pci_set_drvdata(pci_dev, atm_dev);
#else
pci_dev->driver_data = atm_dev;
#endif
he_dev = (struct he_dev *) kmalloc(sizeof(struct he_dev), he_dev = (struct he_dev *) kmalloc(sizeof(struct he_dev),
GFP_KERNEL); GFP_KERNEL);
...@@ -403,11 +407,7 @@ he_remove_one (struct pci_dev *pci_dev) ...@@ -403,11 +407,7 @@ he_remove_one (struct pci_dev *pci_dev)
struct atm_dev *atm_dev; struct atm_dev *atm_dev;
struct he_dev *he_dev; struct he_dev *he_dev;
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,4,3)
atm_dev = pci_get_drvdata(pci_dev); atm_dev = pci_get_drvdata(pci_dev);
#else
atm_dev = pci_dev->driver_data;
#endif
he_dev = HE_DEV(atm_dev); he_dev = HE_DEV(atm_dev);
/* need to remove from he_devs */ /* need to remove from he_devs */
...@@ -416,11 +416,7 @@ he_remove_one (struct pci_dev *pci_dev) ...@@ -416,11 +416,7 @@ he_remove_one (struct pci_dev *pci_dev)
atm_dev_deregister(atm_dev); atm_dev_deregister(atm_dev);
kfree(he_dev); kfree(he_dev);
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,4,3)
pci_set_drvdata(pci_dev, NULL); pci_set_drvdata(pci_dev, NULL);
#else
pci_dev->driver_data = NULL;
#endif
} }
...@@ -783,13 +779,8 @@ he_init_group(struct he_dev *he_dev, int group) ...@@ -783,13 +779,8 @@ he_init_group(struct he_dev *he_dev, int group)
#ifdef USE_RBPS #ifdef USE_RBPS
/* small buffer pool */ /* small buffer pool */
#ifdef USE_RBPS_POOL #ifdef USE_RBPS_POOL
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,44)
he_dev->rbps_pool = pci_pool_create("rbps", he_dev->pci_dev,
CONFIG_RBPS_BUFSIZE, 8, 0, SLAB_KERNEL);
#else
he_dev->rbps_pool = pci_pool_create("rbps", he_dev->pci_dev, he_dev->rbps_pool = pci_pool_create("rbps", he_dev->pci_dev,
CONFIG_RBPS_BUFSIZE, 8, 0); CONFIG_RBPS_BUFSIZE, 8, 0);
#endif
if (he_dev->rbps_pool == NULL) if (he_dev->rbps_pool == NULL)
{ {
hprintk("unable to create rbps pages\n"); hprintk("unable to create rbps pages\n");
...@@ -855,13 +846,8 @@ he_init_group(struct he_dev *he_dev, int group) ...@@ -855,13 +846,8 @@ he_init_group(struct he_dev *he_dev, int group)
/* large buffer pool */ /* large buffer pool */
#ifdef USE_RBPL_POOL #ifdef USE_RBPL_POOL
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,44)
he_dev->rbpl_pool = pci_pool_create("rbpl", he_dev->pci_dev,
CONFIG_RBPL_BUFSIZE, 8, 0, SLAB_KERNEL);
#else
he_dev->rbpl_pool = pci_pool_create("rbpl", he_dev->pci_dev, he_dev->rbpl_pool = pci_pool_create("rbpl", he_dev->pci_dev,
CONFIG_RBPL_BUFSIZE, 8, 0); CONFIG_RBPL_BUFSIZE, 8, 0);
#endif
if (he_dev->rbpl_pool == NULL) if (he_dev->rbpl_pool == NULL)
{ {
hprintk("unable to create rbpl pool\n"); hprintk("unable to create rbpl pool\n");
...@@ -1053,11 +1039,7 @@ he_start(struct atm_dev *dev) ...@@ -1053,11 +1039,7 @@ he_start(struct atm_dev *dev)
he_dev = HE_DEV(dev); he_dev = HE_DEV(dev);
pci_dev = he_dev->pci_dev; pci_dev = he_dev->pci_dev;
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,3,3)
he_dev->membase = pci_dev->resource[0].start; he_dev->membase = pci_dev->resource[0].start;
#else
he_dev->membase = pci_dev->base_address[0] & PCI_BASE_ADDRESS_MEM_MASK;
#endif
HPRINTK("membase = 0x%lx irq = %d.\n", he_dev->membase, pci_dev->irq); HPRINTK("membase = 0x%lx irq = %d.\n", he_dev->membase, pci_dev->irq);
/* /*
...@@ -1519,13 +1501,8 @@ he_start(struct atm_dev *dev) ...@@ -1519,13 +1501,8 @@ he_start(struct atm_dev *dev)
he_init_tpdrq(he_dev); he_init_tpdrq(he_dev);
#ifdef USE_TPD_POOL #ifdef USE_TPD_POOL
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,44)
he_dev->tpd_pool = pci_pool_create("tpd", he_dev->pci_dev,
sizeof(struct he_tpd), TPD_ALIGNMENT, 0, SLAB_KERNEL);
#else
he_dev->tpd_pool = pci_pool_create("tpd", he_dev->pci_dev, he_dev->tpd_pool = pci_pool_create("tpd", he_dev->pci_dev,
sizeof(struct he_tpd), TPD_ALIGNMENT, 0); sizeof(struct he_tpd), TPD_ALIGNMENT, 0);
#endif
if (he_dev->tpd_pool == NULL) if (he_dev->tpd_pool == NULL)
{ {
hprintk("unable to create tpd pci_pool\n"); hprintk("unable to create tpd pci_pool\n");
...@@ -1919,11 +1896,7 @@ he_service_rbrq(struct he_dev *he_dev, int group) ...@@ -1919,11 +1896,7 @@ he_service_rbrq(struct he_dev *he_dev, int group)
if (RBRQ_HBUF_ERR(he_dev->rbrq_head)) if (RBRQ_HBUF_ERR(he_dev->rbrq_head))
{ {
hprintk("HBUF_ERR! (cid 0x%x)\n", cid); hprintk("HBUF_ERR! (cid 0x%x)\n", cid);
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,99)
++vcc->stats->rx_drop;
#else
atomic_inc(&vcc->stats->rx_drop); atomic_inc(&vcc->stats->rx_drop);
#endif
goto return_host_buffers; goto return_host_buffers;
} }
...@@ -1958,27 +1931,12 @@ he_service_rbrq(struct he_dev *he_dev, int group) ...@@ -1958,27 +1931,12 @@ he_service_rbrq(struct he_dev *he_dev, int group)
RBRQ_LEN_ERR(he_dev->rbrq_head) RBRQ_LEN_ERR(he_dev->rbrq_head)
? "LEN_ERR" : "", ? "LEN_ERR" : "",
vcc->vpi, vcc->vci); vcc->vpi, vcc->vci);
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,99)
++vcc->stats->rx_err;
#else
atomic_inc(&vcc->stats->rx_err); atomic_inc(&vcc->stats->rx_err);
#endif
goto return_host_buffers; goto return_host_buffers;
} }
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,15)
skb = atm_alloc_charge(vcc, he_vcc->pdu_len + rx_skb_reserve, skb = atm_alloc_charge(vcc, he_vcc->pdu_len + rx_skb_reserve,
GFP_ATOMIC); GFP_ATOMIC);
#else
if (!atm_charge(vcc, atm_pdu2truesize(he_vcc->pdu_len + rx_skb_reserve)))
skb = NULL;
else
{
skb = alloc_skb(he_vcc->pdu_len + rx_skb_reserve, GFP_ATOMIC);
if (!skb) atm_return(vcc,
atm_pdu2truesize(he_vcc->pdu_len + rx_skb_reserve));
}
#endif
if (!skb) if (!skb)
{ {
HPRINTK("charge failed (%d.%d)\n", vcc->vpi, vcc->vci); HPRINTK("charge failed (%d.%d)\n", vcc->vpi, vcc->vci);
...@@ -2035,11 +1993,7 @@ he_service_rbrq(struct he_dev *he_dev, int group) ...@@ -2035,11 +1993,7 @@ he_service_rbrq(struct he_dev *he_dev, int group)
#endif #endif
vcc->push(vcc, skb); vcc->push(vcc, skb);
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,99)
++vcc->stats->rx;
#else
atomic_inc(&vcc->stats->rx); atomic_inc(&vcc->stats->rx);
#endif
return_host_buffers: return_host_buffers:
++pdus_assembled; ++pdus_assembled;
...@@ -2355,11 +2309,7 @@ he_tasklet(unsigned long data) ...@@ -2355,11 +2309,7 @@ he_tasklet(unsigned long data)
#endif #endif
} }
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,69)
static irqreturn_t static irqreturn_t
#else
static void
#endif
he_irq_handler(int irq, void *dev_id, struct pt_regs *regs) he_irq_handler(int irq, void *dev_id, struct pt_regs *regs)
{ {
unsigned long flags; unsigned long flags;
...@@ -2367,11 +2317,7 @@ he_irq_handler(int irq, void *dev_id, struct pt_regs *regs) ...@@ -2367,11 +2317,7 @@ he_irq_handler(int irq, void *dev_id, struct pt_regs *regs)
int handled = 0; int handled = 0;
if (he_dev == NULL) if (he_dev == NULL)
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,69)
return IRQ_NONE; return IRQ_NONE;
#else
return;
#endif
HE_SPIN_LOCK(he_dev, flags); HE_SPIN_LOCK(he_dev, flags);
...@@ -2406,11 +2352,7 @@ he_irq_handler(int irq, void *dev_id, struct pt_regs *regs) ...@@ -2406,11 +2352,7 @@ he_irq_handler(int irq, void *dev_id, struct pt_regs *regs)
#endif #endif
} }
HE_SPIN_UNLOCK(he_dev, flags); HE_SPIN_UNLOCK(he_dev, flags);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,69)
return IRQ_RETVAL(handled); return IRQ_RETVAL(handled);
#else
return;
#endif
} }
...@@ -2454,11 +2396,7 @@ __enqueue_tpd(struct he_dev *he_dev, struct he_tpd *tpd, unsigned cid) ...@@ -2454,11 +2396,7 @@ __enqueue_tpd(struct he_dev *he_dev, struct he_tpd *tpd, unsigned cid)
tpd->vcc->pop(tpd->vcc, tpd->skb); tpd->vcc->pop(tpd->vcc, tpd->skb);
else else
dev_kfree_skb_any(tpd->skb); dev_kfree_skb_any(tpd->skb);
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,99)
++tpd->vcc->stats->tx_err;
#else
atomic_inc(&tpd->vcc->stats->tx_err); atomic_inc(&tpd->vcc->stats->tx_err);
#endif
} }
#ifdef USE_TPD_POOL #ifdef USE_TPD_POOL
pci_pool_free(he_dev->tpd_pool, tpd, TPD_ADDR(tpd->status)); pci_pool_free(he_dev->tpd_pool, tpd, TPD_ADDR(tpd->status));
...@@ -2509,11 +2447,7 @@ he_open(struct atm_vcc *vcc, short vpi, int vci) ...@@ -2509,11 +2447,7 @@ he_open(struct atm_vcc *vcc, short vpi, int vci)
HPRINTK("open vcc %p %d.%d\n", vcc, vpi, vci); HPRINTK("open vcc %p %d.%d\n", vcc, vpi, vci);
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,1)
vcc->flags |= ATM_VF_ADDR;
#else
set_bit(ATM_VF_ADDR, &vcc->flags); set_bit(ATM_VF_ADDR, &vcc->flags);
#endif
cid = he_mkcid(he_dev, vpi, vci); cid = he_mkcid(he_dev, vpi, vci);
...@@ -2528,13 +2462,8 @@ he_open(struct atm_vcc *vcc, short vpi, int vci) ...@@ -2528,13 +2462,8 @@ he_open(struct atm_vcc *vcc, short vpi, int vci)
he_vcc->pdu_len = 0; he_vcc->pdu_len = 0;
he_vcc->rc_index = -1; he_vcc->rc_index = -1;
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,1)
init_waitqueue(&he_vcc->rx_waitq);
init_waitqueue(&he_vcc->tx_waitq);
#else
init_waitqueue_head(&he_vcc->rx_waitq); init_waitqueue_head(&he_vcc->rx_waitq);
init_waitqueue_head(&he_vcc->tx_waitq); init_waitqueue_head(&he_vcc->tx_waitq);
#endif
HE_VCC(vcc) = he_vcc; HE_VCC(vcc) = he_vcc;
...@@ -2729,20 +2658,10 @@ he_open(struct atm_vcc *vcc, short vpi, int vci) ...@@ -2729,20 +2658,10 @@ he_open(struct atm_vcc *vcc, short vpi, int vci)
if (err) if (err)
{ {
if (he_vcc) kfree(he_vcc); if (he_vcc) kfree(he_vcc);
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,1)
vcc->flags &= ~ATM_VF_ADDR;
#else
clear_bit(ATM_VF_ADDR, &vcc->flags); clear_bit(ATM_VF_ADDR, &vcc->flags);
#endif
} }
else else
{
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,1)
vcc->flags |= ATM_VF_READY;
#else
set_bit(ATM_VF_READY, &vcc->flags); set_bit(ATM_VF_READY, &vcc->flags);
#endif
}
return err; return err;
} }
...@@ -2751,11 +2670,7 @@ static void ...@@ -2751,11 +2670,7 @@ static void
he_close(struct atm_vcc *vcc) he_close(struct atm_vcc *vcc)
{ {
unsigned long flags; unsigned long flags;
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,3,1)
DECLARE_WAITQUEUE(wait, current); DECLARE_WAITQUEUE(wait, current);
#else
struct wait_queue wait = { current, NULL };
#endif
struct he_dev *he_dev = HE_DEV(vcc->dev); struct he_dev *he_dev = HE_DEV(vcc->dev);
struct he_tpd *tpd; struct he_tpd *tpd;
unsigned cid; unsigned cid;
...@@ -2765,11 +2680,7 @@ he_close(struct atm_vcc *vcc) ...@@ -2765,11 +2680,7 @@ he_close(struct atm_vcc *vcc)
HPRINTK("close vcc %p %d.%d\n", vcc, vcc->vpi, vcc->vci); HPRINTK("close vcc %p %d.%d\n", vcc, vcc->vpi, vcc->vci);
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,1)
vcc->flags &= ~ATM_VF_READY;
#else
clear_bit(ATM_VF_READY, &vcc->flags); clear_bit(ATM_VF_READY, &vcc->flags);
#endif
cid = he_mkcid(he_dev, vcc->vpi, vcc->vci); cid = he_mkcid(he_dev, vcc->vpi, vcc->vci);
if (vcc->qos.rxtp.traffic_class != ATM_NONE) if (vcc->qos.rxtp.traffic_class != ATM_NONE)
...@@ -2929,11 +2840,7 @@ he_close(struct atm_vcc *vcc) ...@@ -2929,11 +2840,7 @@ he_close(struct atm_vcc *vcc)
kfree(he_vcc); kfree(he_vcc);
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,1)
vcc->flags &= ~ATM_VF_ADDR;
#else
clear_bit(ATM_VF_ADDR, &vcc->flags); clear_bit(ATM_VF_ADDR, &vcc->flags);
#endif
} }
static int static int
...@@ -2969,11 +2876,7 @@ he_send(struct atm_vcc *vcc, struct sk_buff *skb) ...@@ -2969,11 +2876,7 @@ he_send(struct atm_vcc *vcc, struct sk_buff *skb)
vcc->pop(vcc, skb); vcc->pop(vcc, skb);
else else
dev_kfree_skb_any(skb); dev_kfree_skb_any(skb);
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,99)
++vcc->stats->tx_err;
#else
atomic_inc(&vcc->stats->tx_err); atomic_inc(&vcc->stats->tx_err);
#endif
return -EINVAL; return -EINVAL;
} }
...@@ -2985,11 +2888,7 @@ he_send(struct atm_vcc *vcc, struct sk_buff *skb) ...@@ -2985,11 +2888,7 @@ he_send(struct atm_vcc *vcc, struct sk_buff *skb)
vcc->pop(vcc, skb); vcc->pop(vcc, skb);
else else
dev_kfree_skb_any(skb); dev_kfree_skb_any(skb);
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,99)
++vcc->stats->tx_err;
#else
atomic_inc(&vcc->stats->tx_err); atomic_inc(&vcc->stats->tx_err);
#endif
return -EINVAL; return -EINVAL;
} }
#endif #endif
...@@ -3002,11 +2901,7 @@ he_send(struct atm_vcc *vcc, struct sk_buff *skb) ...@@ -3002,11 +2901,7 @@ he_send(struct atm_vcc *vcc, struct sk_buff *skb)
vcc->pop(vcc, skb); vcc->pop(vcc, skb);
else else
dev_kfree_skb_any(skb); dev_kfree_skb_any(skb);
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,99)
++vcc->stats->tx_err;
#else
atomic_inc(&vcc->stats->tx_err); atomic_inc(&vcc->stats->tx_err);
#endif
HE_SPIN_UNLOCK(he_dev, flags); HE_SPIN_UNLOCK(he_dev, flags);
return -ENOMEM; return -ENOMEM;
} }
...@@ -3051,12 +2946,8 @@ he_send(struct atm_vcc *vcc, struct sk_buff *skb) ...@@ -3051,12 +2946,8 @@ he_send(struct atm_vcc *vcc, struct sk_buff *skb)
vcc->pop(vcc, skb); vcc->pop(vcc, skb);
else else
dev_kfree_skb_any(skb); dev_kfree_skb_any(skb);
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,99)
++vcc->stats->tx_err;
#else
atomic_inc(&vcc->stats->tx_err); atomic_inc(&vcc->stats->tx_err);
HE_SPIN_UNLOCK(he_dev, flags); HE_SPIN_UNLOCK(he_dev, flags);
#endif
return -ENOMEM; return -ENOMEM;
} }
tpd->status |= TPD_USERCELL; tpd->status |= TPD_USERCELL;
...@@ -3086,11 +2977,7 @@ he_send(struct atm_vcc *vcc, struct sk_buff *skb) ...@@ -3086,11 +2977,7 @@ he_send(struct atm_vcc *vcc, struct sk_buff *skb)
__enqueue_tpd(he_dev, tpd, cid); __enqueue_tpd(he_dev, tpd, cid);
HE_SPIN_UNLOCK(he_dev, flags); HE_SPIN_UNLOCK(he_dev, flags);
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,99)
++vcc->stats->tx;
#else
atomic_inc(&vcc->stats->tx); atomic_inc(&vcc->stats->tx);
#endif
return 0; return 0;
} }
...@@ -3316,6 +3203,7 @@ read_prom_byte(struct he_dev *he_dev, int addr) ...@@ -3316,6 +3203,7 @@ read_prom_byte(struct he_dev *he_dev, int addr)
return (byte_read); return (byte_read);
} }
MODULE_LICENSE("GPL");
MODULE_AUTHOR("chas williams <chas@cmf.nrl.navy.mil>"); MODULE_AUTHOR("chas williams <chas@cmf.nrl.navy.mil>");
MODULE_DESCRIPTION("ForeRunnerHE ATM Adapter driver"); MODULE_DESCRIPTION("ForeRunnerHE ATM Adapter driver");
MODULE_PARM(disable64, "h"); MODULE_PARM(disable64, "h");
...@@ -3331,7 +3219,6 @@ MODULE_PARM_DESC(irq_coalesce, "use interrupt coalescing (default 1)"); ...@@ -3331,7 +3219,6 @@ MODULE_PARM_DESC(irq_coalesce, "use interrupt coalescing (default 1)");
MODULE_PARM(sdh, "i"); MODULE_PARM(sdh, "i");
MODULE_PARM_DESC(sdh, "use SDH framing (default 0)"); MODULE_PARM_DESC(sdh, "use SDH framing (default 0)");
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,3,1)
static struct pci_device_id he_pci_tbl[] __devinitdata = { static struct pci_device_id he_pci_tbl[] __devinitdata = {
{ PCI_VENDOR_ID_FORE, PCI_DEVICE_ID_FORE_HE, PCI_ANY_ID, PCI_ANY_ID, { PCI_VENDOR_ID_FORE, PCI_DEVICE_ID_FORE_HE, PCI_ANY_ID, PCI_ANY_ID,
0, 0, 0 }, 0, 0, 0 },
...@@ -3341,11 +3228,7 @@ static struct pci_device_id he_pci_tbl[] __devinitdata = { ...@@ -3341,11 +3228,7 @@ static struct pci_device_id he_pci_tbl[] __devinitdata = {
static struct pci_driver he_driver = { static struct pci_driver he_driver = {
.name = "he", .name = "he",
.probe = he_init_one, .probe = he_init_one,
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,4,9)
.remove = __devexit_p(he_remove_one), .remove = __devexit_p(he_remove_one),
#else
.remove = he_remove_one,
#endif
.id_table = he_pci_tbl, .id_table = he_pci_tbl,
}; };
...@@ -3361,52 +3244,3 @@ static void __exit he_cleanup(void) ...@@ -3361,52 +3244,3 @@ static void __exit he_cleanup(void)
module_init(he_init); module_init(he_init);
module_exit(he_cleanup); module_exit(he_cleanup);
#else
static int __init
he_init()
{
if (!pci_present())
return -EIO;
#ifdef CONFIG_ATM_HE_USE_SUNI_MODULE
/* request_module("suni"); */
#endif
pci_dev = NULL;
while ((pci_dev = pci_find_device(PCI_VENDOR_ID_FORE,
PCI_DEVICE_ID_FORE_HE, pci_dev)) != NULL)
if (he_init_one(pci_dev, NULL) == 0)
++ndevs;
return (ndevs ? 0 : -ENODEV);
}
static void __devexit
he_cleanup(void)
{
while (he_devs)
{
struct he_dev *next = he_devs->next;
he_stop(he_devs);
atm_dev_deregister(he_devs->atm_dev);
kfree(he_devs);
he_devs = next;
}
}
int init_module(void)
{
return he_init();
}
void cleanup_module(void)
{
he_cleanup();
}
#endif
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,4,7)
MODULE_LICENSE("GPL");
#endif
...@@ -371,13 +371,8 @@ struct he_vcc ...@@ -371,13 +371,8 @@ struct he_vcc
int rc_index; int rc_index;
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,1)
struct wait_queue *rx_waitq;
atruct wait_queue *tx_waitq;
#else
wait_queue_head_t rx_waitq; wait_queue_head_t rx_waitq;
wait_queue_head_t tx_waitq; wait_queue_head_t tx_waitq;
#endif
}; };
#define HE_VCC(vcc) ((struct he_vcc *)(vcc->dev_data)) #define HE_VCC(vcc) ((struct he_vcc *)(vcc->dev_data))
......
...@@ -57,7 +57,9 @@ ...@@ -57,7 +57,9 @@
#define NP_IPV6 1 /* Internet Protocol V6 */ #define NP_IPV6 1 /* Internet Protocol V6 */
#define NP_IPX 2 /* IPX protocol */ #define NP_IPX 2 /* IPX protocol */
#define NP_AT 3 /* Appletalk protocol */ #define NP_AT 3 /* Appletalk protocol */
#define NUM_NP 4 /* Number of NPs. */ #define NP_MPLS_UC 4 /* MPLS unicast */
#define NP_MPLS_MC 5 /* MPLS multicast */
#define NUM_NP 6 /* Number of NPs. */
#define MPHDRLEN 6 /* multilink protocol header length */ #define MPHDRLEN 6 /* multilink protocol header length */
#define MPHDRLEN_SSN 4 /* ditto with short sequence numbers */ #define MPHDRLEN_SSN 4 /* ditto with short sequence numbers */
...@@ -281,6 +283,10 @@ static inline int proto_to_npindex(int proto) ...@@ -281,6 +283,10 @@ static inline int proto_to_npindex(int proto)
return NP_IPX; return NP_IPX;
case PPP_AT: case PPP_AT:
return NP_AT; return NP_AT;
case PPP_MPLS_UC:
return NP_MPLS_UC;
case PPP_MPLS_MC:
return NP_MPLS_MC;
} }
return -EINVAL; return -EINVAL;
} }
...@@ -291,6 +297,8 @@ static const int npindex_to_proto[NUM_NP] = { ...@@ -291,6 +297,8 @@ static const int npindex_to_proto[NUM_NP] = {
PPP_IPV6, PPP_IPV6,
PPP_IPX, PPP_IPX,
PPP_AT, PPP_AT,
PPP_MPLS_UC,
PPP_MPLS_MC,
}; };
/* Translates an ethertype into an NP index */ /* Translates an ethertype into an NP index */
...@@ -306,6 +314,10 @@ static inline int ethertype_to_npindex(int ethertype) ...@@ -306,6 +314,10 @@ static inline int ethertype_to_npindex(int ethertype)
case ETH_P_PPPTALK: case ETH_P_PPPTALK:
case ETH_P_ATALK: case ETH_P_ATALK:
return NP_AT; return NP_AT;
case ETH_P_MPLS_UC:
return NP_MPLS_UC;
case ETH_P_MPLS_MC:
return NP_MPLS_MC;
} }
return -1; return -1;
} }
...@@ -316,6 +328,8 @@ static const int npindex_to_ethertype[NUM_NP] = { ...@@ -316,6 +328,8 @@ static const int npindex_to_ethertype[NUM_NP] = {
ETH_P_IPV6, ETH_P_IPV6,
ETH_P_IPX, ETH_P_IPX,
ETH_P_PPPTALK, ETH_P_PPPTALK,
ETH_P_MPLS_UC,
ETH_P_MPLS_MC,
}; };
/* /*
......
...@@ -16,7 +16,6 @@ extern int dmascc_init(void); ...@@ -16,7 +16,6 @@ extern int dmascc_init(void);
extern int arcnet_init(void); extern int arcnet_init(void);
extern int scc_enet_init(void); extern int scc_enet_init(void);
extern int fec_enet_init(void); extern int fec_enet_init(void);
extern int dlci_setup(void);
extern int sdla_setup(void); extern int sdla_setup(void);
extern int sdla_c_setup(void); extern int sdla_c_setup(void);
extern int comx_init(void); extern int comx_init(void);
...@@ -51,9 +50,6 @@ static struct net_probe pci_probes[] __initdata = { ...@@ -51,9 +50,6 @@ static struct net_probe pci_probes[] __initdata = {
#if defined(CONFIG_DMASCC) #if defined(CONFIG_DMASCC)
{dmascc_init, 0}, {dmascc_init, 0},
#endif #endif
#if defined(CONFIG_DLCI)
{dlci_setup, 0},
#endif
#if defined(CONFIG_SDLA) #if defined(CONFIG_SDLA)
{sdla_c_setup, 0}, {sdla_c_setup, 0},
#endif #endif
......
...@@ -539,6 +539,8 @@ static void init_dev(struct net_device *dev, u_long iobase) ...@@ -539,6 +539,8 @@ static void init_dev(struct net_device *dev, u_long iobase)
dev->header_cache_update = NULL; /* not supported */ dev->header_cache_update = NULL; /* not supported */
dev->change_mtu = NULL; /* set in fddi_setup() */ dev->change_mtu = NULL; /* set in fddi_setup() */
SET_MODULE_OWNER(dev);
/* Initialize remaining device structure information */ /* Initialize remaining device structure information */
fddi_setup(dev); fddi_setup(dev);
} // init_device } // init_device
...@@ -791,8 +793,6 @@ static int skfp_open(struct net_device *dev) ...@@ -791,8 +793,6 @@ static int skfp_open(struct net_device *dev)
smt_online(smc, 1); smt_online(smc, 1);
STI_FBI(); STI_FBI();
MOD_INC_USE_COUNT;
/* Clear local multicast address tables */ /* Clear local multicast address tables */
mac_clear_multicast(smc); mac_clear_multicast(smc);
...@@ -854,8 +854,6 @@ static int skfp_close(struct net_device *dev) ...@@ -854,8 +854,6 @@ static int skfp_close(struct net_device *dev)
dev_kfree_skb(skb); dev_kfree_skb(skb);
} }
MOD_DEC_USE_COUNT;
return (0); return (0);
} // skfp_close } // skfp_close
......
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
#include <linux/ptrace.h> #include <linux/ptrace.h>
#include <linux/ioport.h> #include <linux/ioport.h>
#include <linux/in.h> #include <linux/in.h>
#include <linux/init.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/string.h> #include <linux/string.h>
#include <linux/init.h> #include <linux/init.h>
...@@ -577,9 +578,10 @@ int dlci_init(struct net_device *dev) ...@@ -577,9 +578,10 @@ int dlci_init(struct net_device *dev)
return(0); return(0);
} }
int __init dlci_setup(void) int __init init_dlci(void)
{ {
int i; int i;
dlci_ioctl_set(dlci_ioctl);
printk("%s.\n", version); printk("%s.\n", version);
...@@ -589,25 +591,16 @@ int __init dlci_setup(void) ...@@ -589,25 +591,16 @@ int __init dlci_setup(void)
for(i=0;i<sizeof(basename) / sizeof(char *);i++) for(i=0;i<sizeof(basename) / sizeof(char *);i++)
basename[i] = NULL; basename[i] = NULL;
return(0); return 0;
} }
#ifdef MODULE void __exit dlci_exit(void)
extern int (*dlci_ioctl_hook)(unsigned int, void *);
int init_module(void)
{ {
dlci_ioctl_hook = dlci_ioctl; dlci_ioctl_set(NULL);
return(dlci_setup());
} }
void cleanup_module(void) module_init(init_dlci);
{ module_exit(dlci_exit);
dlci_ioctl_hook = NULL;
}
#endif /* MODULE */
MODULE_AUTHOR("Mike McLagan"); MODULE_AUTHOR("Mike McLagan");
MODULE_DESCRIPTION("Frame Relay DLCI layer"); MODULE_DESCRIPTION("Frame Relay DLCI layer");
......
...@@ -61,6 +61,8 @@ ...@@ -61,6 +61,8 @@
#define ETH_P_IPV6 0x86DD /* IPv6 over bluebook */ #define ETH_P_IPV6 0x86DD /* IPv6 over bluebook */
#define ETH_P_PPP_DISC 0x8863 /* PPPoE discovery messages */ #define ETH_P_PPP_DISC 0x8863 /* PPPoE discovery messages */
#define ETH_P_PPP_SES 0x8864 /* PPPoE session messages */ #define ETH_P_PPP_SES 0x8864 /* PPPoE session messages */
#define ETH_P_MPLS_UC 0x8847 /* MPLS Unicast traffic */
#define ETH_P_MPLS_MC 0x8848 /* MPLS Multicast traffic */
#define ETH_P_ATMMPOA 0x884c /* MultiProtocol Over ATM */ #define ETH_P_ATMMPOA 0x884c /* MultiProtocol Over ATM */
#define ETH_P_ATMFATE 0x8884 /* Frame-based ATM Transport #define ETH_P_ATMFATE 0x8884 /* Frame-based ATM Transport
* over Ethernet * over Ethernet
......
...@@ -192,7 +192,7 @@ struct frad_local ...@@ -192,7 +192,7 @@ struct frad_local
int register_frad(const char *name); int register_frad(const char *name);
int unregister_frad(const char *name); int unregister_frad(const char *name);
extern int (*dlci_ioctl_hook)(unsigned int, void *); extern void dlci_ioctl_set(int (*hook)(unsigned int, void *));
#endif /* __KERNEL__ */ #endif /* __KERNEL__ */
......
...@@ -74,12 +74,15 @@ ...@@ -74,12 +74,15 @@
#define PPP_IPV6 0x57 /* Internet Protocol Version 6 */ #define PPP_IPV6 0x57 /* Internet Protocol Version 6 */
#define PPP_COMPFRAG 0xfb /* fragment compressed below bundle */ #define PPP_COMPFRAG 0xfb /* fragment compressed below bundle */
#define PPP_COMP 0xfd /* compressed packet */ #define PPP_COMP 0xfd /* compressed packet */
#define PPP_MPLS_UC 0x0281 /* Multi Protocol Label Switching - Unicast */
#define PPP_MPLS_MC 0x0283 /* Multi Protocol Label Switching - Multicast */
#define PPP_IPCP 0x8021 /* IP Control Protocol */ #define PPP_IPCP 0x8021 /* IP Control Protocol */
#define PPP_ATCP 0x8029 /* AppleTalk Control Protocol */ #define PPP_ATCP 0x8029 /* AppleTalk Control Protocol */
#define PPP_IPXCP 0x802b /* IPX Control Protocol */ #define PPP_IPXCP 0x802b /* IPX Control Protocol */
#define PPP_IPV6CP 0x8057 /* IPv6 Control Protocol */ #define PPP_IPV6CP 0x8057 /* IPv6 Control Protocol */
#define PPP_CCPFRAG 0x80fb /* CCP at link level (below MP bundle) */ #define PPP_CCPFRAG 0x80fb /* CCP at link level (below MP bundle) */
#define PPP_CCP 0x80fd /* Compression Control Protocol */ #define PPP_CCP 0x80fd /* Compression Control Protocol */
#define PPP_MPLSCP 0x80fd /* MPLS Control Protocol */
#define PPP_LCP 0xc021 /* Link Control Protocol */ #define PPP_LCP 0xc021 /* Link Control Protocol */
#define PPP_PAP 0xc023 /* Password Authentication Protocol */ #define PPP_PAP 0xc023 /* Password Authentication Protocol */
#define PPP_LQR 0xc025 /* Link Quality Report protocol */ #define PPP_LQR 0xc025 /* Link Quality Report protocol */
......
...@@ -201,9 +201,10 @@ enum rtattr_type_t ...@@ -201,9 +201,10 @@ enum rtattr_type_t
RTA_FLOW, RTA_FLOW,
RTA_CACHEINFO, RTA_CACHEINFO,
RTA_SESSION, RTA_SESSION,
RTA_HOPLIMIT,
}; };
#define RTA_MAX RTA_SESSION #define RTA_MAX RTA_HOPLIMIT
#define RTM_RTA(r) ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct rtmsg)))) #define RTM_RTA(r) ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct rtmsg))))
#define RTM_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct rtmsg)) #define RTM_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct rtmsg))
......
#ifndef _NET_DN_FIB_H #ifndef _NET_DN_FIB_H
#define _NET_DN_FIB_H #define _NET_DN_FIB_H
/* WARNING: The ordering of these elements must match ordering
* of RTA_* rtnetlink attribute numbers.
*/
struct dn_kern_rta struct dn_kern_rta
{ {
void *rta_dst; void *rta_dst;
...@@ -13,8 +16,10 @@ struct dn_kern_rta ...@@ -13,8 +16,10 @@ struct dn_kern_rta
struct rtattr *rta_mx; struct rtattr *rta_mx;
struct rtattr *rta_mp; struct rtattr *rta_mp;
unsigned char *rta_protoinfo; unsigned char *rta_protoinfo;
unsigned char *rta_flow; u32 *rta_flow;
struct rta_cacheinfo *rta_ci; struct rta_cacheinfo *rta_ci;
struct rta_session *rta_sess;
u8 *rta_hoplimit;
}; };
struct dn_fib_res { struct dn_fib_res {
......
...@@ -163,10 +163,12 @@ extern int fib6_walk_continue(struct fib6_walker_t *w); ...@@ -163,10 +163,12 @@ extern int fib6_walk_continue(struct fib6_walker_t *w);
extern int fib6_add(struct fib6_node *root, extern int fib6_add(struct fib6_node *root,
struct rt6_info *rt, struct rt6_info *rt,
struct nlmsghdr *nlh); struct nlmsghdr *nlh,
void *rtattr);
extern int fib6_del(struct rt6_info *rt, extern int fib6_del(struct rt6_info *rt,
struct nlmsghdr *nlh); struct nlmsghdr *nlh,
void *rtattr);
extern void inet6_rt_notify(int event, struct rt6_info *rt, extern void inet6_rt_notify(int event, struct rt6_info *rt,
struct nlmsghdr *nlh); struct nlmsghdr *nlh);
......
...@@ -38,9 +38,11 @@ extern void ip6_route_cleanup(void); ...@@ -38,9 +38,11 @@ extern void ip6_route_cleanup(void);
extern int ipv6_route_ioctl(unsigned int cmd, void *arg); extern int ipv6_route_ioctl(unsigned int cmd, void *arg);
extern int ip6_route_add(struct in6_rtmsg *rtmsg, extern int ip6_route_add(struct in6_rtmsg *rtmsg,
struct nlmsghdr *); struct nlmsghdr *,
void *rtattr);
extern int ip6_del_rt(struct rt6_info *, extern int ip6_del_rt(struct rt6_info *,
struct nlmsghdr *); struct nlmsghdr *,
void *rtattr);
extern int ip6_rt_addr_add(struct in6_addr *addr, extern int ip6_rt_addr_add(struct in6_addr *addr,
struct net_device *dev); struct net_device *dev);
......
...@@ -20,6 +20,9 @@ ...@@ -20,6 +20,9 @@
#include <net/flow.h> #include <net/flow.h>
#include <linux/seq_file.h> #include <linux/seq_file.h>
/* WARNING: The ordering of these elements must match ordering
* of RTA_* rtnetlink attribute numbers.
*/
struct kern_rta struct kern_rta
{ {
void *rta_dst; void *rta_dst;
...@@ -32,8 +35,10 @@ struct kern_rta ...@@ -32,8 +35,10 @@ struct kern_rta
struct rtattr *rta_mx; struct rtattr *rta_mx;
struct rtattr *rta_mp; struct rtattr *rta_mp;
unsigned char *rta_protoinfo; unsigned char *rta_protoinfo;
unsigned char *rta_flow; u32 *rta_flow;
struct rta_cacheinfo *rta_ci; struct rta_cacheinfo *rta_ci;
struct rta_session *rta_sess;
u8 *rta_hoplimit;
}; };
struct fib_nh struct fib_nh
......
...@@ -27,8 +27,6 @@ ...@@ -27,8 +27,6 @@
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <net/compat.h> #include <net/compat.h>
#define AA(__x) ((unsigned long)(__x))
static inline int iov_from_user_compat_to_kern(struct iovec *kiov, static inline int iov_from_user_compat_to_kern(struct iovec *kiov,
struct compat_iovec *uiov32, struct compat_iovec *uiov32,
int niov) int niov)
...@@ -393,31 +391,27 @@ static int do_set_attach_filter(int fd, int level, int optname, ...@@ -393,31 +391,27 @@ static int do_set_attach_filter(int fd, int level, int optname,
struct compat_sock_fprog *fprog32 = (struct compat_sock_fprog *)optval; struct compat_sock_fprog *fprog32 = (struct compat_sock_fprog *)optval;
struct sock_fprog kfprog; struct sock_fprog kfprog;
mm_segment_t old_fs; mm_segment_t old_fs;
compat_uptr_t uptr;
unsigned int fsize;
int ret; int ret;
compat_uptr_t ptr;
if (!access_ok(VERIFY_READ, fprog32, sizeof(*fprog32)) || if (!access_ok(VERIFY_READ, fprog32, sizeof(*fprog32)) ||
__get_user(kfprog.len, &fprog32->len) || __get_user(kfprog.len, &fprog32->len) ||
__get_user(uptr, &fprog32->filter)) __get_user(ptr, &fprog32->filter))
return -EFAULT; return -EFAULT;
kfprog.filter = compat_ptr(ptr);
fsize = kfprog.len * sizeof(struct sock_filter); if (kfprog.len * sizeof(struct sock_filter) < kfprog.len)
kfprog.filter = (struct sock_filter *)kmalloc(fsize, GFP_KERNEL); return -EINVAL;
if (kfprog.filter == NULL)
return -ENOMEM; if (verify_area(VERIFY_READ, kfprog.filter,
if (copy_from_user(kfprog.filter, compat_ptr(uptr), fsize)) { kfprog.len * sizeof(struct sock_filter)))
kfree(kfprog.filter);
return -EFAULT; return -EFAULT;
}
old_fs = get_fs(); old_fs = get_fs();
set_fs(KERNEL_DS); set_fs(KERNEL_DS);
ret = sys_setsockopt(fd, level, optname, ret = sys_setsockopt(fd, level, optname,
(char *)&kfprog, sizeof(kfprog)); (char *)&kfprog, sizeof(kfprog));
set_fs(old_fs); set_fs(old_fs);
kfree(kfprog.filter);
return ret; return ret;
} }
......
...@@ -35,7 +35,7 @@ extern unsigned int ...@@ -35,7 +35,7 @@ extern unsigned int
do_masquerade(struct sk_buff **pskb, const struct net_device *dev); do_masquerade(struct sk_buff **pskb, const struct net_device *dev);
extern unsigned int extern unsigned int
check_for_masq_error(struct sk_buff *pskb); check_for_masq_error(struct sk_buff **pskb);
extern unsigned int extern unsigned int
check_for_demasq(struct sk_buff **pskb); check_for_demasq(struct sk_buff **pskb);
...@@ -167,7 +167,7 @@ fw_in(unsigned int hooknum, ...@@ -167,7 +167,7 @@ fw_in(unsigned int hooknum,
/* Handle ICMP errors from client here */ /* Handle ICMP errors from client here */
if ((*pskb)->nh.iph->protocol == IPPROTO_ICMP if ((*pskb)->nh.iph->protocol == IPPROTO_ICMP
&& (*pskb)->nfct) && (*pskb)->nfct)
check_for_masq_error(*pskb); check_for_masq_error(pskb);
} }
return NF_ACCEPT; return NF_ACCEPT;
......
...@@ -103,19 +103,19 @@ do_masquerade(struct sk_buff **pskb, const struct net_device *dev) ...@@ -103,19 +103,19 @@ do_masquerade(struct sk_buff **pskb, const struct net_device *dev)
} }
void void
check_for_masq_error(struct sk_buff *skb) check_for_masq_error(struct sk_buff **pskb)
{ {
enum ip_conntrack_info ctinfo; enum ip_conntrack_info ctinfo;
struct ip_conntrack *ct; struct ip_conntrack *ct;
ct = ip_conntrack_get(skb, &ctinfo); ct = ip_conntrack_get(*pskb, &ctinfo);
/* Wouldn't be here if not tracked already => masq'ed ICMP /* Wouldn't be here if not tracked already => masq'ed ICMP
ping or error related to masq'd connection */ ping or error related to masq'd connection */
IP_NF_ASSERT(ct); IP_NF_ASSERT(ct);
if (ctinfo == IP_CT_RELATED) { if (ctinfo == IP_CT_RELATED) {
icmp_reply_translation(skb, ct, NF_IP_PRE_ROUTING, icmp_reply_translation(pskb, ct, NF_IP_PRE_ROUTING,
CTINFO2DIR(ctinfo)); CTINFO2DIR(ctinfo));
icmp_reply_translation(skb, ct, NF_IP_POST_ROUTING, icmp_reply_translation(pskb, ct, NF_IP_POST_ROUTING,
CTINFO2DIR(ctinfo)); CTINFO2DIR(ctinfo));
} }
} }
...@@ -152,10 +152,10 @@ check_for_demasq(struct sk_buff **pskb) ...@@ -152,10 +152,10 @@ check_for_demasq(struct sk_buff **pskb)
&& skb_linearize(*pskb, GFP_ATOMIC) != 0) && skb_linearize(*pskb, GFP_ATOMIC) != 0)
return NF_DROP; return NF_DROP;
icmp_reply_translation(*pskb, ct, icmp_reply_translation(pskb, ct,
NF_IP_PRE_ROUTING, NF_IP_PRE_ROUTING,
CTINFO2DIR(ctinfo)); CTINFO2DIR(ctinfo));
icmp_reply_translation(*pskb, ct, icmp_reply_translation(pskb, ct,
NF_IP_POST_ROUTING, NF_IP_POST_ROUTING,
CTINFO2DIR(ctinfo)); CTINFO2DIR(ctinfo));
} }
......
...@@ -773,9 +773,9 @@ do_bindings(struct ip_conntrack *ct, ...@@ -773,9 +773,9 @@ do_bindings(struct ip_conntrack *ct,
? "SRC" : "DST", ? "SRC" : "DST",
NIPQUAD(info->manips[i].manip.ip), NIPQUAD(info->manips[i].manip.ip),
htons(info->manips[i].manip.u.all)); htons(info->manips[i].manip.u.all));
if (manip_pkt(proto, pskb, 0, if (!manip_pkt(proto, pskb, 0,
&info->manips[i].manip, &info->manips[i].manip,
info->manips[i].maniptype) < 0) { info->manips[i].maniptype)) {
READ_UNLOCK(&ip_nat_lock); READ_UNLOCK(&ip_nat_lock);
return NF_DROP; return NF_DROP;
} }
...@@ -927,11 +927,11 @@ icmp_reply_translation(struct sk_buff **pskb, ...@@ -927,11 +927,11 @@ icmp_reply_translation(struct sk_buff **pskb,
? "DST" : "SRC", ? "DST" : "SRC",
NIPQUAD(info->manips[i].manip.ip), NIPQUAD(info->manips[i].manip.ip),
ntohs(info->manips[i].manip.u.udp.port)); ntohs(info->manips[i].manip.u.udp.port));
if (manip_pkt(inside->ip.protocol, pskb, if (!manip_pkt(inside->ip.protocol, pskb,
(*pskb)->nh.iph->ihl*4 (*pskb)->nh.iph->ihl*4
+ sizeof(inside->icmp), + sizeof(inside->icmp),
&info->manips[i].manip, &info->manips[i].manip,
!info->manips[i].maniptype) < 0) !info->manips[i].maniptype))
goto unlock_fail; goto unlock_fail;
/* Outer packet needs to have IP header NATed like /* Outer packet needs to have IP header NATed like
...@@ -943,9 +943,9 @@ icmp_reply_translation(struct sk_buff **pskb, ...@@ -943,9 +943,9 @@ icmp_reply_translation(struct sk_buff **pskb,
info->manips[i].maniptype == IP_NAT_MANIP_SRC info->manips[i].maniptype == IP_NAT_MANIP_SRC
? "SRC" : "DST", ? "SRC" : "DST",
NIPQUAD(info->manips[i].manip.ip)); NIPQUAD(info->manips[i].manip.ip));
if (manip_pkt(0, pskb, 0, if (!manip_pkt(0, pskb, 0,
&info->manips[i].manip, &info->manips[i].manip,
info->manips[i].maniptype) < 0) info->manips[i].maniptype))
goto unlock_fail; goto unlock_fail;
} }
} }
......
...@@ -1210,7 +1210,7 @@ addrconf_prefix_route(struct in6_addr *pfx, int plen, struct net_device *dev, ...@@ -1210,7 +1210,7 @@ addrconf_prefix_route(struct in6_addr *pfx, int plen, struct net_device *dev,
if (dev->type == ARPHRD_SIT && (dev->flags&IFF_POINTOPOINT)) if (dev->type == ARPHRD_SIT && (dev->flags&IFF_POINTOPOINT))
rtmsg.rtmsg_flags |= RTF_NONEXTHOP; rtmsg.rtmsg_flags |= RTF_NONEXTHOP;
ip6_route_add(&rtmsg, NULL); ip6_route_add(&rtmsg, NULL, NULL);
} }
/* Create "default" multicast route to the interface */ /* Create "default" multicast route to the interface */
...@@ -1227,7 +1227,7 @@ static void addrconf_add_mroute(struct net_device *dev) ...@@ -1227,7 +1227,7 @@ static void addrconf_add_mroute(struct net_device *dev)
rtmsg.rtmsg_ifindex = dev->ifindex; rtmsg.rtmsg_ifindex = dev->ifindex;
rtmsg.rtmsg_flags = RTF_UP|RTF_ADDRCONF; rtmsg.rtmsg_flags = RTF_UP|RTF_ADDRCONF;
rtmsg.rtmsg_type = RTMSG_NEWROUTE; rtmsg.rtmsg_type = RTMSG_NEWROUTE;
ip6_route_add(&rtmsg, NULL); ip6_route_add(&rtmsg, NULL, NULL);
} }
static void sit_route_add(struct net_device *dev) static void sit_route_add(struct net_device *dev)
...@@ -1244,7 +1244,7 @@ static void sit_route_add(struct net_device *dev) ...@@ -1244,7 +1244,7 @@ static void sit_route_add(struct net_device *dev)
rtmsg.rtmsg_flags = RTF_UP|RTF_NONEXTHOP; rtmsg.rtmsg_flags = RTF_UP|RTF_NONEXTHOP;
rtmsg.rtmsg_ifindex = dev->ifindex; rtmsg.rtmsg_ifindex = dev->ifindex;
ip6_route_add(&rtmsg, NULL); ip6_route_add(&rtmsg, NULL, NULL);
} }
static void addrconf_add_lroute(struct net_device *dev) static void addrconf_add_lroute(struct net_device *dev)
...@@ -1336,7 +1336,7 @@ void addrconf_prefix_rcv(struct net_device *dev, u8 *opt, int len) ...@@ -1336,7 +1336,7 @@ void addrconf_prefix_rcv(struct net_device *dev, u8 *opt, int len)
if (rt && ((rt->rt6i_flags & (RTF_GATEWAY | RTF_DEFAULT)) == 0)) { if (rt && ((rt->rt6i_flags & (RTF_GATEWAY | RTF_DEFAULT)) == 0)) {
if (rt->rt6i_flags&RTF_EXPIRES) { if (rt->rt6i_flags&RTF_EXPIRES) {
if (pinfo->onlink == 0 || valid_lft == 0) { if (pinfo->onlink == 0 || valid_lft == 0) {
ip6_del_rt(rt, NULL); ip6_del_rt(rt, NULL, NULL);
rt = NULL; rt = NULL;
} else { } else {
rt->rt6i_expires = rt_expires; rt->rt6i_expires = rt_expires;
...@@ -1960,7 +1960,7 @@ static void addrconf_rs_timer(unsigned long data) ...@@ -1960,7 +1960,7 @@ static void addrconf_rs_timer(unsigned long data)
rtmsg.rtmsg_ifindex = ifp->idev->dev->ifindex; rtmsg.rtmsg_ifindex = ifp->idev->dev->ifindex;
ip6_route_add(&rtmsg, NULL); ip6_route_add(&rtmsg, NULL, NULL);
} }
out: out:
......
...@@ -502,7 +502,7 @@ static __inline__ void fib6_start_gc(struct rt6_info *rt) ...@@ -502,7 +502,7 @@ static __inline__ void fib6_start_gc(struct rt6_info *rt)
* with source addr info in sub-trees * with source addr info in sub-trees
*/ */
int fib6_add(struct fib6_node *root, struct rt6_info *rt, struct nlmsghdr *nlh) int fib6_add(struct fib6_node *root, struct rt6_info *rt, struct nlmsghdr *nlh, void *_rtattr)
{ {
struct fib6_node *fn; struct fib6_node *fn;
int err = -ENOMEM; int err = -ENOMEM;
...@@ -884,7 +884,7 @@ static struct fib6_node * fib6_repair_tree(struct fib6_node *fn) ...@@ -884,7 +884,7 @@ static struct fib6_node * fib6_repair_tree(struct fib6_node *fn)
} }
static void fib6_del_route(struct fib6_node *fn, struct rt6_info **rtp, static void fib6_del_route(struct fib6_node *fn, struct rt6_info **rtp,
struct nlmsghdr *nlh) struct nlmsghdr *nlh, void *_rtattr)
{ {
struct fib6_walker_t *w; struct fib6_walker_t *w;
struct rt6_info *rt = *rtp; struct rt6_info *rt = *rtp;
...@@ -943,7 +943,7 @@ static void fib6_del_route(struct fib6_node *fn, struct rt6_info **rtp, ...@@ -943,7 +943,7 @@ static void fib6_del_route(struct fib6_node *fn, struct rt6_info **rtp,
rt6_release(rt); rt6_release(rt);
} }
int fib6_del(struct rt6_info *rt, struct nlmsghdr *nlh) int fib6_del(struct rt6_info *rt, struct nlmsghdr *nlh, void *_rtattr)
{ {
struct fib6_node *fn = rt->rt6i_node; struct fib6_node *fn = rt->rt6i_node;
struct rt6_info **rtp; struct rt6_info **rtp;
...@@ -968,7 +968,7 @@ int fib6_del(struct rt6_info *rt, struct nlmsghdr *nlh) ...@@ -968,7 +968,7 @@ int fib6_del(struct rt6_info *rt, struct nlmsghdr *nlh)
for (rtp = &fn->leaf; *rtp; rtp = &(*rtp)->u.next) { for (rtp = &fn->leaf; *rtp; rtp = &(*rtp)->u.next) {
if (*rtp == rt) { if (*rtp == rt) {
fib6_del_route(fn, rtp, nlh); fib6_del_route(fn, rtp, nlh, _rtattr);
return 0; return 0;
} }
} }
...@@ -1097,7 +1097,7 @@ static int fib6_clean_node(struct fib6_walker_t *w) ...@@ -1097,7 +1097,7 @@ static int fib6_clean_node(struct fib6_walker_t *w)
res = c->func(rt, c->arg); res = c->func(rt, c->arg);
if (res < 0) { if (res < 0) {
w->leaf = rt; w->leaf = rt;
res = fib6_del(rt, NULL); res = fib6_del(rt, NULL, NULL);
if (res) { if (res) {
#if RT6_DEBUG >= 2 #if RT6_DEBUG >= 2
printk(KERN_DEBUG "fib6_clean_node: del failed: rt=%p@%p err=%d\n", rt, rt->rt6i_node, res); printk(KERN_DEBUG "fib6_clean_node: del failed: rt=%p@%p err=%d\n", rt, rt->rt6i_node, res);
......
...@@ -976,7 +976,7 @@ void ndisc_recv_na(struct sk_buff *skb) ...@@ -976,7 +976,7 @@ void ndisc_recv_na(struct sk_buff *skb)
struct rt6_info *rt; struct rt6_info *rt;
rt = rt6_get_dflt_router(saddr, dev); rt = rt6_get_dflt_router(saddr, dev);
if (rt) if (rt)
ip6_del_rt(rt, NULL); ip6_del_rt(rt, NULL, NULL);
} }
} else { } else {
if (msg->icmph.icmp6_router) if (msg->icmph.icmp6_router)
...@@ -1050,7 +1050,7 @@ static void ndisc_router_discovery(struct sk_buff *skb) ...@@ -1050,7 +1050,7 @@ static void ndisc_router_discovery(struct sk_buff *skb)
rt = rt6_get_dflt_router(&skb->nh.ipv6h->saddr, skb->dev); rt = rt6_get_dflt_router(&skb->nh.ipv6h->saddr, skb->dev);
if (rt && lifetime == 0) { if (rt && lifetime == 0) {
ip6_del_rt(rt, NULL); ip6_del_rt(rt, NULL, NULL);
rt = NULL; rt = NULL;
} }
......
...@@ -324,12 +324,12 @@ struct rt6_info *rt6_lookup(struct in6_addr *daddr, struct in6_addr *saddr, ...@@ -324,12 +324,12 @@ struct rt6_info *rt6_lookup(struct in6_addr *daddr, struct in6_addr *saddr,
be destroyed. be destroyed.
*/ */
static int rt6_ins(struct rt6_info *rt, struct nlmsghdr *nlh) static int rt6_ins(struct rt6_info *rt, struct nlmsghdr *nlh, void *_rtattr)
{ {
int err; int err;
write_lock_bh(&rt6_lock); write_lock_bh(&rt6_lock);
err = fib6_add(&ip6_routing_table, rt, nlh); err = fib6_add(&ip6_routing_table, rt, nlh, _rtattr);
write_unlock_bh(&rt6_lock); write_unlock_bh(&rt6_lock);
return err; return err;
...@@ -372,7 +372,7 @@ static struct rt6_info *rt6_cow(struct rt6_info *ort, struct in6_addr *daddr, ...@@ -372,7 +372,7 @@ static struct rt6_info *rt6_cow(struct rt6_info *ort, struct in6_addr *daddr,
dst_hold(&rt->u.dst); dst_hold(&rt->u.dst);
err = rt6_ins(rt, NULL); err = rt6_ins(rt, NULL, NULL);
if (err == 0) if (err == 0)
return rt; return rt;
...@@ -526,7 +526,7 @@ static struct dst_entry *ip6_negative_advice(struct dst_entry *dst) ...@@ -526,7 +526,7 @@ static struct dst_entry *ip6_negative_advice(struct dst_entry *dst)
if (rt) { if (rt) {
if (rt->rt6i_flags & RTF_CACHE) if (rt->rt6i_flags & RTF_CACHE)
ip6_del_rt(rt, NULL); ip6_del_rt(rt, NULL, NULL);
else else
dst_release(dst); dst_release(dst);
} }
...@@ -629,14 +629,17 @@ static int ipv6_get_hoplimit(struct net_device *dev) ...@@ -629,14 +629,17 @@ static int ipv6_get_hoplimit(struct net_device *dev)
* *
*/ */
int ip6_route_add(struct in6_rtmsg *rtmsg, struct nlmsghdr *nlh) int ip6_route_add(struct in6_rtmsg *rtmsg, struct nlmsghdr *nlh, void *_rtattr)
{ {
int err; int err;
struct rtmsg *r; struct rtmsg *r;
struct rtattr **rta;
struct rt6_info *rt; struct rt6_info *rt;
struct net_device *dev = NULL; struct net_device *dev = NULL;
int addr_type; int addr_type;
rta = (struct rtattr **) _rtattr;
if (rtmsg->rtmsg_dst_len > 128 || rtmsg->rtmsg_src_len > 128) if (rtmsg->rtmsg_dst_len > 128 || rtmsg->rtmsg_src_len > 128)
return -EINVAL; return -EINVAL;
#ifndef CONFIG_IPV6_SUBTREES #ifndef CONFIG_IPV6_SUBTREES
...@@ -768,13 +771,38 @@ int ip6_route_add(struct in6_rtmsg *rtmsg, struct nlmsghdr *nlh) ...@@ -768,13 +771,38 @@ int ip6_route_add(struct in6_rtmsg *rtmsg, struct nlmsghdr *nlh)
if (ipv6_addr_is_multicast(&rt->rt6i_dst.addr)) if (ipv6_addr_is_multicast(&rt->rt6i_dst.addr))
rt->rt6i_hoplimit = IPV6_DEFAULT_MCASTHOPS; rt->rt6i_hoplimit = IPV6_DEFAULT_MCASTHOPS;
else if (rta && rta[RTA_HOPLIMIT-1])
memcpy(&rt->rt6i_hoplimit, RTA_DATA(rta[RTA_HOPLIMIT-1]), 1);
else else
rt->rt6i_hoplimit = ipv6_get_hoplimit(dev); rt->rt6i_hoplimit = ipv6_get_hoplimit(dev);
rt->rt6i_flags = rtmsg->rtmsg_flags; rt->rt6i_flags = rtmsg->rtmsg_flags;
install_route: install_route:
if (rta && rta[RTA_METRICS-1]) {
int attrlen = RTA_PAYLOAD(rta[RTA_METRICS-1]);
struct rtattr *attr = RTA_DATA(rta[RTA_METRICS-1]);
while (RTA_OK(attr, attrlen)) {
unsigned flavor = attr->rta_type;
if (flavor) {
if (flavor > RTAX_MAX) {
err = -EINVAL;
goto out;
}
rt->u.dst.metrics[flavor-1] =
*(u32 *)RTA_DATA(attr);
}
attr = RTA_NEXT(attr, attrlen);
}
}
if (!rt->u.dst.metrics[RTAX_MTU-1])
rt->u.dst.metrics[RTAX_MTU-1] = ipv6_get_mtu(dev); rt->u.dst.metrics[RTAX_MTU-1] = ipv6_get_mtu(dev);
rt->u.dst.metrics[RTAX_ADVMSS-1] = max_t(unsigned int, dst_pmtu(&rt->u.dst) - 60, ip6_rt_min_advmss); if (!rt->u.dst.metrics[RTAX_ADVMSS-1])
rt->u.dst.metrics[RTAX_ADVMSS-1] =
max_t(unsigned int, dst_pmtu(&rt->u.dst) - 60,
ip6_rt_min_advmss);
/* Maximal non-jumbo IPv6 payload is 65535 and corresponding /* Maximal non-jumbo IPv6 payload is 65535 and corresponding
MSS is 65535 - tcp_header_size. 65535 is also valid and MSS is 65535 - tcp_header_size. 65535 is also valid and
means: "any MSS, rely only on pmtu discovery" means: "any MSS, rely only on pmtu discovery"
...@@ -782,7 +810,7 @@ int ip6_route_add(struct in6_rtmsg *rtmsg, struct nlmsghdr *nlh) ...@@ -782,7 +810,7 @@ int ip6_route_add(struct in6_rtmsg *rtmsg, struct nlmsghdr *nlh)
if (dst_metric(&rt->u.dst, RTAX_ADVMSS) > 65535-20) if (dst_metric(&rt->u.dst, RTAX_ADVMSS) > 65535-20)
rt->u.dst.metrics[RTAX_ADVMSS-1] = 65535; rt->u.dst.metrics[RTAX_ADVMSS-1] = 65535;
rt->u.dst.dev = dev; rt->u.dst.dev = dev;
return rt6_ins(rt, nlh); return rt6_ins(rt, nlh, _rtattr);
out: out:
if (dev) if (dev)
...@@ -791,7 +819,7 @@ int ip6_route_add(struct in6_rtmsg *rtmsg, struct nlmsghdr *nlh) ...@@ -791,7 +819,7 @@ int ip6_route_add(struct in6_rtmsg *rtmsg, struct nlmsghdr *nlh)
return err; return err;
} }
int ip6_del_rt(struct rt6_info *rt, struct nlmsghdr *nlh) int ip6_del_rt(struct rt6_info *rt, struct nlmsghdr *nlh, void *_rtattr)
{ {
int err; int err;
...@@ -803,13 +831,13 @@ int ip6_del_rt(struct rt6_info *rt, struct nlmsghdr *nlh) ...@@ -803,13 +831,13 @@ int ip6_del_rt(struct rt6_info *rt, struct nlmsghdr *nlh)
dst_release(&rt->u.dst); dst_release(&rt->u.dst);
err = fib6_del(rt, nlh); err = fib6_del(rt, nlh, _rtattr);
write_unlock_bh(&rt6_lock); write_unlock_bh(&rt6_lock);
return err; return err;
} }
static int ip6_route_del(struct in6_rtmsg *rtmsg, struct nlmsghdr *nlh) static int ip6_route_del(struct in6_rtmsg *rtmsg, struct nlmsghdr *nlh, void *_rtattr)
{ {
struct fib6_node *fn; struct fib6_node *fn;
struct rt6_info *rt; struct rt6_info *rt;
...@@ -836,7 +864,7 @@ static int ip6_route_del(struct in6_rtmsg *rtmsg, struct nlmsghdr *nlh) ...@@ -836,7 +864,7 @@ static int ip6_route_del(struct in6_rtmsg *rtmsg, struct nlmsghdr *nlh)
dst_hold(&rt->u.dst); dst_hold(&rt->u.dst);
read_unlock_bh(&rt6_lock); read_unlock_bh(&rt6_lock);
return ip6_del_rt(rt, nlh); return ip6_del_rt(rt, nlh, _rtattr);
} }
} }
read_unlock_bh(&rt6_lock); read_unlock_bh(&rt6_lock);
...@@ -938,11 +966,11 @@ void rt6_redirect(struct in6_addr *dest, struct in6_addr *saddr, ...@@ -938,11 +966,11 @@ void rt6_redirect(struct in6_addr *dest, struct in6_addr *saddr,
nrt->u.dst.metrics[RTAX_ADVMSS-1] = 65535; nrt->u.dst.metrics[RTAX_ADVMSS-1] = 65535;
nrt->rt6i_hoplimit = ipv6_get_hoplimit(neigh->dev); nrt->rt6i_hoplimit = ipv6_get_hoplimit(neigh->dev);
if (rt6_ins(nrt, NULL)) if (rt6_ins(nrt, NULL, NULL))
goto out; goto out;
if (rt->rt6i_flags&RTF_CACHE) { if (rt->rt6i_flags&RTF_CACHE) {
ip6_del_rt(rt, NULL); ip6_del_rt(rt, NULL, NULL);
return; return;
} }
...@@ -1028,7 +1056,7 @@ void rt6_pmtu_discovery(struct in6_addr *daddr, struct in6_addr *saddr, ...@@ -1028,7 +1056,7 @@ void rt6_pmtu_discovery(struct in6_addr *daddr, struct in6_addr *saddr,
dst_set_expires(&nrt->u.dst, ip6_rt_mtu_expires); dst_set_expires(&nrt->u.dst, ip6_rt_mtu_expires);
nrt->rt6i_flags |= RTF_DYNAMIC|RTF_CACHE|RTF_EXPIRES; nrt->rt6i_flags |= RTF_DYNAMIC|RTF_CACHE|RTF_EXPIRES;
nrt->u.dst.metrics[RTAX_MTU-1] = pmtu; nrt->u.dst.metrics[RTAX_MTU-1] = pmtu;
rt6_ins(nrt, NULL); rt6_ins(nrt, NULL, NULL);
} }
out: out:
...@@ -1099,7 +1127,7 @@ struct rt6_info *rt6_add_dflt_router(struct in6_addr *gwaddr, ...@@ -1099,7 +1127,7 @@ struct rt6_info *rt6_add_dflt_router(struct in6_addr *gwaddr,
rtmsg.rtmsg_ifindex = dev->ifindex; rtmsg.rtmsg_ifindex = dev->ifindex;
ip6_route_add(&rtmsg, NULL); ip6_route_add(&rtmsg, NULL, NULL);
return rt6_get_dflt_router(gwaddr, dev); return rt6_get_dflt_router(gwaddr, dev);
} }
...@@ -1125,7 +1153,7 @@ void rt6_purge_dflt_routers(int last_resort) ...@@ -1125,7 +1153,7 @@ void rt6_purge_dflt_routers(int last_resort)
read_unlock_bh(&rt6_lock); read_unlock_bh(&rt6_lock);
ip6_del_rt(rt, NULL); ip6_del_rt(rt, NULL, NULL);
goto restart; goto restart;
} }
...@@ -1151,10 +1179,10 @@ int ipv6_route_ioctl(unsigned int cmd, void *arg) ...@@ -1151,10 +1179,10 @@ int ipv6_route_ioctl(unsigned int cmd, void *arg)
rtnl_lock(); rtnl_lock();
switch (cmd) { switch (cmd) {
case SIOCADDRT: case SIOCADDRT:
err = ip6_route_add(&rtmsg, NULL); err = ip6_route_add(&rtmsg, NULL, NULL);
break; break;
case SIOCDELRT: case SIOCDELRT:
err = ip6_route_del(&rtmsg, NULL); err = ip6_route_del(&rtmsg, NULL, NULL);
break; break;
default: default:
err = -EINVAL; err = -EINVAL;
...@@ -1210,7 +1238,7 @@ int ip6_rt_addr_add(struct in6_addr *addr, struct net_device *dev) ...@@ -1210,7 +1238,7 @@ int ip6_rt_addr_add(struct in6_addr *addr, struct net_device *dev)
ipv6_addr_copy(&rt->rt6i_dst.addr, addr); ipv6_addr_copy(&rt->rt6i_dst.addr, addr);
rt->rt6i_dst.plen = 128; rt->rt6i_dst.plen = 128;
rt6_ins(rt, NULL); rt6_ins(rt, NULL, NULL);
return 0; return 0;
} }
...@@ -1227,7 +1255,7 @@ int ip6_rt_addr_del(struct in6_addr *addr, struct net_device *dev) ...@@ -1227,7 +1255,7 @@ int ip6_rt_addr_del(struct in6_addr *addr, struct net_device *dev)
rt = rt6_lookup(addr, NULL, loopback_dev.ifindex, 1); rt = rt6_lookup(addr, NULL, loopback_dev.ifindex, 1);
if (rt) { if (rt) {
if (rt->rt6i_dst.plen == 128) if (rt->rt6i_dst.plen == 128)
err = ip6_del_rt(rt, NULL); err = ip6_del_rt(rt, NULL, NULL);
else else
dst_release(&rt->u.dst); dst_release(&rt->u.dst);
} }
...@@ -1357,7 +1385,7 @@ int inet6_rtm_delroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg) ...@@ -1357,7 +1385,7 @@ int inet6_rtm_delroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)
if (inet6_rtm_to_rtmsg(r, arg, &rtmsg)) if (inet6_rtm_to_rtmsg(r, arg, &rtmsg))
return -EINVAL; return -EINVAL;
return ip6_route_del(&rtmsg, nlh); return ip6_route_del(&rtmsg, nlh, arg);
} }
int inet6_rtm_newroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg) int inet6_rtm_newroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)
...@@ -1367,7 +1395,7 @@ int inet6_rtm_newroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg) ...@@ -1367,7 +1395,7 @@ int inet6_rtm_newroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)
if (inet6_rtm_to_rtmsg(r, arg, &rtmsg)) if (inet6_rtm_to_rtmsg(r, arg, &rtmsg))
return -EINVAL; return -EINVAL;
return ip6_route_add(&rtmsg, nlh); return ip6_route_add(&rtmsg, nlh, arg);
} }
struct rt6_rtnl_dump_arg struct rt6_rtnl_dump_arg
......
...@@ -1090,15 +1090,7 @@ static struct xfrm_state * pfkey_msg2xfrm_state(struct sadb_msg *hdr, ...@@ -1090,15 +1090,7 @@ static struct xfrm_state * pfkey_msg2xfrm_state(struct sadb_msg *hdr,
return x; return x;
out: out:
if (x->aalg) xfrm_state_put(x);
kfree(x->aalg);
if (x->ealg)
kfree(x->ealg);
if (x->calg)
kfree(x->calg);
if (x->encap)
kfree(x->encap);
kfree(x);
return ERR_PTR(-ENOBUFS); return ERR_PTR(-ENOBUFS);
} }
......
...@@ -228,13 +228,11 @@ EXPORT_SYMBOL(destroy_EII_client); ...@@ -228,13 +228,11 @@ EXPORT_SYMBOL(destroy_EII_client);
#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE) #if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
EXPORT_SYMBOL(dev_change_flags); EXPORT_SYMBOL(dev_change_flags);
#endif #endif
EXPORT_SYMBOL(vlan_ioctl_set);
EXPORT_SYMBOL(scm_detach_fds); EXPORT_SYMBOL(scm_detach_fds);
#if defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE) #if defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE)
EXPORT_SYMBOL(br_handle_frame_hook); EXPORT_SYMBOL(br_handle_frame_hook);
EXPORT_SYMBOL(brioctl_set);
#endif #endif
#ifdef CONFIG_NET_DIVERT #ifdef CONFIG_NET_DIVERT
...@@ -285,11 +283,6 @@ EXPORT_SYMBOL(unregister_inetaddr_notifier); ...@@ -285,11 +283,6 @@ EXPORT_SYMBOL(unregister_inetaddr_notifier);
/* needed for ip_gre -cw */ /* needed for ip_gre -cw */
EXPORT_SYMBOL(ip_statistics); EXPORT_SYMBOL(ip_statistics);
#ifdef CONFIG_DLCI_MODULE
extern int (*dlci_ioctl_hook)(unsigned int, void *);
EXPORT_SYMBOL(dlci_ioctl_hook);
#endif
EXPORT_SYMBOL(xfrm_user_policy); EXPORT_SYMBOL(xfrm_user_policy);
EXPORT_SYMBOL(km_waitq); EXPORT_SYMBOL(km_waitq);
EXPORT_SYMBOL(km_new_mapping); EXPORT_SYMBOL(km_new_mapping);
......
...@@ -731,6 +731,7 @@ void brioctl_set(int (*hook)(unsigned long)) ...@@ -731,6 +731,7 @@ void brioctl_set(int (*hook)(unsigned long))
br_ioctl_hook = hook; br_ioctl_hook = hook;
up(&br_ioctl_mutex); up(&br_ioctl_mutex);
} }
EXPORT_SYMBOL(brioctl_set);
static DECLARE_MUTEX(vlan_ioctl_mutex); static DECLARE_MUTEX(vlan_ioctl_mutex);
static int (*vlan_ioctl_hook)(unsigned long arg); static int (*vlan_ioctl_hook)(unsigned long arg);
...@@ -741,12 +742,18 @@ void vlan_ioctl_set(int (*hook)(unsigned long)) ...@@ -741,12 +742,18 @@ void vlan_ioctl_set(int (*hook)(unsigned long))
vlan_ioctl_hook = hook; vlan_ioctl_hook = hook;
up(&vlan_ioctl_mutex); up(&vlan_ioctl_mutex);
} }
EXPORT_SYMBOL(vlan_ioctl_set);
#ifdef CONFIG_DLCI static DECLARE_MUTEX(dlci_ioctl_mutex);
extern int dlci_ioctl(unsigned int, void *); static int (*dlci_ioctl_hook)(unsigned int, void *);
#else
int (*dlci_ioctl_hook)(unsigned int, void *); void dlci_ioctl_set(int (*hook)(unsigned int, void *))
#endif {
down(&dlci_ioctl_mutex);
dlci_ioctl_hook = hook;
up(&dlci_ioctl_mutex);
}
EXPORT_SYMBOL(dlci_ioctl_set);
/* /*
* With an ioctl, arg may well be a user mode pointer, but we don't know * With an ioctl, arg may well be a user mode pointer, but we don't know
...@@ -820,24 +827,16 @@ static int sock_ioctl(struct inode *inode, struct file *file, unsigned int cmd, ...@@ -820,24 +827,16 @@ static int sock_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
break; break;
case SIOCADDDLCI: case SIOCADDDLCI:
case SIOCDELDLCI: case SIOCDELDLCI:
/* Convert this to always call through a hook */
#ifdef CONFIG_DLCI
lock_kernel();
err = dlci_ioctl(cmd, (void *)arg);
unlock_kernel();
break;
#else
err = -ENOPKG; err = -ENOPKG;
#ifdef CONFIG_KMOD #ifdef CONFIG_KMOD
if (!dlci_ioctl_hook) if (!dlci_ioctl_hook)
request_module("dlci"); request_module("dlci");
#endif #endif
if (dlci_ioctl_hook) { if (dlci_ioctl_hook) {
lock_kernel(); down(&dlci_ioctl_mutex);
err = dlci_ioctl_hook(cmd, (void *)arg); err = dlci_ioctl_hook(cmd, (void *)arg);
unlock_kernel(); up(&dlci_ioctl_mutex);
} }
#endif
break; break;
default: default:
err = sock->ops->ioctl(sock, cmd, arg); err = sock->ops->ioctl(sock, cmd, arg);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment