Commit b08d296b authored by David S. Miller's avatar David S. Miller

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

into kernel.bkbits.net:/home/davem/net-2.5
parents 5057c65e 65a1432b
...@@ -27,6 +27,7 @@ struct uPD98402_priv { ...@@ -27,6 +27,7 @@ struct uPD98402_priv {
struct k_sonet_stats sonet_stats;/* link diagnostics */ struct k_sonet_stats sonet_stats;/* link diagnostics */
unsigned char framing; /* SONET/SDH framing */ unsigned char framing; /* SONET/SDH framing */
int loop_mode; /* loopback mode */ int loop_mode; /* loopback mode */
spinlock_t lock;
}; };
...@@ -71,14 +72,13 @@ static int set_framing(struct atm_dev *dev,unsigned char framing) ...@@ -71,14 +72,13 @@ static int set_framing(struct atm_dev *dev,unsigned char framing)
default: default:
return -EINVAL; return -EINVAL;
} }
save_flags(flags); spin_lock_irqsave(&PRIV(dev)->lock, flags);
cli();
PUT(set[0],C11T); PUT(set[0],C11T);
PUT(set[1],C12T); PUT(set[1],C12T);
PUT(set[2],C13T); PUT(set[2],C13T);
PUT((GET(MDR) & ~uPD98402_MDR_SS_MASK) | (set[3] << PUT((GET(MDR) & ~uPD98402_MDR_SS_MASK) | (set[3] <<
uPD98402_MDR_SS_SHIFT),MDR); uPD98402_MDR_SS_SHIFT),MDR);
restore_flags(flags); spin_unlock_irqrestore(&PRIV(dev)->lock, flags);
return 0; return 0;
} }
...@@ -88,12 +88,11 @@ static int get_sense(struct atm_dev *dev,u8 *arg) ...@@ -88,12 +88,11 @@ static int get_sense(struct atm_dev *dev,u8 *arg)
unsigned long flags; unsigned long flags;
unsigned char s[3]; unsigned char s[3];
save_flags(flags); spin_lock_irqsave(&PRIV(dev)->lock, flags);
cli();
s[0] = GET(C11R); s[0] = GET(C11R);
s[1] = GET(C12R); s[1] = GET(C12R);
s[2] = GET(C13R); s[2] = GET(C13R);
restore_flags(flags); spin_unlock_irqrestore(&PRIV(dev)->lock, flags);
return (put_user(s[0], arg) || put_user(s[1], arg+1) || return (put_user(s[0], arg) || put_user(s[1], arg+1) ||
put_user(s[2], arg+2) || put_user(0xff, arg+3) || put_user(s[2], arg+2) || put_user(0xff, arg+3) ||
put_user(0xff, arg+4) || put_user(0xff, arg+5)) ? -EFAULT : 0; put_user(0xff, arg+4) || put_user(0xff, arg+5)) ? -EFAULT : 0;
...@@ -214,6 +213,7 @@ static int uPD98402_start(struct atm_dev *dev) ...@@ -214,6 +213,7 @@ static int uPD98402_start(struct atm_dev *dev)
DPRINTK("phy_start\n"); DPRINTK("phy_start\n");
if (!(PRIV(dev) = kmalloc(sizeof(struct uPD98402_priv),GFP_KERNEL))) if (!(PRIV(dev) = kmalloc(sizeof(struct uPD98402_priv),GFP_KERNEL)))
return -ENOMEM; return -ENOMEM;
spin_lock_init(&PRIV(dev)->lock);
memset(&PRIV(dev)->sonet_stats,0,sizeof(struct k_sonet_stats)); memset(&PRIV(dev)->sonet_stats,0,sizeof(struct k_sonet_stats));
(void) GET(PCR); /* clear performance events */ (void) GET(PCR); /* clear performance events */
PUT(uPD98402_PFM_FJ,PCMR); /* ignore frequency adj */ PUT(uPD98402_PFM_FJ,PCMR); /* ignore frequency adj */
......
This diff is collapsed.
...@@ -85,6 +85,7 @@ struct zatm_dev { ...@@ -85,6 +85,7 @@ struct zatm_dev {
unsigned char irq; /* IRQ */ unsigned char irq; /* IRQ */
unsigned int base; /* IO base address */ unsigned int base; /* IO base address */
struct pci_dev *pci_dev; /* PCI stuff */ struct pci_dev *pci_dev; /* PCI stuff */
spinlock_t lock;
}; };
......
...@@ -2101,17 +2101,14 @@ static int gem_open(struct net_device *dev) ...@@ -2101,17 +2101,14 @@ static int gem_open(struct net_device *dev)
gp->hw_running = 1; gp->hw_running = 1;
} }
spin_lock_irq(&gp->lock);
/* We can now request the interrupt as we know it's masked /* We can now request the interrupt as we know it's masked
* on the controller * on the controller
*/ */
if (request_irq(gp->pdev->irq, gem_interrupt, if (request_irq(gp->pdev->irq, gem_interrupt,
SA_SHIRQ, dev->name, (void *)dev)) { SA_SHIRQ, dev->name, (void *)dev)) {
spin_unlock_irq(&gp->lock);
printk(KERN_ERR "%s: failed to request irq !\n", gp->dev->name); printk(KERN_ERR "%s: failed to request irq !\n", gp->dev->name);
spin_lock_irq(&gp->lock);
#ifdef CONFIG_PPC_PMAC #ifdef CONFIG_PPC_PMAC
if (!hw_was_up && gp->pdev->vendor == PCI_VENDOR_ID_APPLE) if (!hw_was_up && gp->pdev->vendor == PCI_VENDOR_ID_APPLE)
gem_apple_powerdown(gp); gem_apple_powerdown(gp);
...@@ -2120,10 +2117,13 @@ static int gem_open(struct net_device *dev) ...@@ -2120,10 +2117,13 @@ static int gem_open(struct net_device *dev)
gp->pm_timer.expires = jiffies + 10*HZ; gp->pm_timer.expires = jiffies + 10*HZ;
add_timer(&gp->pm_timer); add_timer(&gp->pm_timer);
up(&gp->pm_sem); up(&gp->pm_sem);
spin_unlock_irq(&gp->lock);
return -EAGAIN; return -EAGAIN;
} }
spin_lock_irq(&gp->lock);
/* Allocate & setup ring buffers */ /* Allocate & setup ring buffers */
gem_init_rings(gp); gem_init_rings(gp);
......
...@@ -48,6 +48,7 @@ static const char *version = ...@@ -48,6 +48,7 @@ static const char *version =
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/proc_fs.h> #include <linux/proc_fs.h>
#include <linux/spinlock.h>
#include <asm/system.h> #include <asm/system.h>
#include <asm/bitops.h> #include <asm/bitops.h>
...@@ -442,6 +443,7 @@ struct tc35815_local { ...@@ -442,6 +443,7 @@ struct tc35815_local {
unsigned char fbl_curid; unsigned char fbl_curid;
dma_addr_t data_buf_dma_handle[RX_BUF_PAGES]; dma_addr_t data_buf_dma_handle[RX_BUF_PAGES];
void * data_buf[RX_BUF_PAGES]; /* packing */ void * data_buf[RX_BUF_PAGES]; /* packing */
spinlock_t lock;
}; };
/* Index to functions, as function prototypes. */ /* Index to functions, as function prototypes. */
...@@ -577,6 +579,8 @@ static int __init tc35815_probe1(struct pci_dev *pdev, unsigned int base_addr, u ...@@ -577,6 +579,8 @@ static int __init tc35815_probe1(struct pci_dev *pdev, unsigned int base_addr, u
lp->next_module = root_tc35815_dev; lp->next_module = root_tc35815_dev;
root_tc35815_dev = dev; root_tc35815_dev = dev;
spin_lock_init(&lp->lock);
if (dev->mem_start > 0) { if (dev->mem_start > 0) {
lp->option = dev->mem_start; lp->option = dev->mem_start;
if ((lp->option & TC35815_OPT_10M) && if ((lp->option & TC35815_OPT_10M) &&
...@@ -895,7 +899,7 @@ static void tc35815_tx_timeout(struct net_device *dev) ...@@ -895,7 +899,7 @@ static void tc35815_tx_timeout(struct net_device *dev)
struct tc35815_regs *tr = (struct tc35815_regs *)dev->base_addr; struct tc35815_regs *tr = (struct tc35815_regs *)dev->base_addr;
int flags; int flags;
save_and_cli(flags); spin_lock_irqsave(&lp->lock, flags);
printk(KERN_WARNING "%s: transmit timed out, status %#x\n", printk(KERN_WARNING "%s: transmit timed out, status %#x\n",
dev->name, tc_readl(&tr->Tx_Stat)); dev->name, tc_readl(&tr->Tx_Stat));
/* Try to restart the adaptor. */ /* Try to restart the adaptor. */
...@@ -903,7 +907,7 @@ static void tc35815_tx_timeout(struct net_device *dev) ...@@ -903,7 +907,7 @@ static void tc35815_tx_timeout(struct net_device *dev)
tc35815_clear_queues(dev); tc35815_clear_queues(dev);
tc35815_chip_init(dev); tc35815_chip_init(dev);
lp->tbusy=0; lp->tbusy=0;
restore_flags(flags); spin_unlock_irqrestore(&lp->lock, flags);
dev->trans_start = jiffies; dev->trans_start = jiffies;
netif_wake_queue(dev); netif_wake_queue(dev);
} }
...@@ -951,7 +955,7 @@ static int tc35815_send_packet(struct sk_buff *skb, struct net_device *dev) ...@@ -951,7 +955,7 @@ static int tc35815_send_packet(struct sk_buff *skb, struct net_device *dev)
dma_cache_wback_inv((unsigned long)buf, length); dma_cache_wback_inv((unsigned long)buf, length);
#endif #endif
save_and_cli(flags); spin_lock_irqsave(&lp->lock, flags);
/* failsafe... */ /* failsafe... */
if (lp->tfd_start != lp->tfd_end) if (lp->tfd_start != lp->tfd_end)
...@@ -999,7 +1003,7 @@ static int tc35815_send_packet(struct sk_buff *skb, struct net_device *dev) ...@@ -999,7 +1003,7 @@ static int tc35815_send_packet(struct sk_buff *skb, struct net_device *dev)
if (tc35815_debug > 1) if (tc35815_debug > 1)
printk(KERN_WARNING "%s: TxFD Exhausted.\n", dev->name); printk(KERN_WARNING "%s: TxFD Exhausted.\n", dev->name);
} }
restore_flags(flags); spin_unlock_irqrestore(&lp->lock, flags);
} }
return 0; return 0;
...@@ -1403,10 +1407,10 @@ static struct net_device_stats *tc35815_get_stats(struct net_device *dev) ...@@ -1403,10 +1407,10 @@ static struct net_device_stats *tc35815_get_stats(struct net_device *dev)
unsigned long flags; unsigned long flags;
if (netif_running(dev)) { if (netif_running(dev)) {
save_and_cli(flags); spin_lock_irqsave(&lp->lock, flags);
/* Update the statistics from the device registers. */ /* Update the statistics from the device registers. */
lp->stats.rx_missed_errors = tc_readl(&tr->Miss_Cnt); lp->stats.rx_missed_errors = tc_readl(&tr->Miss_Cnt);
restore_flags(flags); spin_unlock_irqrestore(&lp->lock, flags);
} }
return &lp->stats; return &lp->stats;
...@@ -1507,28 +1511,34 @@ tc35815_set_multicast_list(struct net_device *dev) ...@@ -1507,28 +1511,34 @@ tc35815_set_multicast_list(struct net_device *dev)
} }
} }
static unsigned long tc_phy_read(struct tc35815_regs *tr, int phy, int phy_reg) static unsigned long tc_phy_read(struct net_device *dev, struct tc35815_regs *tr, int phy, int phy_reg)
{ {
struct tc35815_local *lp = (struct tc35815_local *)dev->priv;
unsigned long data; unsigned long data;
int flags; int flags;
save_and_cli(flags);
spin_lock_irqsave(&lp->lock, flags);
tc_writel(MD_CA_Busy | (phy << 5) | phy_reg, &tr->MD_CA); tc_writel(MD_CA_Busy | (phy << 5) | phy_reg, &tr->MD_CA);
while (tc_readl(&tr->MD_CA) & MD_CA_Busy) while (tc_readl(&tr->MD_CA) & MD_CA_Busy)
; ;
data = tc_readl(&tr->MD_Data); data = tc_readl(&tr->MD_Data);
restore_flags(flags); spin_unlock_irqrestore(&lp->lock, flags);
return data; return data;
} }
static void tc_phy_write(unsigned long d, struct tc35815_regs *tr, int phy, int phy_reg) static void tc_phy_write(struct net_device *dev, unsigned long d, struct tc35815_regs *tr, int phy, int phy_reg)
{ {
struct tc35815_local *lp = (struct tc35815_local *)dev->priv;
int flags; int flags;
save_and_cli(flags);
spin_lock_irqsave(&lp->lock, flags);
tc_writel(d, &tr->MD_Data); tc_writel(d, &tr->MD_Data);
tc_writel(MD_CA_Busy | MD_CA_Wr | (phy << 5) | phy_reg, &tr->MD_CA); tc_writel(MD_CA_Busy | MD_CA_Wr | (phy << 5) | phy_reg, &tr->MD_CA);
while (tc_readl(&tr->MD_CA) & MD_CA_Busy) while (tc_readl(&tr->MD_CA) & MD_CA_Busy)
; ;
restore_flags(flags); spin_unlock_irqrestore(&lp->lock, flags);
} }
static void tc35815_phy_chip_init(struct net_device *dev) static void tc35815_phy_chip_init(struct net_device *dev)
...@@ -1544,18 +1554,18 @@ static void tc35815_phy_chip_init(struct net_device *dev) ...@@ -1544,18 +1554,18 @@ static void tc35815_phy_chip_init(struct net_device *dev)
first = 0; first = 0;
/* first data written to the PHY will be an ID number */ /* first data written to the PHY will be an ID number */
tc_phy_write(0, tr, 0, MII_CONTROL); /* ID:0 */ tc_phy_write(dev, 0, tr, 0, MII_CONTROL); /* ID:0 */
#if 0 #if 0
tc_phy_write(MIICNTL_RESET, tr, 0, MII_CONTROL); tc_phy_write(dev, MIICNTL_RESET, tr, 0, MII_CONTROL);
printk(KERN_INFO "%s: Resetting PHY...", dev->name); printk(KERN_INFO "%s: Resetting PHY...", dev->name);
while (tc_phy_read(tr, 0, MII_CONTROL) & MIICNTL_RESET) while (tc_phy_read(dev, tr, 0, MII_CONTROL) & MIICNTL_RESET)
; ;
printk("\n"); printk("\n");
tc_phy_write(MIICNTL_AUTO|MIICNTL_SPEED|MIICNTL_FDX, tr, 0, tc_phy_write(dev, MIICNTL_AUTO|MIICNTL_SPEED|MIICNTL_FDX, tr, 0,
MII_CONTROL); MII_CONTROL);
#endif #endif
id0 = tc_phy_read(tr, 0, MII_PHY_ID0); id0 = tc_phy_read(dev, tr, 0, MII_PHY_ID0);
id1 = tc_phy_read(tr, 0, MII_PHY_ID1); id1 = tc_phy_read(dev, tr, 0, MII_PHY_ID1);
printk(KERN_DEBUG "%s: PHY ID %04x %04x\n", dev->name, printk(KERN_DEBUG "%s: PHY ID %04x %04x\n", dev->name,
id0, id1); id0, id1);
if (lp->option & TC35815_OPT_10M) { if (lp->option & TC35815_OPT_10M) {
...@@ -1567,10 +1577,10 @@ static void tc35815_phy_chip_init(struct net_device *dev) ...@@ -1567,10 +1577,10 @@ static void tc35815_phy_chip_init(struct net_device *dev)
} else { } else {
/* auto negotiation */ /* auto negotiation */
unsigned long neg_result; unsigned long neg_result;
tc_phy_write(MIICNTL_AUTO | MIICNTL_RST_AUTO, tr, 0, MII_CONTROL); tc_phy_write(dev, MIICNTL_AUTO | MIICNTL_RST_AUTO, tr, 0, MII_CONTROL);
printk(KERN_INFO "%s: Auto Negotiation...", dev->name); printk(KERN_INFO "%s: Auto Negotiation...", dev->name);
count = 0; count = 0;
while (!(tc_phy_read(tr, 0, MII_STATUS) & MIISTAT_AUTO_DONE)) { while (!(tc_phy_read(dev, tr, 0, MII_STATUS) & MIISTAT_AUTO_DONE)) {
if (count++ > 5000) { if (count++ > 5000) {
printk(" failed. Assume 10Mbps\n"); printk(" failed. Assume 10Mbps\n");
lp->linkspeed = 10; lp->linkspeed = 10;
...@@ -1582,7 +1592,7 @@ static void tc35815_phy_chip_init(struct net_device *dev) ...@@ -1582,7 +1592,7 @@ static void tc35815_phy_chip_init(struct net_device *dev)
mdelay(1); mdelay(1);
} }
printk(" done.\n"); printk(" done.\n");
neg_result = tc_phy_read(tr, 0, MII_ANLPAR); neg_result = tc_phy_read(dev, tr, 0, MII_ANLPAR);
if (neg_result & (MII_AN_TX_FDX | MII_AN_TX_HDX)) if (neg_result & (MII_AN_TX_FDX | MII_AN_TX_HDX))
lp->linkspeed = 100; lp->linkspeed = 100;
else else
...@@ -1601,7 +1611,7 @@ static void tc35815_phy_chip_init(struct net_device *dev) ...@@ -1601,7 +1611,7 @@ static void tc35815_phy_chip_init(struct net_device *dev)
ctl |= MIICNTL_SPEED; ctl |= MIICNTL_SPEED;
if (lp->fullduplex) if (lp->fullduplex)
ctl |= MIICNTL_FDX; ctl |= MIICNTL_FDX;
tc_phy_write(ctl, tr, 0, MII_CONTROL); tc_phy_write(dev, ctl, tr, 0, MII_CONTROL);
if (lp->fullduplex) { if (lp->fullduplex) {
tc_writel(tc_readl(&tr->MAC_Ctl) | MAC_FullDup, &tr->MAC_Ctl); tc_writel(tc_readl(&tr->MAC_Ctl) | MAC_FullDup, &tr->MAC_Ctl);
...@@ -1652,7 +1662,7 @@ static void tc35815_chip_init(struct net_device *dev) ...@@ -1652,7 +1662,7 @@ static void tc35815_chip_init(struct net_device *dev)
tc_writel(CAM_Ena_Bit(CAM_ENTRY_SOURCE), &tr->CAM_Ena); tc_writel(CAM_Ena_Bit(CAM_ENTRY_SOURCE), &tr->CAM_Ena);
tc_writel(CAM_CompEn | CAM_BroadAcc, &tr->CAM_Ctl); tc_writel(CAM_CompEn | CAM_BroadAcc, &tr->CAM_Ctl);
save_and_cli(flags); spin_lock_irqsave(&lp->lock, flags);
tc_writel(DMA_BURST_SIZE, &tr->DMA_Ctl); tc_writel(DMA_BURST_SIZE, &tr->DMA_Ctl);
...@@ -1683,7 +1693,7 @@ static void tc35815_chip_init(struct net_device *dev) ...@@ -1683,7 +1693,7 @@ static void tc35815_chip_init(struct net_device *dev)
#if 0 /* No need to polling */ #if 0 /* No need to polling */
tc_writel(virt_to_bus(lp->tfd_base), &tr->TxFrmPtr); /* start DMA transmitter */ tc_writel(virt_to_bus(lp->tfd_base), &tr->TxFrmPtr); /* start DMA transmitter */
#endif #endif
restore_flags(flags); spin_unlock_irqrestore(&lp->lock, flags);
} }
static int tc35815_proc_info(char *buffer, char **start, off_t offset, int length, int *eof, void *data) static int tc35815_proc_info(char *buffer, char **start, off_t offset, int length, int *eof, void *data)
......
...@@ -189,6 +189,7 @@ struct ipv6_pinfo { ...@@ -189,6 +189,7 @@ struct ipv6_pinfo {
struct ipv6_txoptions *opt; struct ipv6_txoptions *opt;
struct rt6_info *rt; struct rt6_info *rt;
struct flowi *fl; struct flowi *fl;
int hop_limit;
} cork; } cork;
}; };
......
...@@ -904,9 +904,9 @@ static inline unsigned char *pskb_pull(struct sk_buff *skb, unsigned int len) ...@@ -904,9 +904,9 @@ static inline unsigned char *pskb_pull(struct sk_buff *skb, unsigned int len)
static inline int pskb_may_pull(struct sk_buff *skb, unsigned int len) static inline int pskb_may_pull(struct sk_buff *skb, unsigned int len)
{ {
if (len <= skb_headlen(skb)) if (likely(len <= skb_headlen(skb)))
return 1; return 1;
if (len > skb->len) if (unlikely(len > skb->len))
return 0; return 0;
return __pskb_pull_tail(skb, len-skb_headlen(skb)) != NULL; return __pskb_pull_tail(skb, len-skb_headlen(skb)) != NULL;
} }
......
...@@ -216,12 +216,16 @@ extern psched_time_t psched_time_base; ...@@ -216,12 +216,16 @@ extern psched_time_t psched_time_base;
#if PSCHED_CLOCK_SOURCE == PSCHED_JIFFIES #if PSCHED_CLOCK_SOURCE == PSCHED_JIFFIES
#if HZ == 100 #if HZ < 96
#define PSCHED_JSCALE 14
#elif HZ >= 96 && HZ < 192
#define PSCHED_JSCALE 13 #define PSCHED_JSCALE 13
#elif HZ == 1024 #elif HZ >= 192 && HZ < 384
#define PSCHED_JSCALE 12
#elif HZ >= 384 && HZ < 768
#define PSCHED_JSCALE 11
#elif HZ >= 768
#define PSCHED_JSCALE 10 #define PSCHED_JSCALE 10
#else
#define PSCHED_JSCALE 0
#endif #endif
#define PSCHED_EXPORTLIST_2 #define PSCHED_EXPORTLIST_2
......
This diff is collapsed.
...@@ -10,7 +10,7 @@ obj-$(CONFIG_ATM_CLIP) += clip.o ...@@ -10,7 +10,7 @@ obj-$(CONFIG_ATM_CLIP) += clip.o
atm-$(subst m,y,$(CONFIG_ATM_CLIP)) += ipcommon.o atm-$(subst m,y,$(CONFIG_ATM_CLIP)) += ipcommon.o
obj-$(CONFIG_ATM_BR2684) += br2684.o obj-$(CONFIG_ATM_BR2684) += br2684.o
atm-$(subst m,y,$(CONFIG_ATM_BR2684)) += ipcommon.o atm-$(subst m,y,$(CONFIG_ATM_BR2684)) += ipcommon.o
atm-$(subst m,y,$CONFIG_NET_SCH_ATM)) += ipcommon.o atm-$(subst m,y,$(CONFIG_NET_SCH_ATM)) += ipcommon.o
atm-$(CONFIG_PROC_FS) += proc.o atm-$(CONFIG_PROC_FS) += proc.o
obj-$(CONFIG_ATM_LANE) += lec.o obj-$(CONFIG_ATM_LANE) += lec.o
......
...@@ -71,8 +71,8 @@ static int check_ci(struct atm_vcc *vcc,short vpi,int vci) ...@@ -71,8 +71,8 @@ static int check_ci(struct atm_vcc *vcc,short vpi,int vci)
int atm_find_ci(struct atm_vcc *vcc,short *vpi,int *vci) int atm_find_ci(struct atm_vcc *vcc,short *vpi,int *vci)
{ {
static short p = 0; /* poor man's per-device cache */ static short p; /* poor man's per-device cache */
static int c = 0; static int c;
short old_p; short old_p;
int old_c; int old_c;
int err; int err;
......
...@@ -1379,8 +1379,8 @@ static void mpc_timer_refresh() ...@@ -1379,8 +1379,8 @@ static void mpc_timer_refresh()
static void mpc_cache_check( unsigned long checking_time ) static void mpc_cache_check( unsigned long checking_time )
{ {
struct mpoa_client *mpc = mpcs; struct mpoa_client *mpc = mpcs;
static unsigned long previous_resolving_check_time = 0; static unsigned long previous_resolving_check_time;
static unsigned long previous_refresh_time = 0; static unsigned long previous_refresh_time;
while( mpc != NULL ){ while( mpc != NULL ){
mpc->in_ops->clear_count(mpc); mpc->in_ops->clear_count(mpc);
......
...@@ -39,7 +39,7 @@ static DECLARE_WAIT_QUEUE_HEAD(sigd_sleep); ...@@ -39,7 +39,7 @@ static DECLARE_WAIT_QUEUE_HEAD(sigd_sleep);
static void sigd_put_skb(struct sk_buff *skb) static void sigd_put_skb(struct sk_buff *skb)
{ {
#ifdef WAIT_FOR_DEMON #ifdef WAIT_FOR_DEMON
static unsigned long silence = 0; static unsigned long silence;
DECLARE_WAITQUEUE(wait,current); DECLARE_WAITQUEUE(wait,current);
add_wait_queue(&sigd_sleep,&wait); add_wait_queue(&sigd_sleep,&wait);
......
...@@ -1779,7 +1779,7 @@ static int ax25_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) ...@@ -1779,7 +1779,7 @@ static int ax25_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
/* old structure? */ /* old structure? */
if (cmd == SIOCAX25GETINFOOLD) { if (cmd == SIOCAX25GETINFOOLD) {
static int warned = 0; static int warned;
if (!warned) { if (!warned) {
printk(KERN_INFO "%s uses old SIOCAX25GETINFO\n", printk(KERN_INFO "%s uses old SIOCAX25GETINFO\n",
current->comm); current->comm);
......
...@@ -12,20 +12,20 @@ ...@@ -12,20 +12,20 @@
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <net/ax25.h> #include <net/ax25.h>
static int min_ipdefmode[] = {0}, max_ipdefmode[] = {1}; static int min_ipdefmode[1], max_ipdefmode[] = {1};
static int min_axdefmode[] = {0}, max_axdefmode[] = {1}; static int min_axdefmode[1], max_axdefmode[] = {1};
static int min_backoff[] = {0}, max_backoff[] = {2}; static int min_backoff[1], max_backoff[] = {2};
static int min_conmode[] = {0}, max_conmode[] = {2}; static int min_conmode[1], max_conmode[] = {2};
static int min_window[] = {1}, max_window[] = {7}; static int min_window[] = {1}, max_window[] = {7};
static int min_ewindow[] = {1}, max_ewindow[] = {63}; static int min_ewindow[] = {1}, max_ewindow[] = {63};
static int min_t1[] = {1}, max_t1[] = {30 * HZ}; static int min_t1[] = {1}, max_t1[] = {30 * HZ};
static int min_t2[] = {1}, max_t2[] = {20 * HZ}; static int min_t2[] = {1}, max_t2[] = {20 * HZ};
static int min_t3[] = {0}, max_t3[] = {3600 * HZ}; static int min_t3[1], max_t3[] = {3600 * HZ};
static int min_idle[] = {0}, max_idle[] = {65535 * HZ}; static int min_idle[1], max_idle[] = {65535 * HZ};
static int min_n2[] = {1}, max_n2[] = {31}; static int min_n2[] = {1}, max_n2[] = {31};
static int min_paclen[] = {1}, max_paclen[] = {512}; static int min_paclen[] = {1}, max_paclen[] = {512};
static int min_proto[] = {0}, max_proto[] = {3}; static int min_proto[1], max_proto[] = {3};
static int min_ds_timeout[] = {0}, max_ds_timeout[] = {65535 * HZ}; static int min_ds_timeout[1], max_ds_timeout[] = {65535 * HZ};
static struct ctl_table_header *ax25_table_header; static struct ctl_table_header *ax25_table_header;
......
...@@ -70,7 +70,7 @@ static struct rtable __fake_rtable = { ...@@ -70,7 +70,7 @@ static struct rtable __fake_rtable = {
/* PF_BRIDGE/PRE_ROUTING *********************************************/ /* PF_BRIDGE/PRE_ROUTING *********************************************/
static void __br_dnat_complain(void) static void __br_dnat_complain(void)
{ {
static unsigned long last_complaint = 0; static unsigned long last_complaint;
if (jiffies - last_complaint >= 5 * HZ) { if (jiffies - last_complaint >= 5 * HZ) {
printk(KERN_WARNING "Performing cross-bridge DNAT requires IP " printk(KERN_WARNING "Performing cross-bridge DNAT requires IP "
......
...@@ -43,15 +43,18 @@ static int br_device_event(struct notifier_block *unused, unsigned long event, v ...@@ -43,15 +43,18 @@ static int br_device_event(struct notifier_block *unused, unsigned long event, v
{ {
case NETDEV_CHANGEADDR: case NETDEV_CHANGEADDR:
br_fdb_changeaddr(p, dev->dev_addr); br_fdb_changeaddr(p, dev->dev_addr);
br_stp_recalculate_bridge_id(br); if (br->dev->flags & IFF_UP)
br_stp_recalculate_bridge_id(br);
break; break;
case NETDEV_DOWN: case NETDEV_DOWN:
br_stp_disable_port(p); if (br->dev->flags & IFF_UP)
br_stp_disable_port(p);
break; break;
case NETDEV_UP: case NETDEV_UP:
br_stp_enable_port(p); if (br->dev->flags & IFF_UP)
br_stp_enable_port(p);
break; break;
case NETDEV_UNREGISTER: case NETDEV_UNREGISTER:
......
...@@ -138,7 +138,7 @@ static void br_stp_change_bridge_id(struct net_bridge *br, unsigned char *addr) ...@@ -138,7 +138,7 @@ static void br_stp_change_bridge_id(struct net_bridge *br, unsigned char *addr)
br_become_root_bridge(br); br_become_root_bridge(br);
} }
static unsigned char br_mac_zero[6] = {0,0,0,0,0,0}; static unsigned char br_mac_zero[6];
/* called under bridge lock */ /* called under bridge lock */
void br_stp_recalculate_bridge_id(struct net_bridge *br) void br_stp_recalculate_bridge_id(struct net_bridge *br)
......
...@@ -557,6 +557,18 @@ void nf_reinject(struct sk_buff *skb, struct nf_info *info, ...@@ -557,6 +557,18 @@ void nf_reinject(struct sk_buff *skb, struct nf_info *info,
rcu_read_lock(); rcu_read_lock();
/* Release those devices we held, or Alexey will kill me. */
if (info->indev) dev_put(info->indev);
if (info->outdev) dev_put(info->outdev);
#if defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE)
if (skb->nf_bridge) {
if (skb->nf_bridge->physindev)
dev_put(skb->nf_bridge->physindev);
if (skb->nf_bridge->physoutdev)
dev_put(skb->nf_bridge->physoutdev);
}
#endif
/* Drop reference to owner of hook which queued us. */ /* Drop reference to owner of hook which queued us. */
module_put(info->elem->owner); module_put(info->elem->owner);
...@@ -599,19 +611,6 @@ void nf_reinject(struct sk_buff *skb, struct nf_info *info, ...@@ -599,19 +611,6 @@ void nf_reinject(struct sk_buff *skb, struct nf_info *info,
} }
rcu_read_unlock(); rcu_read_unlock();
/* Release those devices we held, or Alexey will kill me. */
if (info->indev) dev_put(info->indev);
if (info->outdev) dev_put(info->outdev);
#if defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE)
if (skb->nf_bridge) {
if (skb->nf_bridge->physindev)
dev_put(skb->nf_bridge->physindev);
if (skb->nf_bridge->physoutdev)
dev_put(skb->nf_bridge->physoutdev);
}
#endif
if (verdict == NF_DROP) if (verdict == NF_DROP)
kfree_skb(skb); kfree_skb(skb);
......
...@@ -35,5 +35,3 @@ config DECNET_ROUTE_FWMARK ...@@ -35,5 +35,3 @@ config DECNET_ROUTE_FWMARK
packets with different FWMARK ("firewalling mark") values packets with different FWMARK ("firewalling mark") values
(see ipchains(8), "-m" argument). (see ipchains(8), "-m" argument).
source "net/decnet/netfilter/Kconfig"
...@@ -1472,7 +1472,7 @@ static struct rtnetlink_link dnet_rtnetlink_table[RTM_MAX-RTM_BASE+1] = ...@@ -1472,7 +1472,7 @@ static struct rtnetlink_link dnet_rtnetlink_table[RTM_MAX-RTM_BASE+1] =
}; };
#ifdef MODULE #ifdef MODULE
static int addr[2] = {0, 0}; static int addr[2];
MODULE_PARM(addr, "2i"); MODULE_PARM(addr, "2i");
MODULE_PARM_DESC(addr, "The DECnet address of this machine: area,node"); MODULE_PARM_DESC(addr, "The DECnet address of this machine: area,node");
......
...@@ -374,6 +374,5 @@ config INET_IPCOMP ...@@ -374,6 +374,5 @@ config INET_IPCOMP
If unsure, say Y. If unsure, say Y.
source "net/ipv4/netfilter/Kconfig"
source "net/ipv4/ipvs/Kconfig" source "net/ipv4/ipvs/Kconfig"
...@@ -1100,6 +1100,7 @@ static void ip_encap(struct sk_buff *skb, u32 saddr, u32 daddr) ...@@ -1100,6 +1100,7 @@ static void ip_encap(struct sk_buff *skb, u32 saddr, u32 daddr)
skb->h.ipiph = skb->nh.iph; skb->h.ipiph = skb->nh.iph;
skb->nh.iph = iph; skb->nh.iph = iph;
memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt));
#ifdef CONFIG_NETFILTER #ifdef CONFIG_NETFILTER
nf_conntrack_put(skb->nfct); nf_conntrack_put(skb->nfct);
skb->nfct = NULL; skb->nfct = NULL;
...@@ -1108,12 +1109,14 @@ static void ip_encap(struct sk_buff *skb, u32 saddr, u32 daddr) ...@@ -1108,12 +1109,14 @@ static void ip_encap(struct sk_buff *skb, u32 saddr, u32 daddr)
static inline int ipmr_forward_finish(struct sk_buff *skb) static inline int ipmr_forward_finish(struct sk_buff *skb)
{ {
struct dst_entry *dst = skb->dst; struct ip_options * opt = &(IPCB(skb)->opt);
if (skb->len <= dst_pmtu(dst)) IP_INC_STATS_BH(IpForwDatagrams);
return dst_output(skb);
else if (unlikely(opt->optlen))
return ip_fragment(skb, dst_output); ip_forward_options(skb);
return dst_output(skb);
} }
/* /*
......
...@@ -246,7 +246,7 @@ unsigned int arpt_do_table(struct sk_buff **pskb, ...@@ -246,7 +246,7 @@ unsigned int arpt_do_table(struct sk_buff **pskb,
struct arpt_table *table, struct arpt_table *table,
void *userdata) void *userdata)
{ {
static const char nulldevname[IFNAMSIZ] = { 0 }; static const char nulldevname[IFNAMSIZ];
unsigned int verdict = NF_DROP; unsigned int verdict = NF_DROP;
struct arphdr *arp; struct arphdr *arp;
int hotdrop = 0; int hotdrop = 0;
......
...@@ -60,7 +60,7 @@ LIST_HEAD(ip_conntrack_expect_list); ...@@ -60,7 +60,7 @@ LIST_HEAD(ip_conntrack_expect_list);
LIST_HEAD(protocol_list); LIST_HEAD(protocol_list);
static LIST_HEAD(helpers); static LIST_HEAD(helpers);
unsigned int ip_conntrack_htable_size = 0; unsigned int ip_conntrack_htable_size = 0;
static int ip_conntrack_max = 0; static int ip_conntrack_max;
static atomic_t ip_conntrack_count = ATOMIC_INIT(0); static atomic_t ip_conntrack_count = ATOMIC_INIT(0);
struct list_head *ip_conntrack_hash; struct list_head *ip_conntrack_hash;
static kmem_cache_t *ip_conntrack_cachep; static kmem_cache_t *ip_conntrack_cachep;
...@@ -618,7 +618,7 @@ init_conntrack(const struct ip_conntrack_tuple *tuple, ...@@ -618,7 +618,7 @@ init_conntrack(const struct ip_conntrack_tuple *tuple,
size_t hash; size_t hash;
struct ip_conntrack_expect *expected; struct ip_conntrack_expect *expected;
int i; int i;
static unsigned int drop_next = 0; static unsigned int drop_next;
if (!ip_conntrack_hash_rnd_initted) { if (!ip_conntrack_hash_rnd_initted) {
get_random_bytes(&ip_conntrack_hash_rnd, 4); get_random_bytes(&ip_conntrack_hash_rnd, 4);
...@@ -1393,7 +1393,7 @@ void ip_conntrack_cleanup(void) ...@@ -1393,7 +1393,7 @@ void ip_conntrack_cleanup(void)
nf_unregister_sockopt(&so_getorigdst); nf_unregister_sockopt(&so_getorigdst);
} }
static int hashsize = 0; static int hashsize;
MODULE_PARM(hashsize, "i"); MODULE_PARM(hashsize, "i");
int __init ip_conntrack_init(void) int __init ip_conntrack_init(void)
......
...@@ -19,12 +19,12 @@ struct module *ip_conntrack_ftp = THIS_MODULE; ...@@ -19,12 +19,12 @@ struct module *ip_conntrack_ftp = THIS_MODULE;
#define MAX_PORTS 8 #define MAX_PORTS 8
static int ports[MAX_PORTS]; static int ports[MAX_PORTS];
static int ports_c = 0; static int ports_c;
#ifdef MODULE_PARM #ifdef MODULE_PARM
MODULE_PARM(ports, "1-" __MODULE_STRING(MAX_PORTS) "i"); MODULE_PARM(ports, "1-" __MODULE_STRING(MAX_PORTS) "i");
#endif #endif
static int loose = 0; static int loose;
MODULE_PARM(loose, "i"); MODULE_PARM(loose, "i");
#if 0 #if 0
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
#define MAX_PORTS 8 #define MAX_PORTS 8
static int ports[MAX_PORTS]; static int ports[MAX_PORTS];
static int ports_c = 0; static int ports_c;
static int max_dcc_channels = 8; static int max_dcc_channels = 8;
static unsigned int dcc_timeout = 300; static unsigned int dcc_timeout = 300;
/* This is slow, but it's simple. --RR */ /* This is slow, but it's simple. --RR */
......
...@@ -22,7 +22,7 @@ MODULE_LICENSE("GPL"); ...@@ -22,7 +22,7 @@ MODULE_LICENSE("GPL");
#define MAX_PORTS 8 #define MAX_PORTS 8
static int ports[MAX_PORTS]; static int ports[MAX_PORTS];
static int ports_c = 0; static int ports_c;
#ifdef MODULE_PARM #ifdef MODULE_PARM
MODULE_PARM(ports, "1-" __MODULE_STRING(MAX_PORTS) "i"); MODULE_PARM(ports, "1-" __MODULE_STRING(MAX_PORTS) "i");
MODULE_PARM_DESC(ports, "port numbers of tftp servers"); MODULE_PARM_DESC(ports, "port numbers of tftp servers");
......
...@@ -278,7 +278,7 @@ find_best_ips_proto(struct ip_conntrack_tuple *tuple, ...@@ -278,7 +278,7 @@ find_best_ips_proto(struct ip_conntrack_tuple *tuple,
struct ip_conntrack_tuple tuple; struct ip_conntrack_tuple tuple;
} best = { NULL, 0xFFFFFFFF }; } best = { NULL, 0xFFFFFFFF };
u_int32_t *var_ipp, *other_ipp, saved_ip, orig_dstip; u_int32_t *var_ipp, *other_ipp, saved_ip, orig_dstip;
static unsigned int randomness = 0; static unsigned int randomness;
if (HOOK2MANIP(hooknum) == IP_NAT_MANIP_SRC) { if (HOOK2MANIP(hooknum) == IP_NAT_MANIP_SRC) {
var_ipp = &tuple->src.ip; var_ipp = &tuple->src.ip;
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
#define MAX_PORTS 8 #define MAX_PORTS 8
static int ports[MAX_PORTS]; static int ports[MAX_PORTS];
static int ports_c = 0; static int ports_c;
#ifdef MODULE_PARM #ifdef MODULE_PARM
MODULE_PARM(ports, "1-" __MODULE_STRING(MAX_PORTS) "i"); MODULE_PARM(ports, "1-" __MODULE_STRING(MAX_PORTS) "i");
......
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
#define MAX_PORTS 8 #define MAX_PORTS 8
static int ports[MAX_PORTS]; static int ports[MAX_PORTS];
static int ports_c = 0; static int ports_c;
MODULE_AUTHOR("Harald Welte <laforge@gnumonks.org>"); MODULE_AUTHOR("Harald Welte <laforge@gnumonks.org>");
MODULE_DESCRIPTION("IRC (DCC) network address translation module"); MODULE_DESCRIPTION("IRC (DCC) network address translation module");
......
...@@ -26,7 +26,7 @@ icmp_unique_tuple(struct ip_conntrack_tuple *tuple, ...@@ -26,7 +26,7 @@ icmp_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 id = 0; 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)range->max.icmp.id - range->min.icmp.id + 1;
unsigned int i; unsigned int i;
......
...@@ -32,7 +32,7 @@ tcp_unique_tuple(struct ip_conntrack_tuple *tuple, ...@@ -32,7 +32,7 @@ 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 = 0, *portptr; static u_int16_t port, *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)
......
...@@ -33,7 +33,7 @@ udp_unique_tuple(struct ip_conntrack_tuple *tuple, ...@@ -33,7 +33,7 @@ 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 = 0, *portptr; static u_int16_t port, *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)
......
...@@ -62,7 +62,7 @@ ...@@ -62,7 +62,7 @@
#define SNMP_TRAP_PORT 162 #define SNMP_TRAP_PORT 162
#define NOCT1(n) (u_int8_t )((n) & 0xff) #define NOCT1(n) (u_int8_t )((n) & 0xff)
static int debug = 0; static int debug;
static spinlock_t snmp_lock = SPIN_LOCK_UNLOCKED; static spinlock_t snmp_lock = SPIN_LOCK_UNLOCKED;
/* /*
......
...@@ -256,7 +256,7 @@ ipt_do_table(struct sk_buff **pskb, ...@@ -256,7 +256,7 @@ ipt_do_table(struct sk_buff **pskb,
struct ipt_table *table, struct ipt_table *table,
void *userdata) void *userdata)
{ {
static const char nulldevname[IFNAMSIZ] = { 0 }; static const char nulldevname[IFNAMSIZ];
u_int16_t offset; u_int16_t offset;
struct iphdr *ip; struct iphdr *ip;
u_int16_t datalen; u_int16_t datalen;
......
...@@ -2,16 +2,15 @@ ...@@ -2,16 +2,15 @@
* This is a module which is used for logging packets. * This is a module which is used for logging packets.
*/ */
#include <linux/module.h> #include <linux/module.h>
#include <linux/spinlock.h>
#include <linux/skbuff.h> #include <linux/skbuff.h>
#include <linux/ip.h> #include <linux/ip.h>
#include <linux/spinlock.h>
#include <net/icmp.h> #include <net/icmp.h>
#include <net/udp.h> #include <net/udp.h>
#include <net/tcp.h> #include <net/tcp.h>
#include <linux/netfilter_ipv4/ip_tables.h>
struct in_device;
#include <net/route.h> #include <net/route.h>
#include <linux/netfilter_ipv4/ip_tables.h>
#include <linux/netfilter_ipv4/ipt_LOG.h> #include <linux/netfilter_ipv4/ipt_LOG.h>
#if 0 #if 0
...@@ -20,10 +19,6 @@ struct in_device; ...@@ -20,10 +19,6 @@ struct in_device;
#define DEBUGP(format, args...) #define DEBUGP(format, args...)
#endif #endif
struct esphdr {
__u32 spi;
}; /* FIXME evil kludge */
/* Use lock to serialize, so printks don't overlap */ /* Use lock to serialize, so printks don't overlap */
static spinlock_t log_lock = SPIN_LOCK_UNLOCKED; static spinlock_t log_lock = SPIN_LOCK_UNLOCKED;
...@@ -256,13 +251,31 @@ static void dump_packet(const struct ipt_log_info *info, ...@@ -256,13 +251,31 @@ static void dump_packet(const struct ipt_log_info *info,
break; break;
} }
/* Max Length */ /* Max Length */
case IPPROTO_AH: case IPPROTO_AH: {
struct ip_auth_hdr ah;
if (ntohs(iph.frag_off) & IP_OFFSET)
break;
/* Max length: 9 "PROTO=AH " */
printk("PROTO=AH ");
/* Max length: 25 "INCOMPLETE [65535 bytes] " */
if (skb_copy_bits(skb, iphoff+iph.ihl*4, &ah, sizeof(ah)) < 0) {
printk("INCOMPLETE [%u bytes] ",
skb->len - iphoff - iph.ihl*4);
break;
}
/* Length: 15 "SPI=0xF1234567 " */
printk("SPI=0x%x ", ntohl(ah.spi));
break;
}
case IPPROTO_ESP: { case IPPROTO_ESP: {
struct esphdr esph; struct ip_esp_hdr esph;
int esp = (iph.protocol==IPPROTO_ESP);
/* Max length: 10 "PROTO=ESP " */ /* Max length: 10 "PROTO=ESP " */
printk("PROTO=%s ",esp? "ESP" : "AH"); printk("PROTO=ESP ");
if (ntohs(iph.frag_off) & IP_OFFSET) if (ntohs(iph.frag_off) & IP_OFFSET)
break; break;
......
/* Kernel module to match AH parameters. */ /* Kernel module to match AH parameters. */
#include <linux/module.h> #include <linux/module.h>
#include <linux/skbuff.h> #include <linux/skbuff.h>
#include <linux/ip.h>
#include <linux/netfilter_ipv4/ipt_ah.h> #include <linux/netfilter_ipv4/ipt_ah.h>
#include <linux/netfilter_ipv4/ip_tables.h> #include <linux/netfilter_ipv4/ip_tables.h>
...@@ -13,10 +14,6 @@ MODULE_LICENSE("GPL"); ...@@ -13,10 +14,6 @@ MODULE_LICENSE("GPL");
#define duprintf(format, args...) #define duprintf(format, args...)
#endif #endif
struct ahhdr {
__u32 spi;
};
/* Returns 1 if the spi is matched by the range, 0 otherwise */ /* Returns 1 if the spi is matched by the range, 0 otherwise */
static inline int static inline int
spi_match(u_int32_t min, u_int32_t max, u_int32_t spi, int invert) spi_match(u_int32_t min, u_int32_t max, u_int32_t spi, int invert)
...@@ -37,7 +34,7 @@ match(const struct sk_buff *skb, ...@@ -37,7 +34,7 @@ match(const struct sk_buff *skb,
int offset, int offset,
int *hotdrop) int *hotdrop)
{ {
struct ahhdr ah; struct ip_auth_hdr ah;
const struct ipt_ah *ahinfo = matchinfo; const struct ipt_ah *ahinfo = matchinfo;
/* Must not be a fragment. */ /* Must not be a fragment. */
......
/* Kernel module to match ESP parameters. */ /* Kernel module to match ESP parameters. */
#include <linux/module.h> #include <linux/module.h>
#include <linux/skbuff.h> #include <linux/skbuff.h>
#include <linux/ip.h>
#include <linux/netfilter_ipv4/ipt_esp.h> #include <linux/netfilter_ipv4/ipt_esp.h>
#include <linux/netfilter_ipv4/ip_tables.h> #include <linux/netfilter_ipv4/ip_tables.h>
...@@ -13,10 +14,6 @@ MODULE_LICENSE("GPL"); ...@@ -13,10 +14,6 @@ MODULE_LICENSE("GPL");
#define duprintf(format, args...) #define duprintf(format, args...)
#endif #endif
struct esphdr {
__u32 spi;
};
/* Returns 1 if the spi is matched by the range, 0 otherwise */ /* Returns 1 if the spi is matched by the range, 0 otherwise */
static inline int static inline int
spi_match(u_int32_t min, u_int32_t max, u_int32_t spi, int invert) spi_match(u_int32_t min, u_int32_t max, u_int32_t spi, int invert)
...@@ -37,7 +34,7 @@ match(const struct sk_buff *skb, ...@@ -37,7 +34,7 @@ match(const struct sk_buff *skb,
int offset, int offset,
int *hotdrop) int *hotdrop)
{ {
struct esphdr esp; struct ip_esp_hdr esp;
const struct ipt_esp *espinfo = matchinfo; const struct ipt_esp *espinfo = matchinfo;
/* Must not be a fragment. */ /* Must not be a fragment. */
......
...@@ -17,7 +17,7 @@ match(const struct sk_buff *skb, ...@@ -17,7 +17,7 @@ match(const struct sk_buff *skb,
int *hotdrop) int *hotdrop)
{ {
int i; int i;
static const char nulldevname[IFNAMSIZ] = { 0 }; static const char nulldevname[IFNAMSIZ];
const struct ipt_physdev_info *info = matchinfo; const struct ipt_physdev_info *info = matchinfo;
unsigned long ret; unsigned long ret;
const char *indev, *outdev; const char *indev, *outdev;
......
...@@ -63,4 +63,3 @@ config IPV6_TUNNEL ...@@ -63,4 +63,3 @@ config IPV6_TUNNEL
If unsure, say N. If unsure, say N.
source "net/ipv6/netfilter/Kconfig"
...@@ -65,7 +65,7 @@ ...@@ -65,7 +65,7 @@
#include <asm/system.h> #include <asm/system.h>
#if 0 /*def MODULE*/ #if 0 /*def MODULE*/
static int unloadable = 0; /* XX: Turn to one when all is ok within the static int unloadable; /* XX: Turn to one when all is ok within the
module for allowing unload */ module for allowing unload */
MODULE_PARM(unloadable, "i"); MODULE_PARM(unloadable, "i");
#endif #endif
......
...@@ -203,18 +203,24 @@ int esp6_input(struct xfrm_state *x, struct xfrm_decap_state *decap, struct sk_b ...@@ -203,18 +203,24 @@ int esp6_input(struct xfrm_state *x, struct xfrm_decap_state *decap, struct sk_b
int hdr_len = skb->h.raw - skb->nh.raw; int hdr_len = skb->h.raw - skb->nh.raw;
int nfrags; int nfrags;
u8 ret_nexthdr = 0;
unsigned char *tmp_hdr = NULL; unsigned char *tmp_hdr = NULL;
int ret = 0;
if (!pskb_may_pull(skb, sizeof(struct ipv6_esp_hdr))) if (!pskb_may_pull(skb, sizeof(struct ipv6_esp_hdr))) {
goto out; ret = -EINVAL;
goto out_nofree;
}
if (elen <= 0 || (elen & (blksize-1))) if (elen <= 0 || (elen & (blksize-1))) {
goto out; ret = -EINVAL;
goto out_nofree;
}
tmp_hdr = kmalloc(hdr_len, GFP_ATOMIC); tmp_hdr = kmalloc(hdr_len, GFP_ATOMIC);
if (!tmp_hdr) if (!tmp_hdr) {
goto out; ret = -ENOMEM;
goto out_nofree;
}
memcpy(tmp_hdr, skb->nh.raw, hdr_len); memcpy(tmp_hdr, skb->nh.raw, hdr_len);
/* If integrity check is required, do this. */ /* If integrity check is required, do this. */
...@@ -229,12 +235,15 @@ int esp6_input(struct xfrm_state *x, struct xfrm_decap_state *decap, struct sk_b ...@@ -229,12 +235,15 @@ int esp6_input(struct xfrm_state *x, struct xfrm_decap_state *decap, struct sk_b
if (unlikely(memcmp(sum, sum1, alen))) { if (unlikely(memcmp(sum, sum1, alen))) {
x->stats.integrity_failed++; x->stats.integrity_failed++;
ret = -EINVAL;
goto out; goto out;
} }
} }
if ((nfrags = skb_cow_data(skb, 0, &trailer)) < 0) if ((nfrags = skb_cow_data(skb, 0, &trailer)) < 0) {
ret = -EINVAL;
goto out; goto out;
}
skb->ip_summed = CHECKSUM_NONE; skb->ip_summed = CHECKSUM_NONE;
...@@ -254,8 +263,10 @@ int esp6_input(struct xfrm_state *x, struct xfrm_decap_state *decap, struct sk_b ...@@ -254,8 +263,10 @@ int esp6_input(struct xfrm_state *x, struct xfrm_decap_state *decap, struct sk_b
if (unlikely(nfrags > MAX_SG_ONSTACK)) { if (unlikely(nfrags > MAX_SG_ONSTACK)) {
sg = kmalloc(sizeof(struct scatterlist)*nfrags, GFP_ATOMIC); sg = kmalloc(sizeof(struct scatterlist)*nfrags, GFP_ATOMIC);
if (!sg) if (!sg) {
ret = -ENOMEM;
goto out; goto out;
}
} }
skb_to_sgvec(skb, sg, sizeof(struct ipv6_esp_hdr) + esp->conf.ivlen, elen); skb_to_sgvec(skb, sg, sizeof(struct ipv6_esp_hdr) + esp->conf.ivlen, elen);
crypto_cipher_decrypt(esp->conf.tfm, sg, sg, elen); crypto_cipher_decrypt(esp->conf.tfm, sg, sg, elen);
...@@ -270,6 +281,7 @@ int esp6_input(struct xfrm_state *x, struct xfrm_decap_state *decap, struct sk_b ...@@ -270,6 +281,7 @@ int esp6_input(struct xfrm_state *x, struct xfrm_decap_state *decap, struct sk_b
if (net_ratelimit()) { if (net_ratelimit()) {
printk(KERN_WARNING "ipsec esp packet is garbage padlen=%d, elen=%d\n", padlen+2, elen); printk(KERN_WARNING "ipsec esp packet is garbage padlen=%d, elen=%d\n", padlen+2, elen);
} }
ret = -EINVAL;
goto out; goto out;
} }
/* ... check padding bits here. Silly. :-) */ /* ... check padding bits here. Silly. :-) */
...@@ -280,13 +292,13 @@ int esp6_input(struct xfrm_state *x, struct xfrm_decap_state *decap, struct sk_b ...@@ -280,13 +292,13 @@ int esp6_input(struct xfrm_state *x, struct xfrm_decap_state *decap, struct sk_b
memcpy(skb->nh.raw, tmp_hdr, hdr_len); memcpy(skb->nh.raw, tmp_hdr, hdr_len);
skb->nh.ipv6h->payload_len = htons(skb->len - sizeof(struct ipv6hdr)); skb->nh.ipv6h->payload_len = htons(skb->len - sizeof(struct ipv6hdr));
ip6_find_1stfragopt(skb, &prevhdr); ip6_find_1stfragopt(skb, &prevhdr);
ret_nexthdr = *prevhdr = nexthdr[1]; ret = *prevhdr = nexthdr[1];
} }
kfree(tmp_hdr);
return ret_nexthdr;
out: out:
return -EINVAL; kfree(tmp_hdr);
out_nofree:
return ret;
} }
static u32 esp6_get_max_size(struct xfrm_state *x, int mtu) static u32 esp6_get_max_size(struct xfrm_state *x, int mtu)
......
...@@ -1243,6 +1243,7 @@ int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to, int offse ...@@ -1243,6 +1243,7 @@ int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to, int offse
dst_hold(&rt->u.dst); dst_hold(&rt->u.dst);
np->cork.rt = rt; np->cork.rt = rt;
np->cork.fl = fl; np->cork.fl = fl;
np->cork.hop_limit = hlimit;
inet->cork.fragsize = mtu = dst_pmtu(&rt->u.dst); inet->cork.fragsize = mtu = dst_pmtu(&rt->u.dst);
inet->cork.length = 0; inet->cork.length = 0;
inet->sndmsg_page = NULL; inet->sndmsg_page = NULL;
...@@ -1465,7 +1466,7 @@ int ip6_push_pending_frames(struct sock *sk) ...@@ -1465,7 +1466,7 @@ int ip6_push_pending_frames(struct sock *sk)
hdr->payload_len = htons(skb->len - sizeof(struct ipv6hdr)); hdr->payload_len = htons(skb->len - sizeof(struct ipv6hdr));
else else
hdr->payload_len = 0; hdr->payload_len = 0;
hdr->hop_limit = np->hop_limit; hdr->hop_limit = np->cork.hop_limit;
hdr->nexthdr = proto; hdr->nexthdr = proto;
ipv6_addr_copy(&hdr->saddr, &fl->fl6_src); ipv6_addr_copy(&hdr->saddr, &fl->fl6_src);
ipv6_addr_copy(&hdr->daddr, final_dst); ipv6_addr_copy(&hdr->daddr, final_dst);
......
...@@ -329,7 +329,7 @@ ip6t_do_table(struct sk_buff **pskb, ...@@ -329,7 +329,7 @@ ip6t_do_table(struct sk_buff **pskb,
struct ip6t_table *table, struct ip6t_table *table,
void *userdata) void *userdata)
{ {
static const char nulldevname[IFNAMSIZ] = { 0 }; static const char nulldevname[IFNAMSIZ];
u_int16_t offset = 0; u_int16_t offset = 0;
struct ipv6hdr *ipv6; struct ipv6hdr *ipv6;
void *protohdr; void *protohdr;
......
...@@ -68,7 +68,7 @@ static void *ckey; ...@@ -68,7 +68,7 @@ static void *ckey;
static void *skey; static void *skey;
/* Module parameters */ /* Module parameters */
static int eth = 0; /* Use "eth" or "irlan" name for devices */ static int eth; /* Use "eth" or "irlan" name for devices */
static int access = ACCESS_PEER; /* PEER, DIRECT or HOSTED */ static int access = ACCESS_PEER; /* PEER, DIRECT or HOSTED */
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
......
...@@ -67,7 +67,7 @@ static int min_slot_timeout = 20; ...@@ -67,7 +67,7 @@ static int min_slot_timeout = 20;
static int max_max_baud_rate = 16000000; /* See qos.c - IrLAP spec */ static int max_max_baud_rate = 16000000; /* See qos.c - IrLAP spec */
static int min_max_baud_rate = 2400; static int min_max_baud_rate = 2400;
static int max_min_tx_turn_time = 10000; /* See qos.c - IrLAP spec */ static int max_min_tx_turn_time = 10000; /* See qos.c - IrLAP spec */
static int min_min_tx_turn_time = 0; static int min_min_tx_turn_time;
static int max_max_tx_data_size = 2048; /* See qos.c - IrLAP spec */ static int max_max_tx_data_size = 2048; /* See qos.c - IrLAP spec */
static int min_max_tx_data_size = 64; static int min_max_tx_data_size = 64;
static int max_max_tx_window = 7; /* See qos.c - IrLAP spec */ static int max_max_tx_window = 7; /* See qos.c - IrLAP spec */
......
...@@ -15,9 +15,9 @@ ...@@ -15,9 +15,9 @@
/* /*
* Values taken from NET/ROM documentation. * Values taken from NET/ROM documentation.
*/ */
static int min_quality[] = {0}, max_quality[] = {255}; static int min_quality[1], max_quality[] = {255};
static int min_obs[] = {0}, max_obs[] = {255}; static int min_obs[1], max_obs[] = {255};
static int min_ttl[] = {0}, max_ttl[] = {255}; static int min_ttl[1], max_ttl[] = {255};
static int min_t1[] = {5 * HZ}; static int min_t1[] = {5 * HZ};
static int max_t1[] = {600 * HZ}; static int max_t1[] = {600 * HZ};
static int min_n2[] = {2}, max_n2[] = {127}; static int min_n2[] = {2}, max_n2[] = {127};
...@@ -28,7 +28,7 @@ static int max_t4[] = {1000 * HZ}; ...@@ -28,7 +28,7 @@ static int max_t4[] = {1000 * HZ};
static int min_window[] = {1}, max_window[] = {127}; static int min_window[] = {1}, max_window[] = {127};
static int min_idle[] = {0 * HZ}; static int min_idle[] = {0 * HZ};
static int max_idle[] = {65535 * HZ}; static int max_idle[] = {65535 * HZ};
static int min_route[] = {0}, max_route[] = {1}; static int min_route[1], max_route[] = {1};
static int min_fails[] = {1}, max_fails[] = {10}; static int min_fails[] = {1}, max_fails[] = {10};
static struct ctl_table_header *nr_table_header; static struct ctl_table_header *nr_table_header;
......
...@@ -514,20 +514,11 @@ EXPORT_SYMBOL(netlink_post); ...@@ -514,20 +514,11 @@ EXPORT_SYMBOL(netlink_post);
#endif #endif
EXPORT_SYMBOL(rtattr_parse); EXPORT_SYMBOL(rtattr_parse);
EXPORT_SYMBOL(rtnetlink_links);
EXPORT_SYMBOL(__rta_fill); EXPORT_SYMBOL(__rta_fill);
EXPORT_SYMBOL(rtnetlink_dump_ifinfo);
EXPORT_SYMBOL(rtnetlink_put_metrics);
EXPORT_SYMBOL(rtnl);
EXPORT_SYMBOL(neigh_delete); EXPORT_SYMBOL(neigh_delete);
EXPORT_SYMBOL(neigh_add); EXPORT_SYMBOL(neigh_add);
EXPORT_SYMBOL(neigh_dump_info); EXPORT_SYMBOL(neigh_dump_info);
EXPORT_SYMBOL(dev_set_allmulti);
EXPORT_SYMBOL(dev_set_promiscuity);
EXPORT_SYMBOL(rtnl_sem);
EXPORT_SYMBOL(rtnl_lock);
EXPORT_SYMBOL(rtnl_unlock);
/* ABI emulation layers need this */ /* ABI emulation layers need this */
EXPORT_SYMBOL(move_addr_to_kernel); EXPORT_SYMBOL(move_addr_to_kernel);
...@@ -535,7 +526,6 @@ EXPORT_SYMBOL(move_addr_to_user); ...@@ -535,7 +526,6 @@ EXPORT_SYMBOL(move_addr_to_user);
/* Used by at least ipip.c. */ /* Used by at least ipip.c. */
EXPORT_SYMBOL(ipv4_config); EXPORT_SYMBOL(ipv4_config);
EXPORT_SYMBOL(dev_open);
/* Used by other modules */ /* Used by other modules */
EXPORT_SYMBOL(xrlim_allow); EXPORT_SYMBOL(xrlim_allow);
...@@ -611,12 +601,23 @@ EXPORT_SYMBOL(netdev_fc_xoff); ...@@ -611,12 +601,23 @@ EXPORT_SYMBOL(netdev_fc_xoff);
#endif #endif
EXPORT_SYMBOL(dev_base); EXPORT_SYMBOL(dev_base);
EXPORT_SYMBOL(dev_base_lock); EXPORT_SYMBOL(dev_base_lock);
EXPORT_SYMBOL(dev_open);
EXPORT_SYMBOL(dev_close); EXPORT_SYMBOL(dev_close);
EXPORT_SYMBOL(dev_mc_add); EXPORT_SYMBOL(dev_mc_add);
EXPORT_SYMBOL(dev_mc_delete); EXPORT_SYMBOL(dev_mc_delete);
EXPORT_SYMBOL(dev_mc_upload); EXPORT_SYMBOL(dev_mc_upload);
EXPORT_SYMBOL(dev_set_allmulti);
EXPORT_SYMBOL(dev_set_promiscuity);
EXPORT_SYMBOL(__kill_fasync); EXPORT_SYMBOL(__kill_fasync);
EXPORT_SYMBOL(rtnl);
EXPORT_SYMBOL(rtnetlink_links);
EXPORT_SYMBOL(rtnetlink_dump_ifinfo);
EXPORT_SYMBOL(rtnetlink_put_metrics);
EXPORT_SYMBOL(rtnl_sem);
EXPORT_SYMBOL(rtnl_lock);
EXPORT_SYMBOL(rtnl_unlock);
#ifdef CONFIG_HIPPI #ifdef CONFIG_HIPPI
EXPORT_SYMBOL(hippi_type_trans); EXPORT_SYMBOL(hippi_type_trans);
#endif #endif
......
...@@ -16,7 +16,7 @@ static int min_timer[] = {1 * HZ}; ...@@ -16,7 +16,7 @@ static int min_timer[] = {1 * HZ};
static int max_timer[] = {300 * HZ}; static int max_timer[] = {300 * HZ};
static int min_idle[] = {0 * HZ}; static int min_idle[] = {0 * HZ};
static int max_idle[] = {65535 * HZ}; static int max_idle[] = {65535 * HZ};
static int min_route[] = {0}, max_route[] = {1}; static int min_route[1], max_route[] = {1};
static int min_ftimer[] = {60 * HZ}; static int min_ftimer[] = {60 * HZ};
static int max_ftimer[] = {600 * HZ}; static int max_ftimer[] = {600 * HZ};
static int min_maxvcs[] = {1}, max_maxvcs[] = {254}; static int min_maxvcs[] = {1}, max_maxvcs[] = {254};
......
...@@ -645,7 +645,7 @@ static int atm_tc_dump_class(struct Qdisc *sch, unsigned long cl, ...@@ -645,7 +645,7 @@ static int atm_tc_dump_class(struct Qdisc *sch, unsigned long cl,
if (flow->excess) if (flow->excess)
RTA_PUT(skb,TCA_ATM_EXCESS,sizeof(u32),&flow->classid); RTA_PUT(skb,TCA_ATM_EXCESS,sizeof(u32),&flow->classid);
else { else {
static u32 zero = 0; static u32 zero;
RTA_PUT(skb,TCA_ATM_EXCESS,sizeof(zero),&zero); RTA_PUT(skb,TCA_ATM_EXCESS,sizeof(zero),&zero);
} }
......
...@@ -45,7 +45,7 @@ struct des_cred { ...@@ -45,7 +45,7 @@ struct des_cred {
* Make sure we don't place more than one call to the key server at * Make sure we don't place more than one call to the key server at
* a time. * a time.
*/ */
static int in_keycall = 0; static int in_keycall;
#define FAIL(err) \ #define FAIL(err) \
{ if (data) put_cred(data); \ { if (data) put_cred(data); \
...@@ -202,7 +202,7 @@ svcauth_des(struct svc_rqst *rqstp, u32 *statp, u32 *authp) ...@@ -202,7 +202,7 @@ svcauth_des(struct svc_rqst *rqstp, u32 *statp, u32 *authp)
static struct des_cred * static struct des_cred *
get_cred_byname(struct svc_rqst *rqstp, u32 *authp, char *fullname, u32 *cryptkey) get_cred_byname(struct svc_rqst *rqstp, u32 *authp, char *fullname, u32 *cryptkey)
{ {
static int in_keycall = 0; static int in_keycall;
struct des_cred *cred; struct des_cred *cred;
if (in_keycall) { if (in_keycall) {
......
...@@ -579,8 +579,8 @@ xprt_complete_rqst(struct rpc_xprt *xprt, struct rpc_rqst *req, int copied) ...@@ -579,8 +579,8 @@ xprt_complete_rqst(struct rpc_xprt *xprt, struct rpc_rqst *req, int copied)
#ifdef RPC_PROFILE #ifdef RPC_PROFILE
/* Profile only reads for now */ /* Profile only reads for now */
if (copied > 1024) { if (copied > 1024) {
static unsigned long nextstat = 0; static unsigned long nextstat;
static unsigned long pkt_rtt = 0, pkt_len = 0, pkt_cnt = 0; static unsigned long pkt_rtt, pkt_len, pkt_cnt;
pkt_cnt++; pkt_cnt++;
pkt_len += req->rq_slen + copied; pkt_len += req->rq_slen + copied;
......
...@@ -485,7 +485,8 @@ int xfrm_state_update(struct xfrm_state *x) ...@@ -485,7 +485,8 @@ int xfrm_state_update(struct xfrm_state *x)
err = -EINVAL; err = -EINVAL;
spin_lock_bh(&x1->lock); spin_lock_bh(&x1->lock);
if (likely(x1->km.state == XFRM_STATE_VALID)) { if (likely(x1->km.state == XFRM_STATE_VALID)) {
memcpy(x1->encap, x->encap, sizeof(*x1->encap)); if (x->encap && x1->encap)
memcpy(x1->encap, x->encap, sizeof(*x1->encap));
memcpy(&x1->lft, &x->lft, sizeof(x1->lft)); memcpy(&x1->lft, &x->lft, sizeof(x1->lft));
x1->km.dying = 0; x1->km.dying = 0;
err = 0; err = 0;
......
...@@ -459,8 +459,8 @@ static int xfrm_alloc_userspi(struct sk_buff *skb, struct nlmsghdr *nlh, void ** ...@@ -459,8 +459,8 @@ static int xfrm_alloc_userspi(struct sk_buff *skb, struct nlmsghdr *nlh, void **
if (err) if (err)
goto out_noput; goto out_noput;
x = xfrm_find_acq(p->info.mode, p->info.reqid, p->info.id.proto, x = xfrm_find_acq(p->info.mode, p->info.reqid, p->info.id.proto,
&p->info.sel.daddr, &p->info.id.daddr,
&p->info.sel.saddr, 1, &p->info.saddr, 1,
p->info.family); p->info.family);
err = -ENOENT; err = -ENOENT;
if (x == NULL) if (x == NULL)
...@@ -937,7 +937,7 @@ static int xfrm_user_rcv_skb(struct sk_buff *skb) ...@@ -937,7 +937,7 @@ static int xfrm_user_rcv_skb(struct sk_buff *skb)
rlen = NLMSG_ALIGN(nlh->nlmsg_len); rlen = NLMSG_ALIGN(nlh->nlmsg_len);
if (rlen > skb->len) if (rlen > skb->len)
rlen = skb->len; rlen = skb->len;
if (xfrm_user_rcv_msg(skb, nlh, &err)) { if (xfrm_user_rcv_msg(skb, nlh, &err) < 0) {
if (err == 0) if (err == 0)
return -1; return -1;
netlink_ack(skb, nlh, err); netlink_ack(skb, nlh, err);
......
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