Commit cbec8fba 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 c2e2d4f7 d171187b
......@@ -31,6 +31,11 @@ ipfrag_low_thresh - INTEGER
ipfrag_time - INTEGER
Time in seconds to keep an IP fragment in memory.
ipfrag_secret_interval - INTEGER
Regeneration interval (in seconds) of the hash secret (or lifetime
for the hash secret) for IP fragments.
Default: 600
INET peer storage:
inet_peer_threshold - INTEGER
......@@ -515,6 +520,25 @@ bindv6only - BOOLEAN
Default: FALSE (as specified in RFC2553bis)
IPv6 Fragmentation:
ip6frag_high_thresh - INTEGER
Maximum memory used to reassemble IPv6 fragments. When
ip6frag_high_thresh bytes of memory is allocated for this purpose,
the fragment handler will toss packets until ip6frag_low_thresh
is reached.
ip6frag_low_thresh - INTEGER
See ip6frag_high_thresh
ip6frag_time - INTEGER
Time in seconds to keep an IPv6 fragment in memory.
ip6frag_secret_interval - INTEGER
Regeneration interval (in seconds) of the hash secret (or lifetime
for the hash secret) for IPv6 fragments.
Default: 600
conf/default/*:
Change the interface-specific default settings.
......
......@@ -304,7 +304,7 @@ static int eth_configure(int n, void *init, char *mac,
}
memset(device, 0, sizeof(*device));
device->list = INIT_LIST_HEAD(device->list);
INIT_LIST_HEAD(&device->list);
device->index = n;
spin_lock(&devices_lock);
......@@ -362,7 +362,7 @@ static int eth_configure(int n, void *init, char *mac,
return 1;
lp = dev->priv;
lp->list = INIT_LIST_HEAD(lp->list);
INIT_LIST_HEAD(&lp->list);
spin_lock_init(&lp->lock);
lp->dev = dev;
lp->fd = -1;
......@@ -537,7 +537,7 @@ static int eth_setup(char *str)
return(1);
}
new->list = INIT_LIST_HEAD(new->list);
INIT_LIST_HEAD(&new->list);
new->index = n;
new->init = str;
......
......@@ -6,16 +6,12 @@ menu "Cryptographic options"
config CRYPTO
bool "Cryptographic API"
default y if INET_AH=y || INET_AH=m || INET_ESP=y || INET_ESP=m || INET6_AH=y || INET6_AH=m || \
INET6_ESP=y || INET6_ESP=m || INET6_IPCOMP=y || INET6_IPCOMP=m || IPV6_PRIVACY=y
help
This option provides the core Cryptographic API.
config CRYPTO_HMAC
bool "HMAC support"
depends on CRYPTO
default y if INET_AH=y || INET_AH=m || INET_ESP=y || INET_ESP=m || INET6_AH=y || INET6_AH=m || \
INET6_ESP=y || INET6_ESP=m
help
HMAC: Keyed-Hashing for Message Authentication (RFC2104).
This is required for IPSec.
......@@ -35,16 +31,12 @@ config CRYPTO_MD4
config CRYPTO_MD5
tristate "MD5 digest algorithm"
depends on CRYPTO
default y if INET_AH=y || INET_AH=m || INET_ESP=y || INET_ESP=m || INET6_AH=y || INET6_AH=m || \
INET6_ESP=y || INET6_ESP=m || IPV6_PRIVACY=y
help
MD5 message digest algorithm (RFC1321).
config CRYPTO_SHA1
tristate "SHA1 digest algorithm"
depends on CRYPTO
default y if INET_AH=y || INET_AH=m || INET_ESP=y || INET_ESP=m || INET6_AH=y || INET6_AH=m || \
INET6_ESP=y || INET6_ESP=m
help
SHA-1 secure hash standard (FIPS 180-1/DFIPS 180-2).
......@@ -72,7 +64,6 @@ config CRYPTO_SHA512
config CRYPTO_DES
tristate "DES and Triple DES EDE cipher algorithms"
depends on CRYPTO
default y if INET_ESP=y || INET_ESP=m || INET6_ESP=y || INET6_ESP=m
help
DES cipher algorithm (FIPS 46-2), and Triple DES EDE (FIPS 46-3).
......@@ -138,7 +129,6 @@ config CRYPTO_AES
config CRYPTO_DEFLATE
tristate "Deflate compression algorithm"
depends on CRYPTO
default y if INET_IPCOMP=y || INET_IPCOMP=m || INET6_IPCOMP=y || INET6_IPCOMP=m
help
This is the Deflate algorithm (RFC1951), specified for use in
IPSec with the IPCOMP protocol (RFC3173, RFC2394).
......
This diff is collapsed.
This diff is collapsed.
......@@ -300,17 +300,11 @@ static int nopnp;
*
* Both call el3_common_init/el3_common_remove. */
static int __init el3_common_init (struct net_device *dev)
static void __init el3_common_init(struct net_device *dev)
{
struct el3_private *lp = dev->priv;
short i;
el3_cards++;
if (!lp->dev) /* probed devices are not chained */
{
lp->next_dev = el3_root_dev;
el3_root_dev = dev;
}
spin_lock_init(&lp->lock);
if (dev->mem_start & 0x05) { /* xcvr codes 1/3/4/12 */
......@@ -343,8 +337,6 @@ static int __init el3_common_init (struct net_device *dev)
dev->tx_timeout = el3_tx_timeout;
dev->watchdog_timeo = TX_TIMEOUT;
dev->do_ioctl = netdev_ioctl;
return 0;
}
static void el3_common_remove (struct net_device *dev)
......@@ -374,6 +366,7 @@ static int __init el3_probe(int card_idx)
int ioaddr, irq, if_port;
u16 phys_addr[3];
static int current_tag;
int err = -ENODEV;
#if defined(__ISAPNP__) && !defined(CONFIG_X86_PC9800)
static int pnp_cards;
struct pnp_dev *idev = NULL;
......@@ -413,7 +406,8 @@ static int __init el3_probe(int card_idx)
phys_addr[j] =
htons(read_eeprom(ioaddr, j));
if_port = read_eeprom(ioaddr, 8) >> 14;
if (!(dev = init_etherdev(NULL, sizeof(struct el3_private)))) {
dev = alloc_etherdev(sizeof (struct el3_private));
if (!dev) {
release_region(ioaddr, EL3_IO_EXTENT);
pnp_device_detach(idev);
return -ENOMEM;
......@@ -421,6 +415,8 @@ static int __init el3_probe(int card_idx)
SET_MODULE_OWNER(dev);
pnp_cards++;
netdev_boot_setup_check(dev);
goto found;
}
}
......@@ -514,28 +510,29 @@ static int __init el3_probe(int card_idx)
irq = 13;
#endif
if (!(dev = init_etherdev(NULL, sizeof(struct el3_private))))
return -ENOMEM;
dev = alloc_etherdev(sizeof (struct el3_private));
if (!dev)
return -ENOMEM;
SET_MODULE_OWNER(dev);
netdev_boot_setup_check(dev);
/* Set passed-in IRQ or I/O Addr. */
if (dev->irq > 1 && dev->irq < 16)
irq = dev->irq;
if (dev->base_addr) {
if (dev->mem_end == 0x3c509 /* Magic key */
&& dev->base_addr >= 0x200 && dev->base_addr <= 0x3e0)
ioaddr = dev->base_addr & 0x3f0;
else if (dev->base_addr != ioaddr) {
unregister_netdev (dev);
return -ENODEV;
}
if (dev->mem_end == 0x3c509 /* Magic key */
&& dev->base_addr >= 0x200 && dev->base_addr <= 0x3e0)
ioaddr = dev->base_addr & 0x3f0;
else if (dev->base_addr != ioaddr)
goto out;
}
if (!request_region(ioaddr, EL3_IO_EXTENT, "3c509")) {
unregister_netdev (dev);
return -EBUSY;
err = -EBUSY;
goto out;
}
/* Set the adaptor tag so that the next card can be found. */
......@@ -549,11 +546,8 @@ static int __init el3_probe(int card_idx)
#endif
EL3WINDOW(0);
if (inw(ioaddr) != 0x6d50) {
unregister_netdev (dev);
release_region(ioaddr, EL3_IO_EXTENT);
return -ENODEV;
}
if (inw(ioaddr) != 0x6d50)
goto out1;
/* Free the interrupt so that some other card can use it. */
outw(0x0f00, ioaddr + WN0_IRQ);
......@@ -570,6 +564,11 @@ static int __init el3_probe(int card_idx)
#if defined(__ISAPNP__) && !defined(CONFIG_X86_PC9800)
lp->dev = &idev->dev;
#endif
el3_common_init(dev);
err = register_netdev(dev);
if (err)
goto out1;
#ifdef CONFIG_PM
/* register power management */
......@@ -581,7 +580,22 @@ static int __init el3_probe(int card_idx)
}
#endif
return el3_common_init (dev);
el3_cards++;
#if !defined(__ISAPNP__) || defined(CONFIG_X86_PC9800)
lp->next_dev = el3_root_dev;
el3_root_dev = dev;
#endif
return 0;
out1:
release_region(ioaddr, EL3_IO_EXTENT);
#if defined(__ISAPNP__) && !defined(CONFIG_X86_PC9800)
if (idev)
pnp_device_detach(idev);
#endif
out:
kfree(dev);
return err;
}
#ifdef CONFIG_MCA
......@@ -602,6 +616,7 @@ static int __init el3_mca_probe(struct device *device) {
u_char pos4, pos5;
struct mca_device *mdev = to_mca_device(device);
int slot = mdev->slot;
int err;
pos4 = mca_device_read_stored_pos(mdev, 4);
pos5 = mca_device_read_stored_pos(mdev, 5);
......@@ -630,13 +645,14 @@ static int __init el3_mca_probe(struct device *device) {
phys_addr[i] = htons(read_eeprom(ioaddr, i));
}
dev = init_etherdev(NULL, sizeof(struct el3_private));
dev = alloc_etherdev(sizeof (struct el3_private));
if (dev == NULL) {
release_region(ioaddr, EL3_IO_EXTENT);
return -ENOMEM;
}
SET_MODULE_OWNER(dev);
netdev_boot_setup_check(dev);
memcpy(dev->dev_addr, phys_addr, sizeof(phys_addr));
dev->base_addr = ioaddr;
......@@ -646,8 +662,16 @@ static int __init el3_mca_probe(struct device *device) {
lp->dev = device;
lp->type = EL3_MCA;
device->driver_data = dev;
el3_common_init(dev);
err = register_netdev(dev);
if (err) {
release_region(ioaddr, EL3_IO_EXTENT);
return -ENOMEM;
}
return el3_common_init (dev);
el3_cards++;
return 0;
}
#endif /* CONFIG_MCA */
......@@ -661,6 +685,7 @@ static int __init el3_eisa_probe (struct device *device)
u16 phys_addr[3];
struct net_device *dev = NULL;
struct eisa_device *edev;
int err;
/* Yeepee, The driver framework is calling us ! */
edev = to_eisa_device (device);
......@@ -680,7 +705,7 @@ static int __init el3_eisa_probe (struct device *device)
/* Restore the "Product ID" to the EEPROM read register. */
read_eeprom(ioaddr, 3);
dev = init_etherdev(NULL, sizeof(struct el3_private));
dev = alloc_etherdev(sizeof (struct el3_private));
if (dev == NULL) {
release_region(ioaddr, EL3_IO_EXTENT);
return -ENOMEM;
......@@ -688,6 +713,8 @@ static int __init el3_eisa_probe (struct device *device)
SET_MODULE_OWNER(dev);
netdev_boot_setup_check(dev);
memcpy(dev->dev_addr, phys_addr, sizeof(phys_addr));
dev->base_addr = ioaddr;
dev->irq = irq;
......@@ -696,8 +723,16 @@ static int __init el3_eisa_probe (struct device *device)
lp->dev = device;
lp->type = EL3_EISA;
eisa_set_drvdata (edev, dev);
el3_common_init(dev);
err = register_netdev(dev);
if (err) {
release_region(ioaddr, EL3_IO_EXTENT);
return err;
}
return el3_common_init (dev);
el3_cards++;
return 0;
}
#endif
......
......@@ -250,8 +250,6 @@ struct scc_info {
/* Function declarations */
int dmascc_init(void) __init;
static int setup_adapter(int card_base, int type, int n) __init;
static void write_scc(struct scc_priv *priv, int reg, int val);
......@@ -299,23 +297,12 @@ static struct scc_info *first;
static unsigned long rand;
/* Module functions */
#ifdef MODULE
MODULE_AUTHOR("Klaus Kudielka");
MODULE_DESCRIPTION("Driver for high-speed SCC boards");
MODULE_PARM(io, "1-" __MODULE_STRING(MAX_NUM_DEVS) "i");
MODULE_LICENSE("GPL");
int init_module(void) {
return dmascc_init();
}
void cleanup_module(void) {
static void __exit dmascc_exit(void) {
int i;
struct scc_info *info;
......@@ -341,24 +328,16 @@ void cleanup_module(void) {
}
}
#else
#ifndef MODULE
void __init dmascc_setup(char *str, int *ints) {
int i;
for (i = 0; i < MAX_NUM_DEVS && i < ints[0]; i++)
io[i] = ints[i+1];
}
#endif
/* Initialization functions */
int __init dmascc_init(void) {
static int __init dmascc_init(void) {
int h, i, j, n;
int base[MAX_NUM_DEVS], tcmd[MAX_NUM_DEVS], t0[MAX_NUM_DEVS],
t1[MAX_NUM_DEVS];
......@@ -461,6 +440,9 @@ int __init dmascc_init(void) {
return -EIO;
}
module_init(dmascc_init);
module_exit(dmascc_exit);
int __init setup_adapter(int card_base, int type, int n) {
int i, irq, chip;
......@@ -580,6 +562,7 @@ int __init setup_adapter(int card_base, int type, int n) {
if (sizeof(dev->name) == sizeof(char *)) dev->name = priv->name;
#endif
sprintf(dev->name, "dmascc%i", 2*n+i);
SET_MODULE_OWNER(dev);
dev->base_addr = card_base;
dev->irq = irq;
dev->open = scc_open;
......@@ -707,12 +690,9 @@ static int scc_open(struct net_device *dev) {
struct scc_info *info = priv->info;
int card_base = priv->card_base;
MOD_INC_USE_COUNT;
/* Request IRQ if not already used by other channel */
if (!info->irq_used) {
if (request_irq(dev->irq, scc_isr, 0, "dmascc", info)) {
MOD_DEC_USE_COUNT;
return -EAGAIN;
}
}
......@@ -722,7 +702,6 @@ static int scc_open(struct net_device *dev) {
if (priv->param.dma >= 0) {
if (request_dma(priv->param.dma, "dmascc")) {
if (--info->irq_used == 0) free_irq(dev->irq, info);
MOD_DEC_USE_COUNT;
return -EAGAIN;
} else {
unsigned long flags = claim_dma_lock();
......@@ -866,7 +845,6 @@ static int scc_close(struct net_device *dev) {
}
if (--info->irq_used == 0) free_irq(dev->irq, info);
MOD_DEC_USE_COUNT;
return 0;
}
......
......@@ -9,8 +9,6 @@
#include <linux/init.h>
#include <linux/netlink.h>
extern int dmascc_init(void);
extern int scc_enet_init(void);
extern int fec_enet_init(void);
......@@ -29,10 +27,6 @@ static struct net_probe pci_probes[] __initdata = {
/*
* Early setup devices
*/
#if defined(CONFIG_DMASCC)
{dmascc_init, 0},
#endif
#if defined(CONFIG_SCC_ENET)
{scc_enet_init, 0},
#endif
......
......@@ -383,6 +383,7 @@ struct s_DevNet {
int Mtu;
int Up;
SK_AC *pAC;
struct proc_dir_entry *proc;
};
typedef struct s_TxPort TX_PORT;
......
......@@ -351,11 +351,7 @@ static int SkGeIocMib(DEV_NET*, unsigned int, int);
static const char SK_Root_Dir_entry[] = "sk98lin";
static struct proc_dir_entry *pSkRootDir;
//extern struct proc_dir_entry Our_Proc_Dir;
extern int sk_proc_read(char *buffer, char **buffer_location,
off_t offset, int buffer_length, int *eof, void *data);
extern struct file_operations sk_proc_fops;
#ifdef DEBUG
static void DumpMsg(struct sk_buff*, char*);
......@@ -399,7 +395,6 @@ static int __init skge_probe (void)
struct pci_dev *pdev = NULL;
unsigned long base_address;
struct net_device *dev = NULL;
struct proc_dir_entry *pProcFile;
if (probed)
return -ENODEV;
......@@ -420,7 +415,6 @@ static int __init skge_probe (void)
while((pdev = pci_find_device(PCI_VENDOR_ID_SYSKONNECT,
PCI_DEVICE_ID_SYSKONNECT_GE, pdev)) != NULL) {
dev = NULL;
pNet = NULL;
if (pci_enable_device(pdev))
......@@ -431,7 +425,8 @@ static int __init skge_probe (void)
pci_set_dma_mask(pdev, (u64) 0xffffffff))
continue;
if ((dev = init_etherdev(dev, sizeof(DEV_NET))) == 0) {
dev = alloc_etherdev(sizeof(DEV_NET));
if (!dev) {
printk(KERN_ERR "Unable to allocate etherdev "
"structure!\n");
break;
......@@ -440,7 +435,7 @@ static int __init skge_probe (void)
pNet = dev->priv;
pNet->pAC = kmalloc(sizeof(SK_AC), GFP_KERNEL);
if (pNet->pAC == NULL){
kfree(dev->priv);
kfree(dev);
printk(KERN_ERR "Unable to allocate adapter "
"structure!\n");
break;
......@@ -477,15 +472,6 @@ static int __init skge_probe (void)
proc_root_initialized = 1;
}
pProcFile = create_proc_entry(dev->name,
S_IFREG | 0444, pSkRootDir);
pProcFile->read_proc = sk_proc_read;
pProcFile->write_proc = NULL;
pProcFile->nlink = 1;
pProcFile->size = sizeof(dev->name+1);
pProcFile->data = (void*)pProcFile;
pProcFile->owner = THIS_MODULE;
/*
* Dummy value.
*/
......@@ -532,11 +518,29 @@ static int __init skge_probe (void)
pNet->PortNr = 0;
pNet->NetNr = 0;
if (register_netdev(dev) != 0) {
printk(KERN_ERR "Unable to register etherdev\n");
sk98lin_root_dev = pAC->Next;
remove_proc_entry(dev->name, pSkRootDir);
FreeResources(dev);
kfree(dev);
continue;
}
pNet->proc = create_proc_entry(dev->name,
S_IFREG | 0444, pSkRootDir);
if (pNet->proc) {
pNet->proc->data = dev;
pNet->proc->owner = THIS_MODULE;
pNet->proc->proc_fops = &sk_proc_fops;
}
boards_found++;
/* More then one port found */
if ((pAC->GIni.GIMacsFound == 2 ) && (pAC->RlmtNets == 2)) {
if ((dev = init_etherdev(NULL, sizeof(DEV_NET))) == 0) {
dev = alloc_etherdev(sizeof(DEV_NET));
if (!dev) {
printk(KERN_ERR "Unable to allocate etherdev "
"structure!\n");
break;
......@@ -559,20 +563,25 @@ static int __init skge_probe (void)
dev->do_ioctl = &SkGeIoctl;
dev->change_mtu = &SkGeChangeMtu;
pProcFile = create_proc_entry(dev->name,
S_IFREG | 0444, pSkRootDir);
pProcFile->read_proc = sk_proc_read;
pProcFile->write_proc = NULL;
pProcFile->nlink = 1;
pProcFile->size = sizeof(dev->name+1);
pProcFile->data = (void*)pProcFile;
pProcFile->owner = THIS_MODULE;
memcpy((caddr_t) &dev->dev_addr,
(caddr_t) &pAC->Addr.Net[1].CurrentMacAddress, 6);
printk("%s: %s\n", dev->name, pAC->DeviceStr);
printk(" PrefPort:B RlmtMode:Dual Check Link State\n");
if (register_netdev(dev) != 0) {
printk(KERN_ERR "Unable to register etherdev\n");
kfree(dev);
break;
}
pNet->proc = create_proc_entry(dev->name,
S_IFREG | 0444, pSkRootDir);
if (pNet->proc) {
pNet->proc->data = dev;
pNet->proc->owner = THIS_MODULE;
pNet->proc->proc_fops = &sk_proc_fops;
}
}
......@@ -740,6 +749,7 @@ static int __init skge_init_module(void)
return cards ? 0 : -ENODEV;
} /* skge_init_module */
spinlock_t sk_devs_lock = SPIN_LOCK_UNLOCKED;
/*****************************************************************************
*
......@@ -766,6 +776,11 @@ SK_EVPARA EvPara;
netif_stop_queue(sk98lin_root_dev);
SkGeYellowLED(pAC, pAC->IoBase, 0);
if (pNet->proc) {
spin_lock(&sk_devs_lock);
pNet->proc->data = NULL;
spin_unlock(&sk_devs_lock);
}
if(pAC->BoardLevel == 2) {
/* board is still alive */
......@@ -792,6 +807,12 @@ SK_EVPARA EvPara;
}
if ((pAC->GIni.GIMacsFound == 2) && pAC->RlmtNets == 2){
pNet = (DEV_NET*) pAC->dev[1]->priv;
if (pNet->proc) {
spin_lock(&sk_devs_lock);
pNet->proc->data = NULL;
spin_unlock(&sk_devs_lock);
}
unregister_netdev(pAC->dev[1]);
kfree(pAC->dev[1]);
}
......
This diff is collapsed.
......@@ -1682,11 +1682,13 @@ static int __init init_sdla(void)
static void __exit exit_sdla(void)
{
#ifdef MODULE
unregister_netdev(&sdla0);
if (sdla0.priv)
kfree(sdla0.priv);
if (sdla0.irq)
free_irq(sdla0.irq, &sdla0);
#endif
}
MODULE_LICENSE("GPL");
......
......@@ -50,7 +50,7 @@
#define RTM_MAX (RTM_BASE+31)
/*
Generic structure for encapsulation optional route information.
Generic structure for encapsulation of optional route information.
It is reminiscent of sockaddr, but with sa_family replaced
with attribute type.
*/
......
......@@ -111,9 +111,10 @@ static inline void fib6_walker_unlink(struct fib6_walker_t *w)
struct rt6_statistics {
__u32 fib_nodes;
__u32 fib_route_nodes;
__u32 fib_rt_alloc; /* permanet routes */
__u32 fib_rt_alloc; /* permanent routes */
__u32 fib_rt_entries; /* rt entries in table */
__u32 fib_rt_cache; /* cache routes */
__u32 fib_discarded_routes;
};
#define RTN_TL_ROOT 0x0001
......
......@@ -42,6 +42,11 @@
*/
/*
* RFC 1213: MIB-II
* RFC 2011 (updates 1213): SNMPv2-MIB-IP
* RFC 2863: Interfaces Group MIB
*/
struct ip_mib
{
unsigned long IpInReceives;
......@@ -64,6 +69,9 @@ struct ip_mib
unsigned long __pad[0];
};
/*
* RFC 2465: IPv6 MIB: General Group
*/
struct ipv6_mib
{
unsigned long Ip6InReceives;
......@@ -91,6 +99,10 @@ struct ipv6_mib
unsigned long __pad[0];
};
/*
* RFC 1213: MIB-II ICMP Group
* RFC 2011 (updates 1213): SNMPv2 MIB for IP: ICMP group
*/
struct icmp_mib
{
unsigned long IcmpInMsgs;
......@@ -123,6 +135,9 @@ struct icmp_mib
unsigned long __pad[0];
};
/*
* RFC 2466: ICMPv6-MIB
*/
struct icmpv6_mib
{
unsigned long Icmp6InMsgs;
......@@ -161,6 +176,10 @@ struct icmpv6_mib
unsigned long __pad[0];
};
/*
* RFC 1213: MIB-II TCP group
* RFC 2012 (updates 1213): SNMPv2-MIB-TCP
*/
struct tcp_mib
{
unsigned long TcpRtoAlgorithm;
......@@ -180,6 +199,10 @@ struct tcp_mib
unsigned long __pad[0];
};
/*
* RFC 1213: MIB-II UDP group
* RFC 2013 (updates 1213): SNMPv2-MIB-UDP
*/
struct udp_mib
{
unsigned long UdpInDatagrams;
......
/*
* net/dst.c Protocol independent destination cache.
* net/core/dst.c Protocol independent destination cache.
*
* Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru>
* Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru>
*
*/
......
......@@ -5,8 +5,6 @@
*
* Generic frame diversion
*
* Version: @(#)eth.c 0.41 09/09/2000
*
* Authors:
* Benoit LOCHER: initial integration within the kernel with support for ethernet
* Dave Miller: improvement on the code (correctness, performance and source files)
......
This diff is collapsed.
......@@ -41,35 +41,35 @@ int verify_iovec(struct msghdr *m, struct iovec *iov, char *address, int mode)
{
int size, err, ct;
if(m->msg_namelen)
{
if(mode==VERIFY_READ)
{
err=move_addr_to_kernel(m->msg_name, m->msg_namelen, address);
if(err<0)
goto out;
}
m->msg_name = address;
} else
m->msg_name = NULL;
if (m->msg_namelen) {
if (mode == VERIFY_READ) {
err = move_addr_to_kernel(m->msg_name, m->msg_namelen,
address);
if (err < 0)
return err;
m->msg_name = address;
} else
m->msg_name = NULL;
}
err = -EFAULT;
size = m->msg_iovlen * sizeof(struct iovec);
if (copy_from_user(iov, m->msg_iov, size))
goto out;
m->msg_iov=iov;
return -EFAULT;
for (err = 0, ct = 0; ct < m->msg_iovlen; ct++) {
m->msg_iov = iov;
err = 0;
for (ct = 0; ct < m->msg_iovlen; ct++) {
err += iov[ct].iov_len;
/* Goal is not to verify user data, but to prevent returning
negative value, which is interpreted as errno.
Overflow is still possible, but it is harmless.
/*
* Goal is not to verify user data, but to prevent returning
* negative value, which is interpreted as errno.
* Overflow is still possible, but it is harmless.
*/
if (err < 0)
return -EMSGSIZE;
}
out:
return err;
}
......@@ -81,25 +81,20 @@ int verify_iovec(struct msghdr *m, struct iovec *iov, char *address, int mode)
int memcpy_toiovec(struct iovec *iov, unsigned char *kdata, int len)
{
int err = -EFAULT;
while(len>0)
{
if(iov->iov_len)
{
while (len > 0) {
if (iov->iov_len) {
int copy = min_t(unsigned int, iov->iov_len, len);
if (copy_to_user(iov->iov_base, kdata, copy))
goto out;
kdata+=copy;
len-=copy;
iov->iov_len-=copy;
iov->iov_base+=copy;
return -EFAULT;
kdata += copy;
len -= copy;
iov->iov_len -= copy;
iov->iov_base += copy;
}
iov++;
}
err = 0;
out:
return err;
return 0;
}
/*
......@@ -110,16 +105,14 @@ int memcpy_toiovec(struct iovec *iov, unsigned char *kdata, int len)
void memcpy_tokerneliovec(struct iovec *iov, unsigned char *kdata, int len)
{
while(len>0)
{
if(iov->iov_len)
{
while (len > 0) {
if (iov->iov_len) {
int copy = min_t(unsigned int, iov->iov_len, len);
memcpy(iov->iov_base, kdata, copy);
kdata+=copy;
len-=copy;
iov->iov_len-=copy;
iov->iov_base+=copy;
kdata += copy;
len -= copy;
iov->iov_len -= copy;
iov->iov_base += copy;
}
iov++;
}
......@@ -134,59 +127,47 @@ void memcpy_tokerneliovec(struct iovec *iov, unsigned char *kdata, int len)
int memcpy_fromiovec(unsigned char *kdata, struct iovec *iov, int len)
{
int err = -EFAULT;
while(len>0)
{
if(iov->iov_len)
{
while (len > 0) {
if (iov->iov_len) {
int copy = min_t(unsigned int, len, iov->iov_len);
if (copy_from_user(kdata, iov->iov_base, copy))
goto out;
len-=copy;
kdata+=copy;
iov->iov_base+=copy;
iov->iov_len-=copy;
return -EFAULT;
len -= copy;
kdata += copy;
iov->iov_base += copy;
iov->iov_len -= copy;
}
iov++;
}
err = 0;
out:
return err;
}
return 0;
}
/*
* For use with ip_build_xmit
*/
int memcpy_fromiovecend(unsigned char *kdata, struct iovec *iov, int offset,
int len)
{
int err = -EFAULT;
/* Skip over the finished iovecs */
while(offset >= iov->iov_len)
{
while (offset >= iov->iov_len) {
offset -= iov->iov_len;
iov++;
}
while (len > 0)
{
while (len > 0) {
u8 *base = iov->iov_base + offset;
int copy = min_t(unsigned int, len, iov->iov_len - offset);
offset = 0;
if (copy_from_user(kdata, base, copy))
goto out;
len -= copy;
return -EFAULT;
len -= copy;
kdata += copy;
iov++;
}
err = 0;
out:
return err;
return 0;
}
/*
......@@ -197,7 +178,6 @@ int memcpy_fromiovecend(unsigned char *kdata, struct iovec *iov, int offset,
* ip_build_xmit must ensure that when fragmenting only the last
* call to this function will be unaligned also.
*/
int csum_partial_copy_fromiovecend(unsigned char *kdata, struct iovec *iov,
int offset, unsigned int len, int *csump)
{
......@@ -205,21 +185,19 @@ int csum_partial_copy_fromiovecend(unsigned char *kdata, struct iovec *iov,
int partial_cnt = 0, err = 0;
/* Skip over the finished iovecs */
while (offset >= iov->iov_len)
{
while (offset >= iov->iov_len) {
offset -= iov->iov_len;
iov++;
}
while (len > 0)
{
while (len > 0) {
u8 *base = iov->iov_base + offset;
int copy = min_t(unsigned int, len, iov->iov_len - offset);
offset = 0;
/* There is a remnant from previous iov. */
if (partial_cnt)
{
if (partial_cnt) {
int par_len = 4 - partial_cnt;
/* iov component is too short ... */
......@@ -227,9 +205,9 @@ int csum_partial_copy_fromiovecend(unsigned char *kdata, struct iovec *iov,
if (copy_from_user(kdata, base, copy))
goto out_fault;
kdata += copy;
base += copy;
base += copy;
partial_cnt += copy;
len -= copy;
len -= copy;
iov++;
if (len)
continue;
......@@ -247,11 +225,9 @@ int csum_partial_copy_fromiovecend(unsigned char *kdata, struct iovec *iov,
partial_cnt = 0;
}
if (len > copy)
{
if (len > copy) {
partial_cnt = copy % 4;
if (partial_cnt)
{
if (partial_cnt) {
copy -= partial_cnt;
if (copy_from_user(kdata + copy, base + copy,
partial_cnt))
......
......@@ -343,6 +343,10 @@ config SYN_COOKIES
config INET_AH
tristate "IP: AH transformation"
select CRYPTO
select CRYPTO_HMAC
select CRYPTO_MD5
select CRYPTO_SHA1
---help---
Support for IPsec AH.
......@@ -350,6 +354,11 @@ config INET_AH
config INET_ESP
tristate "IP: ESP transformation"
select CRYPTO
select CRYPTO_HMAC
select CRYPTO_MD5
select CRYPTO_SHA1
select CRYPTO_DES
---help---
Support for IPsec ESP.
......@@ -357,6 +366,8 @@ config INET_ESP
config INET_IPCOMP
tristate "IP: IPComp transformation"
select CRYPTO
select CRYPTO_DEFLATE
---help---
Support for IP Paylod Compression (RFC3173), typically needed
for IPsec.
......
......@@ -16,8 +16,8 @@ obj-$(CONFIG_IP_MROUTE) += ipmr.o
obj-$(CONFIG_NET_IPIP) += ipip.o
obj-$(CONFIG_NET_IPGRE) += ip_gre.o
obj-$(CONFIG_SYN_COOKIES) += syncookies.o
obj-$(CONFIG_INET_AH) += ah.o
obj-$(CONFIG_INET_ESP) += esp.o
obj-$(CONFIG_INET_AH) += ah4.o
obj-$(CONFIG_INET_ESP) += esp4.o
obj-$(CONFIG_INET_IPCOMP) += ipcomp.o
obj-$(CONFIG_IP_PNP) += ipconfig.o
obj-$(CONFIG_NETFILTER) += netfilter/
......
......@@ -4,6 +4,8 @@
config IPV6_PRIVACY
bool "IPv6: Privacy Extensions (RFC 3041) support"
depends on IPV6
select CRYPTO
select CRYPTO_MD5
---help---
Privacy Extensions for Stateless Address Autoconfiguration in IPv6
support. With this option, additional periodically-alter
......@@ -20,6 +22,10 @@ config IPV6_PRIVACY
config INET6_AH
tristate "IPv6: AH transformation"
depends on IPV6
select CRYPTO
select CRYPTO_HMAC
select CRYPTO_MD5
select CRYPTO_SHA1
---help---
Support for IPsec AH.
......@@ -28,6 +34,11 @@ config INET6_AH
config INET6_ESP
tristate "IPv6: ESP transformation"
depends on IPV6
select CRYPTO
select CRYPTO_HMAC
select CRYPTO_MD5
select CRYPTO_SHA1
select CRYPTO_DES
---help---
Support for IPsec ESP.
......@@ -36,6 +47,8 @@ config INET6_ESP
config INET6_IPCOMP
tristate "IPv6: IPComp transformation"
depends on IPV6
select CRYPTO
select CRYPTO_DEFLATE
---help---
Support for IP Paylod Compression (RFC3173), typically needed
for IPsec.
......
......@@ -19,7 +19,7 @@
*
* Janos Farkas : delete timer on ifdown
* <chexum@bankinf.banki.hu>
* Andi Kleen : kill doube kfree on module
* Andi Kleen : kill double kfree on module
* unload.
* Maciej W. Rozycki : FDDI support
* sekiya@USAGI : Don't send too many RS
......@@ -343,6 +343,7 @@ static struct inet6_dev * ipv6_add_dev(struct net_device *dev)
"%s(): cannot create /proc/net/dev_snmp6/%s\n",
__FUNCTION__, dev->name));
neigh_parms_release(&nd_tbl, ndev->nd_parms);
ndev->dead = 1;
in6_dev_finish_destroy(ndev);
return NULL;
}
......@@ -1256,7 +1257,7 @@ static void sit_route_add(struct net_device *dev)
rtmsg.rtmsg_type = RTMSG_NEWROUTE;
rtmsg.rtmsg_metric = IP6_RT_PRIO_ADDRCONF;
/* prefix length - 96 bytes "::d.d.d.d" */
/* prefix length - 96 bits "::d.d.d.d" */
rtmsg.rtmsg_dst_len = 96;
rtmsg.rtmsg_flags = RTF_UP|RTF_NONEXTHOP;
rtmsg.rtmsg_ifindex = dev->ifindex;
......
......@@ -310,7 +310,7 @@ int inet6_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
} else {
if (addr_type != IPV6_ADDR_ANY) {
/* ipv4 addr of the socket is invalid. Only the
* unpecified and mapped address have a v4 equivalent.
* unspecified and mapped address have a v4 equivalent.
*/
v4addr = LOOPBACK4_IPV6;
if (!(addr_type & IPV6_ADDR_MULTICAST)) {
......
......@@ -40,7 +40,6 @@
#include <net/ip6_route.h>
#define RT6_DEBUG 2
#undef CONFIG_IPV6_SUBTREES
#if RT6_DEBUG >= 3
#define RT6_TRACE(x...) printk(KERN_DEBUG x)
......@@ -594,8 +593,8 @@ int fib6_add(struct fib6_node *root, struct rt6_info *rt, struct nlmsghdr *nlh,
is orphan. If it is, shoot it.
*/
st_failure:
if (fn && !(fn->fn_flags&RTN_RTINFO|RTN_ROOT))
fib_repair_tree(fn);
if (fn && !(fn->fn_flags & (RTN_RTINFO|RTN_ROOT)))
fib6_repair_tree(fn);
dst_free(&rt->u.dst);
return err;
#endif
......@@ -896,6 +895,7 @@ static void fib6_del_route(struct fib6_node *fn, struct rt6_info **rtp,
*rtp = rt->u.next;
rt->rt6i_node = NULL;
rt6_stats.fib_rt_entries--;
rt6_stats.fib_discarded_routes++;
/* Adjust walkers */
read_lock(&fib6_walker_lock);
......
......@@ -336,7 +336,7 @@ static int rt6_ins(struct rt6_info *rt, struct nlmsghdr *nlh, void *_rtattr)
return err;
}
/* No rt6_lock! If COW faild, the function returns dead route entry
/* No rt6_lock! If COW failed, the function returns dead route entry
with dst->error set to errno value.
*/
......@@ -1786,11 +1786,12 @@ extern struct rt6_statistics rt6_stats;
static int rt6_stats_seq_show(struct seq_file *seq, void *v)
{
seq_printf(seq, "%04x %04x %04x %04x %04x %04x\n",
seq_printf(seq, "%04x %04x %04x %04x %04x %04x %04x\n",
rt6_stats.fib_nodes, rt6_stats.fib_route_nodes,
rt6_stats.fib_rt_alloc, rt6_stats.fib_rt_entries,
rt6_stats.fib_rt_cache,
atomic_read(&ip6_dst_ops.entries));
atomic_read(&ip6_dst_ops.entries),
rt6_stats.fib_discarded_routes);
return 0;
}
......
......@@ -254,7 +254,6 @@ int udpv6_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len)
struct inet_opt *inet = inet_sk(sk);
struct ipv6_pinfo *np = inet6_sk(sk);
struct in6_addr *daddr;
struct in6_addr saddr;
struct dst_entry *dst;
struct flowi fl;
struct ip6_flowlabel *flowlabel = NULL;
......@@ -355,7 +354,7 @@ int udpv6_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len)
fl.proto = IPPROTO_UDP;
ipv6_addr_copy(&fl.fl6_dst, &np->daddr);
ipv6_addr_copy(&fl.fl6_src, &saddr);
ipv6_addr_copy(&fl.fl6_src, &np->saddr);
fl.oif = sk->bound_dev_if;
fl.fl_ip_dport = inet->dport;
fl.fl_ip_sport = inet->sport;
......@@ -381,20 +380,23 @@ int udpv6_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len)
return err;
}
ip6_dst_store(sk, dst, &fl.fl6_dst);
/* get the source address used in the appropriate device */
err = ipv6_get_saddr(dst, daddr, &saddr);
err = ipv6_get_saddr(dst, daddr, &fl.fl6_src);
if (err == 0) {
if (ipv6_addr_any(&np->saddr))
ipv6_addr_copy(&np->saddr, &saddr);
ipv6_addr_copy(&np->saddr, &fl.fl6_src);
if (ipv6_addr_any(&np->rcv_saddr)) {
ipv6_addr_copy(&np->rcv_saddr, &saddr);
ipv6_addr_copy(&np->rcv_saddr, &fl.fl6_src);
inet->rcv_saddr = LOOPBACK4_IPV6;
}
ip6_dst_store(sk, dst,
!ipv6_addr_cmp(&fl.fl6_dst, &np->daddr) ?
&np->daddr : NULL);
sk->state = TCP_ESTABLISHED;
}
fl6_sock_release(flowlabel);
......
......@@ -146,7 +146,7 @@ __xfrm6_bundle_create(struct xfrm_policy *policy, struct xfrm_state **xfrm, int
memcpy(&dst_prev->metrics, &rt->u.dst.metrics, sizeof(dst_prev->metrics));
dst_prev->path = &rt->u.dst;
/* Copy neighbout for reachability confirmation */
/* Copy neighbour for reachability confirmation */
dst_prev->neighbour = neigh_clone(rt->u.dst.neighbour);
dst_prev->input = rt->u.dst.input;
dst_prev->output = dst_prev->xfrm->type->output;
......
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