Commit a2b36723 authored by Linus Torvalds's avatar Linus Torvalds

Merge bk://kernel.bkbits.net/davem/net-2.5

into home.osdl.org:/home/torvalds/v2.5/linux
parents 919ca63f 6e2920d0
...@@ -213,7 +213,7 @@ AES algorithm contributors: ...@@ -213,7 +213,7 @@ AES algorithm contributors:
Kyle McMartin Kyle McMartin
Adam J. Richter Adam J. Richter
CAST5 algorithm contributors: CAST5/CAST6 algorithm contributors:
Kartikey Mahendra Bhatt (original developers unknown, FSF copyright). Kartikey Mahendra Bhatt (original developers unknown, FSF copyright).
Generic scatterwalk code by Adam J. Richter <adam@yggdrasil.com> Generic scatterwalk code by Adam J. Richter <adam@yggdrasil.com>
......
...@@ -133,6 +133,13 @@ config CRYPTO_CAST5 ...@@ -133,6 +133,13 @@ config CRYPTO_CAST5
The CAST5 encryption algorithm (synonymous with CAST-128) is The CAST5 encryption algorithm (synonymous with CAST-128) is
described in RFC2144. described in RFC2144.
config CRYPTO_CAST6
tristate "CAST6 (CAST-256) cipher algorithm"
depends on CRYPTO
help
The CAST6 encryption algorithm (synonymous with CAST-256) is
described in RFC2612.
config CRYPTO_DEFLATE config CRYPTO_DEFLATE
tristate "Deflate compression algorithm" tristate "Deflate compression algorithm"
depends on CRYPTO depends on CRYPTO
......
...@@ -21,6 +21,7 @@ obj-$(CONFIG_CRYPTO_TWOFISH) += twofish.o ...@@ -21,6 +21,7 @@ obj-$(CONFIG_CRYPTO_TWOFISH) += twofish.o
obj-$(CONFIG_CRYPTO_SERPENT) += serpent.o obj-$(CONFIG_CRYPTO_SERPENT) += serpent.o
obj-$(CONFIG_CRYPTO_AES) += aes.o obj-$(CONFIG_CRYPTO_AES) += aes.o
obj-$(CONFIG_CRYPTO_CAST5) += cast5.o obj-$(CONFIG_CRYPTO_CAST5) += cast5.o
obj-$(CONFIG_CRYPTO_CAST6) += cast6.o
obj-$(CONFIG_CRYPTO_DEFLATE) += deflate.o obj-$(CONFIG_CRYPTO_DEFLATE) += deflate.o
obj-$(CONFIG_CRYPTO_TEST) += tcrypt.o obj-$(CONFIG_CRYPTO_TEST) += tcrypt.o
This diff is collapsed.
...@@ -48,8 +48,8 @@ static char *tvmem; ...@@ -48,8 +48,8 @@ static char *tvmem;
static char *check[] = { static char *check[] = {
"des", "md5", "des3_ede", "rot13", "sha1", "sha256", "blowfish", "des", "md5", "des3_ede", "rot13", "sha1", "sha256", "blowfish",
"twofish", "serpent", "sha384", "sha512", "md4", "aes", "deflate", "twofish", "serpent", "sha384", "sha512", "md4", "aes", "cast6",
NULL "deflate", NULL
}; };
static void static void
...@@ -2087,6 +2087,105 @@ test_serpent(void) ...@@ -2087,6 +2087,105 @@ test_serpent(void)
crypto_free_tfm(tfm); crypto_free_tfm(tfm);
} }
static void
test_cast6(void)
{
unsigned int ret, i, tsize;
u8 *p, *q, *key;
struct crypto_tfm *tfm;
struct cast6_tv *cast_tv;
struct scatterlist sg[1];
printk("\ntesting cast6 encryption\n");
tfm = crypto_alloc_tfm("cast6", 0);
if (tfm == NULL) {
printk("failed to load transform for cast6 (default ecb)\n");
return;
}
tsize = sizeof (cast6_enc_tv_template);
if (tsize > TVMEMSIZE) {
printk("template (%u) too big for tvmem (%u)\n", tsize,
TVMEMSIZE);
return;
}
memcpy(tvmem, cast6_enc_tv_template, tsize);
cast_tv = (void *) tvmem;
for (i = 0; i < CAST6_ENC_TEST_VECTORS; i++) {
printk("test %u (%d bit key):\n", i + 1, cast_tv[i].keylen * 8);
key = cast_tv[i].key;
ret = crypto_cipher_setkey(tfm, key, cast_tv[i].keylen);
if (ret) {
printk("setkey() failed flags=%x\n", tfm->crt_flags);
if (!cast_tv[i].fail)
goto out;
}
p = cast_tv[i].plaintext;
sg[0].page = virt_to_page(p);
sg[0].offset = ((long) p & ~PAGE_MASK);
sg[0].length = sizeof(cast_tv[i].plaintext);
ret = crypto_cipher_encrypt(tfm, sg, sg, sg[0].length);
if (ret) {
printk("encrypt() failed flags=%x\n", tfm->crt_flags);
goto out;
}
q = kmap(sg[0].page) + sg[0].offset;
hexdump(q, sizeof(cast_tv[i].result));
printk("%s\n", memcmp(q, cast_tv[i].result,
sizeof(cast_tv[i].result)) ? "fail" : "pass");
}
printk("\ntesting cast6 decryption\n");
tsize = sizeof (cast6_dec_tv_template);
if (tsize > TVMEMSIZE) {
printk("template (%u) too big for tvmem (%u)\n", tsize,
TVMEMSIZE);
return;
}
memcpy(tvmem, cast6_dec_tv_template, tsize);
cast_tv = (void *) tvmem;
for (i = 0; i < CAST6_DEC_TEST_VECTORS; i++) {
printk("test %u (%d bit key):\n", i + 1, cast_tv[i].keylen * 8);
key = cast_tv[i].key;
ret = crypto_cipher_setkey(tfm, key, cast_tv[i].keylen);
if (ret) {
printk("setkey() failed flags=%x\n", tfm->crt_flags);
if (!cast_tv[i].fail)
goto out;
}
p = cast_tv[i].plaintext;
sg[0].page = virt_to_page(p);
sg[0].offset = ((long) p & ~PAGE_MASK);
sg[0].length = sizeof(cast_tv[i].plaintext);
ret = crypto_cipher_decrypt(tfm, sg, sg, sg[0].length);
if (ret) {
printk("decrypt() failed flags=%x\n", tfm->crt_flags);
goto out;
}
q = kmap(sg[0].page) + sg[0].offset;
hexdump(q, sizeof(cast_tv[i].result));
printk("%s\n", memcmp(q, cast_tv[i].result,
sizeof(cast_tv[i].result)) ? "fail" : "pass");
}
out:
crypto_free_tfm(tfm);
}
void void
test_aes(void) test_aes(void)
{ {
...@@ -2396,11 +2495,13 @@ do_test(void) ...@@ -2396,11 +2495,13 @@ do_test(void)
test_blowfish(); test_blowfish();
test_twofish(); test_twofish();
test_serpent(); test_serpent();
test_cast6();
test_aes(); test_aes();
test_sha384(); test_sha384();
test_sha512(); test_sha512();
test_deflate(); test_deflate();
test_cast5(); test_cast5();
test_cast6();
#ifdef CONFIG_CRYPTO_HMAC #ifdef CONFIG_CRYPTO_HMAC
test_hmac_md5(); test_hmac_md5();
test_hmac_sha1(); test_hmac_sha1();
...@@ -2464,6 +2565,10 @@ do_test(void) ...@@ -2464,6 +2565,10 @@ do_test(void)
test_cast5(); test_cast5();
break; break;
case 15:
test_cast6();
break;
#ifdef CONFIG_CRYPTO_HMAC #ifdef CONFIG_CRYPTO_HMAC
case 100: case 100:
test_hmac_md5(); test_hmac_md5();
......
...@@ -1589,6 +1589,93 @@ struct serpent_tv serpent_dec_tv_template[] = ...@@ -1589,6 +1589,93 @@ struct serpent_tv serpent_dec_tv_template[] =
} }
}; };
/* Cast6 test vectors from RFC 2612 */
#define CAST6_ENC_TEST_VECTORS 3
#define CAST6_DEC_TEST_VECTORS 3
struct cast6_tv {
unsigned keylen;
unsigned fail;
u8 key[32];
u8 plaintext[16];
u8 result[16];
};
struct cast6_tv cast6_enc_tv_template[] =
{
{
16,
0,
{ 0x23, 0x42, 0xbb, 0x9e, 0xfa, 0x38, 0x54, 0x2c,
0x0a, 0xf7, 0x56, 0x47, 0xf2, 0x9f, 0x61, 0x5d },
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
{ 0xc8, 0x42, 0xa0, 0x89, 0x72, 0xb4, 0x3d, 0x20,
0x83, 0x6c, 0x91, 0xd1, 0xb7, 0x53, 0x0f, 0x6b },
},
{
24,
0,
{ 0x23, 0x42, 0xbb, 0x9e, 0xfa, 0x38, 0x54, 0x2c,
0xbe, 0xd0, 0xac, 0x83, 0x94, 0x0a, 0xc2, 0x98,
0xba, 0xc7, 0x7a, 0x77, 0x17, 0x94, 0x28, 0x63 },
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
{ 0x1b, 0x38, 0x6c, 0x02, 0x10, 0xdc, 0xad, 0xcb,
0xdd, 0x0e, 0x41, 0xaa, 0x08, 0xa7, 0xa7, 0xe8 },
},
{
32,
0,
{ 0x23, 0x42, 0xbb, 0x9e, 0xfa, 0x38, 0x54, 0x2c,
0xbe, 0xd0, 0xac, 0x83, 0x94, 0x0a, 0xc2, 0x98,
0x8d, 0x7c, 0x47, 0xce, 0x26, 0x49, 0x08, 0x46,
0x1c, 0xc1, 0xb5, 0x13, 0x7a, 0xe6, 0xb6, 0x04 },
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
{ 0x4f, 0x6a, 0x20, 0x38, 0x28, 0x68, 0x97, 0xb9,
0xc9, 0x87, 0x01, 0x36, 0x55, 0x33, 0x17, 0xfa },
}
};
struct cast6_tv cast6_dec_tv_template[] =
{
{
16,
0,
{ 0x23, 0x42, 0xbb, 0x9e, 0xfa, 0x38, 0x54, 0x2c,
0x0a, 0xf7, 0x56, 0x47, 0xf2, 0x9f, 0x61, 0x5d },
{ 0xc8, 0x42, 0xa0, 0x89, 0x72, 0xb4, 0x3d, 0x20,
0x83, 0x6c, 0x91, 0xd1, 0xb7, 0x53, 0x0f, 0x6b },
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
},
{
24,
0,
{ 0x23, 0x42, 0xbb, 0x9e, 0xfa, 0x38, 0x54, 0x2c,
0xbe, 0xd0, 0xac, 0x83, 0x94, 0x0a, 0xc2, 0x98,
0xba, 0xc7, 0x7a, 0x77, 0x17, 0x94, 0x28, 0x63 },
{ 0x1b, 0x38, 0x6c, 0x02, 0x10, 0xdc, 0xad, 0xcb,
0xdd, 0x0e, 0x41, 0xaa, 0x08, 0xa7, 0xa7, 0xe8 },
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
},
{
32,
0,
{ 0x23, 0x42, 0xbb, 0x9e, 0xfa, 0x38, 0x54, 0x2c,
0xbe, 0xd0, 0xac, 0x83, 0x94, 0x0a, 0xc2, 0x98,
0x8d, 0x7c, 0x47, 0xce, 0x26, 0x49, 0x08, 0x46,
0x1c, 0xc1, 0xb5, 0x13, 0x7a, 0xe6, 0xb6, 0x04 },
{ 0x4f, 0x6a, 0x20, 0x38, 0x28, 0x68, 0x97, 0xb9,
0xc9, 0x87, 0x01, 0x36, 0x55, 0x33, 0x17, 0xfa },
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
}
};
/* /*
* AES test vectors. * AES test vectors.
*/ */
......
...@@ -39,9 +39,6 @@ ...@@ -39,9 +39,6 @@
#include <net/irda/wrapper.h> #include <net/irda/wrapper.h>
#include <net/irda/irda_device.h> #include <net/irda/irda_device.h>
static hashbin_t *irtty = NULL;
static struct tty_ldisc irda_ldisc;
static int qos_mtt_bits = 0x03; /* 5 ms or more */ static int qos_mtt_bits = 0x03; /* 5 ms or more */
/* Network device fuction prototypes */ /* Network device fuction prototypes */
...@@ -55,7 +52,8 @@ static struct net_device_stats *irtty_net_get_stats(struct net_device *dev); ...@@ -55,7 +52,8 @@ static struct net_device_stats *irtty_net_get_stats(struct net_device *dev);
/* Line discipline function prototypes */ /* Line discipline function prototypes */
static int irtty_open(struct tty_struct *tty); static int irtty_open(struct tty_struct *tty);
static void irtty_close(struct tty_struct *tty); static void irtty_close(struct tty_struct *tty);
static int irtty_ioctl(struct tty_struct *, void *, int, void *); static int irtty_ioctl(struct tty_struct *, struct file *,
unsigned int, unsigned long);
static int irtty_receive_room(struct tty_struct *tty); static int irtty_receive_room(struct tty_struct *tty);
static void irtty_write_wakeup(struct tty_struct *tty); static void irtty_write_wakeup(struct tty_struct *tty);
static void irtty_receive_buf(struct tty_struct *, const unsigned char *, static void irtty_receive_buf(struct tty_struct *, const unsigned char *,
...@@ -69,37 +67,22 @@ static int irtty_raw_read(struct net_device *dev, __u8 *buf, int len); ...@@ -69,37 +67,22 @@ static int irtty_raw_read(struct net_device *dev, __u8 *buf, int len);
static int irtty_set_mode(struct net_device *dev, int mode); static int irtty_set_mode(struct net_device *dev, int mode);
static int irtty_change_speed(struct irda_task *task); static int irtty_change_speed(struct irda_task *task);
char *driver_name = "irtty"; static struct tty_ldisc irda_ldisc = {
.owner = THIS_MODULE,
.magic = TTY_LDISC_MAGIC,
.name = "irda",
.open = irtty_open,
.close = irtty_close,
.ioctl = irtty_ioctl,
.receive_buf = irtty_receive_buf,
.receive_room = irtty_receive_room,
.write_wakeup = irtty_write_wakeup,
};
int __init irtty_init(void) int __init irtty_init(void)
{ {
int status; int status;
/* Probably no need to lock here because all operations done in
* open()/close() which are already safe - Jean II */
irtty = hashbin_new( HB_NOLOCK);
if ( irtty == NULL) {
printk( KERN_WARNING "IrDA: Can't allocate irtty hashbin!\n");
return -ENOMEM;
}
/* Fill in our line protocol discipline, and register it */
memset(&irda_ldisc, 0, sizeof( irda_ldisc));
irda_ldisc.magic = TTY_LDISC_MAGIC;
irda_ldisc.name = "irda";
irda_ldisc.flags = 0;
irda_ldisc.open = irtty_open;
irda_ldisc.close = irtty_close;
irda_ldisc.read = NULL;
irda_ldisc.write = NULL;
irda_ldisc.ioctl = (int (*)(struct tty_struct *, struct file *,
unsigned int, unsigned long)) irtty_ioctl;
irda_ldisc.poll = NULL;
irda_ldisc.receive_buf = irtty_receive_buf;
irda_ldisc.receive_room = irtty_receive_room;
irda_ldisc.write_wakeup = irtty_write_wakeup;
if ((status = tty_register_ldisc(N_IRDA, &irda_ldisc)) != 0) { if ((status = tty_register_ldisc(N_IRDA, &irda_ldisc)) != 0) {
ERROR("IrDA: can't register line discipline (err = %d)\n", ERROR("IrDA: can't register line discipline (err = %d)\n",
status); status);
...@@ -124,12 +107,6 @@ static void __exit irtty_cleanup(void) ...@@ -124,12 +107,6 @@ static void __exit irtty_cleanup(void)
__FUNCTION__, ret); __FUNCTION__, ret);
} }
/*
* The TTY should care of deallocating the instances by using the
* callback to irtty_close(), therefore we do give any deallocation
* function to hashbin_destroy().
*/
hashbin_delete(irtty, NULL);
} }
/* /*
...@@ -172,8 +149,6 @@ static int irtty_open(struct tty_struct *tty) ...@@ -172,8 +149,6 @@ static int irtty_open(struct tty_struct *tty)
/* Give self a name */ /* Give self a name */
strcpy(name, tty->name); strcpy(name, tty->name);
hashbin_insert(irtty, (irda_queue_t *) self, (int) self, NULL);
if (tty->driver->flush_buffer) if (tty->driver->flush_buffer)
tty->driver->flush_buffer(tty); tty->driver->flush_buffer(tty);
...@@ -251,8 +226,6 @@ static int irtty_open(struct tty_struct *tty) ...@@ -251,8 +226,6 @@ static int irtty_open(struct tty_struct *tty)
MESSAGE("IrDA: Registered device %s\n", dev->name); MESSAGE("IrDA: Registered device %s\n", dev->name);
MOD_INC_USE_COUNT;
return 0; return 0;
} }
...@@ -285,8 +258,6 @@ static void irtty_close(struct tty_struct *tty) ...@@ -285,8 +258,6 @@ static void irtty_close(struct tty_struct *tty)
if (self->netdev) if (self->netdev)
unregister_netdev(self->netdev); unregister_netdev(self->netdev);
self = hashbin_remove(irtty, (int) self, NULL);
/* Protect access to self->task and self->?x_buff - Jean II */ /* Protect access to self->task and self->?x_buff - Jean II */
spin_lock_irqsave(&self->lock, flags); spin_lock_irqsave(&self->lock, flags);
...@@ -305,8 +276,6 @@ static void irtty_close(struct tty_struct *tty) ...@@ -305,8 +276,6 @@ static void irtty_close(struct tty_struct *tty)
spin_unlock_irqrestore(&self->lock, flags); spin_unlock_irqrestore(&self->lock, flags);
kfree(self); kfree(self);
MOD_DEC_USE_COUNT;
} }
/* /*
...@@ -487,7 +456,8 @@ static int irtty_change_speed(struct irda_task *task) ...@@ -487,7 +456,8 @@ static int irtty_change_speed(struct irda_task *task)
* The Swiss army knife of system calls :-) * The Swiss army knife of system calls :-)
* *
*/ */
static int irtty_ioctl(struct tty_struct *tty, void *file, int cmd, void *arg) static int irtty_ioctl(struct tty_struct *tty, struct file *file,
unsigned int cmd, unsigned long arg)
{ {
dongle_t *dongle; dongle_t *dongle;
struct irtty_info info; struct irtty_info info;
...@@ -511,8 +481,7 @@ static int irtty_ioctl(struct tty_struct *tty, void *file, int cmd, void *arg) ...@@ -511,8 +481,7 @@ static int irtty_ioctl(struct tty_struct *tty, void *file, int cmd, void *arg)
case TCGETS: case TCGETS:
case TCGETA: case TCGETA:
/* Unsure about locking here, to check - Jean II */ /* Unsure about locking here, to check - Jean II */
return n_tty_ioctl(tty, (struct file *) file, cmd, return n_tty_ioctl(tty, (struct file *) file, cmd, arg);
(unsigned long) arg);
break; break;
case IRTTY_IOCTDONGLE: case IRTTY_IOCTDONGLE:
/* Initialize dongle */ /* Initialize dongle */
...@@ -543,7 +512,7 @@ static int irtty_ioctl(struct tty_struct *tty, void *file, int cmd, void *arg) ...@@ -543,7 +512,7 @@ static int irtty_ioctl(struct tty_struct *tty, void *file, int cmd, void *arg)
memset(&info, 0, sizeof(struct irtty_info)); memset(&info, 0, sizeof(struct irtty_info));
strncpy(info.name, self->netdev->name, 5); strncpy(info.name, self->netdev->name, 5);
if (copy_to_user(arg, &info, sizeof(struct irtty_info))) if (copy_to_user((void *) arg, &info, sizeof(struct irtty_info)))
return -EFAULT; return -EFAULT;
break; break;
default: default:
...@@ -938,7 +907,6 @@ static int irtty_net_open(struct net_device *dev) ...@@ -938,7 +907,6 @@ static int irtty_net_open(struct net_device *dev)
{ {
struct irtty_cb *self = (struct irtty_cb *) dev->priv; struct irtty_cb *self = (struct irtty_cb *) dev->priv;
struct tty_struct *tty = self->tty; struct tty_struct *tty = self->tty;
char hwname[16];
ASSERT(self != NULL, return -1;); ASSERT(self != NULL, return -1;);
ASSERT(self->magic == IRTTY_MAGIC, return -1;); ASSERT(self->magic == IRTTY_MAGIC, return -1;);
...@@ -951,16 +919,11 @@ static int irtty_net_open(struct net_device *dev) ...@@ -951,16 +919,11 @@ static int irtty_net_open(struct net_device *dev)
/* Make sure we can receive more data */ /* Make sure we can receive more data */
irtty_stop_receiver(self, FALSE); irtty_stop_receiver(self, FALSE);
/* Give self a hardware name */
sprintf(hwname, "%s", tty->name);
/* /*
* Open new IrLAP layer instance, now that everything should be * Open new IrLAP layer instance, now that everything should be
* initialized properly * initialized properly
*/ */
self->irlap = irlap_open(dev, &self->qos, hwname); self->irlap = irlap_open(dev, &self->qos, tty->name);
MOD_INC_USE_COUNT;
return 0; return 0;
} }
...@@ -983,8 +946,6 @@ static int irtty_net_close(struct net_device *dev) ...@@ -983,8 +946,6 @@ static int irtty_net_close(struct net_device *dev)
irlap_close(self->irlap); irlap_close(self->irlap);
self->irlap = NULL; self->irlap = NULL;
MOD_DEC_USE_COUNT;
return 0; return 0;
} }
......
...@@ -876,7 +876,6 @@ static int tok_open(struct net_device *dev) ...@@ -876,7 +876,6 @@ static int tok_open(struct net_device *dev)
if (i==0) break; if (i==0) break;
if (ti->open_status == OPEN && ti->sap_status==OPEN) { if (ti->open_status == OPEN && ti->sap_status==OPEN) {
netif_start_queue(dev); netif_start_queue(dev);
MOD_INC_USE_COUNT;
DPRINTK("Adapter is up and running\n"); DPRINTK("Adapter is up and running\n");
return 0; return 0;
} }
...@@ -1041,7 +1040,6 @@ static int tok_close(struct net_device *dev) ...@@ -1041,7 +1040,6 @@ static int tok_close(struct net_device *dev)
netif_stop_queue(dev); netif_stop_queue(dev);
DPRINTK("Adapter is closed.\n"); DPRINTK("Adapter is closed.\n");
MOD_DEC_USE_COUNT;
return 0; return 0;
} }
...@@ -1918,7 +1916,7 @@ MODULE_PARM(io, "1-" __MODULE_STRING(IBMTR_MAX_ADAPTERS) "i"); ...@@ -1918,7 +1916,7 @@ MODULE_PARM(io, "1-" __MODULE_STRING(IBMTR_MAX_ADAPTERS) "i");
MODULE_PARM(irq, "1-" __MODULE_STRING(IBMTR_MAX_ADAPTERS) "i"); MODULE_PARM(irq, "1-" __MODULE_STRING(IBMTR_MAX_ADAPTERS) "i");
MODULE_PARM(mem, "1-" __MODULE_STRING(IBMTR_MAX_ADAPTERS) "i"); MODULE_PARM(mem, "1-" __MODULE_STRING(IBMTR_MAX_ADAPTERS) "i");
int init_module(void) static int __init ibmtr_init(void)
{ {
int i; int i;
int count=0; int count=0;
...@@ -1948,21 +1946,24 @@ int init_module(void) ...@@ -1948,21 +1946,24 @@ int init_module(void)
if (count) return 0; if (count) return 0;
printk("ibmtr: register_netdev() returned non-zero.\n"); printk("ibmtr: register_netdev() returned non-zero.\n");
return -EIO; return -EIO;
} /*init_module */ }
module_init(ibmtr_init);
void cleanup_module(void) static void __exit ibmtr_cleanup(void)
{ {
int i,j; int i;
for (i = 0; i < IBMTR_MAX_ADAPTERS; i++){ for (i = 0; i < IBMTR_MAX_ADAPTERS; i++){
if (!dev_ibmtr[i]) if (!dev_ibmtr[i])
continue; continue;
if (dev_ibmtr[i]->base_addr) { if (dev_ibmtr[i]->base_addr) {
outb(0,dev_ibmtr[i]->base_addr+ADAPTRESET); outb(0,dev_ibmtr[i]->base_addr+ADAPTRESET);
for(j=jiffies+TR_RST_TIME;
time_before_eq(jiffies,j);) ; schedule_timeout(TR_RST_TIME); /* wait 50ms */
outb(0,dev_ibmtr[i]->base_addr+ADAPTRESETREL); outb(0,dev_ibmtr[i]->base_addr+ADAPTRESETREL);
} }
unregister_netdev(dev_ibmtr[i]); unregister_netdev(dev_ibmtr[i]);
free_irq(dev_ibmtr[i]->irq, dev_ibmtr[i]); free_irq(dev_ibmtr[i]->irq, dev_ibmtr[i]);
release_region(dev_ibmtr[i]->base_addr, IBMTR_IO_EXTENT); release_region(dev_ibmtr[i]->base_addr, IBMTR_IO_EXTENT);
...@@ -1978,4 +1979,5 @@ void cleanup_module(void) ...@@ -1978,4 +1979,5 @@ void cleanup_module(void)
dev_ibmtr[i] = NULL; dev_ibmtr[i] = NULL;
} }
} }
#endif /* MODULE */ module_exit(ibmtr_cleanup);
#endif
...@@ -463,9 +463,6 @@ struct net_device ...@@ -463,9 +463,6 @@ struct net_device
/* class/net/name entry */ /* class/net/name entry */
struct class_device class_dev; struct class_device class_dev;
/* statistics sub-directory */
struct kobject stats_kobj;
}; };
#define SET_MODULE_OWNER(dev) do { } while (0) #define SET_MODULE_OWNER(dev) do { } while (0)
......
...@@ -284,7 +284,10 @@ struct sadb_x_nat_t_port { ...@@ -284,7 +284,10 @@ struct sadb_x_nat_t_port {
#define SADB_X_EALG_BLOWFISHCBC 7 #define SADB_X_EALG_BLOWFISHCBC 7
#define SADB_EALG_NULL 11 #define SADB_EALG_NULL 11
#define SADB_X_EALG_AESCBC 12 #define SADB_X_EALG_AESCBC 12
#define SADB_EALG_MAX 12 #define SADB_EALG_MAX 253 /* last EALG */
/* private allocations should use 249-255 (RFC2407) */
#define SADB_X_EALG_SERPENTCBC 252 /* draft-ietf-ipsec-ciph-aes-cbc-00 */
#define SADB_X_EALG_TWOFISHCBC 253 /* draft-ietf-ipsec-ciph-aes-cbc-00 */
/* Compression algorithms */ /* Compression algorithms */
#define SADB_X_CALG_NONE 0 #define SADB_X_CALG_NONE 0
......
...@@ -209,7 +209,7 @@ void irda_device_cleanup(void); ...@@ -209,7 +209,7 @@ void irda_device_cleanup(void);
* We declare them here to avoid the driver pulling a whole bunch stack * We declare them here to avoid the driver pulling a whole bunch stack
* headers they don't really need - Jean II */ * headers they don't really need - Jean II */
struct irlap_cb *irlap_open(struct net_device *dev, struct qos_info *qos, struct irlap_cb *irlap_open(struct net_device *dev, struct qos_info *qos,
char * hw_name); const char *hw_name);
void irlap_close(struct irlap_cb *self); void irlap_close(struct irlap_cb *self);
/* Interface to be uses by IrLAP */ /* Interface to be uses by IrLAP */
...@@ -222,7 +222,7 @@ int irda_device_txqueue_empty(struct net_device *dev); ...@@ -222,7 +222,7 @@ int irda_device_txqueue_empty(struct net_device *dev);
int irda_device_set_raw_mode(struct net_device* self, int status); int irda_device_set_raw_mode(struct net_device* self, int status);
int irda_device_set_dtr_rts(struct net_device *dev, int dtr, int rts); int irda_device_set_dtr_rts(struct net_device *dev, int dtr, int rts);
int irda_device_change_speed(struct net_device *dev, __u32 speed); int irda_device_change_speed(struct net_device *dev, __u32 speed);
int irda_device_setup(struct net_device *dev); void irda_device_setup(struct net_device *dev);
/* Dongle interface */ /* Dongle interface */
void irda_device_unregister_dongle(struct dongle_reg *dongle); void irda_device_unregister_dongle(struct dongle_reg *dongle);
......
...@@ -208,8 +208,6 @@ struct irlap_cb { ...@@ -208,8 +208,6 @@ struct irlap_cb {
int next_bofs; /* Negotiated extra BOFs after next frame */ int next_bofs; /* Negotiated extra BOFs after next frame */
}; };
extern hashbin_t *irlap;
/* /*
* Function prototypes * Function prototypes
*/ */
...@@ -217,7 +215,7 @@ int irlap_init(void); ...@@ -217,7 +215,7 @@ int irlap_init(void);
void irlap_cleanup(void); void irlap_cleanup(void);
struct irlap_cb *irlap_open(struct net_device *dev, struct qos_info *qos, struct irlap_cb *irlap_open(struct net_device *dev, struct qos_info *qos,
char * hw_name); const char *hw_name);
void irlap_close(struct irlap_cb *self); void irlap_close(struct irlap_cb *self);
void irlap_connect_request(struct irlap_cb *self, __u32 daddr, void irlap_connect_request(struct irlap_cb *self, __u32 daddr,
......
...@@ -31,7 +31,6 @@ ...@@ -31,7 +31,6 @@
#include <linux/netdevice.h> #include <linux/netdevice.h>
#include <net/irda/irda.h> #include <net/irda/irda.h>
#include <net/irda/irqueue.h>
#include <net/irda/irda_device.h> #include <net/irda/irda_device.h>
/* Used by ioctl */ /* Used by ioctl */
...@@ -45,7 +44,6 @@ struct irtty_info { ...@@ -45,7 +44,6 @@ struct irtty_info {
#define IRTTY_IOC_MAXNR 2 #define IRTTY_IOC_MAXNR 2
struct irtty_cb { struct irtty_cb {
irda_queue_t q; /* Must be first */
magic_t magic; magic_t magic;
struct net_device *netdev; /* Yes! we are some kind of netdevice */ struct net_device *netdev; /* Yes! we are some kind of netdevice */
......
...@@ -187,7 +187,6 @@ int netdev_fastroute_obstacles; ...@@ -187,7 +187,6 @@ int netdev_fastroute_obstacles;
extern int netdev_sysfs_init(void); extern int netdev_sysfs_init(void);
extern int netdev_register_sysfs(struct net_device *); extern int netdev_register_sysfs(struct net_device *);
extern void netdev_unregister_sysfs(struct net_device *);
/******************************************************************************* /*******************************************************************************
...@@ -2343,14 +2342,18 @@ static int dev_ifsioc(struct ifreq *ifr, unsigned int cmd) ...@@ -2343,14 +2342,18 @@ static int dev_ifsioc(struct ifreq *ifr, unsigned int cmd)
case SIOCSIFNAME: case SIOCSIFNAME:
if (dev->flags & IFF_UP) if (dev->flags & IFF_UP)
return -EBUSY; return -EBUSY;
ifr->ifr_newname[IFNAMSIZ-1] = '\0';
if (__dev_get_by_name(ifr->ifr_newname)) if (__dev_get_by_name(ifr->ifr_newname))
return -EEXIST; return -EEXIST;
memcpy(dev->name, ifr->ifr_newname, IFNAMSIZ); err = class_device_rename(&dev->class_dev,
dev->name[IFNAMSIZ - 1] = 0; ifr->ifr_newname);
strlcpy(dev->class_dev.class_id, dev->name, BUS_ID_SIZE); if (!err) {
notifier_call_chain(&netdev_chain, strlcpy(dev->name, ifr->ifr_newname, IFNAMSIZ);
NETDEV_CHANGENAME, dev);
return 0; notifier_call_chain(&netdev_chain,
NETDEV_CHANGENAME, dev);
}
return err;
/* /*
* Unknown or private ioctl * Unknown or private ioctl
...@@ -2706,38 +2709,17 @@ int register_netdevice(struct net_device *dev) ...@@ -2706,38 +2709,17 @@ int register_netdevice(struct net_device *dev)
goto out; goto out;
} }
/** /*
* netdev_finish_unregister - complete unregistration * netdev_wait_allrefs - wait until all references are gone.
* @dev: device *
* This is called when unregistering network devices.
* *
* Destroy and free a dead device. A value of zero is returned on * Any protocol or device that holds a reference should register
* success. * for netdevice notification, and cleanup and put back the
* reference if they receive an UNREGISTER event.
* We can get stuck here if buggy protocols don't correctly
* call dev_put.
*/ */
static int netdev_finish_unregister(struct net_device *dev)
{
BUG_TRAP(!dev->ip_ptr);
BUG_TRAP(!dev->ip6_ptr);
BUG_TRAP(!dev->dn_ptr);
if (dev->reg_state != NETREG_UNREGISTERED) {
printk(KERN_ERR "Freeing alive device %p, %s\n",
dev, dev->name);
return 0;
}
#ifdef NET_REFCNT_DEBUG
printk(KERN_DEBUG "netdev_finish_unregister: %s%s.\n", dev->name,
(dev->destructor != NULL)?"":", old style");
#endif
/* It must be the very last action, after this 'dev' may point
* to freed up memory.
*/
if (dev->destructor)
dev->destructor(dev);
return 0;
}
static void netdev_wait_allrefs(struct net_device *dev) static void netdev_wait_allrefs(struct net_device *dev)
{ {
unsigned long rebroadcast_time, warning_time; unsigned long rebroadcast_time, warning_time;
...@@ -2833,13 +2815,23 @@ void netdev_run_todo(void) ...@@ -2833,13 +2815,23 @@ void netdev_run_todo(void)
break; break;
case NETREG_UNREGISTERING: case NETREG_UNREGISTERING:
netdev_unregister_sysfs(dev); class_device_unregister(&dev->class_dev);
dev->reg_state = NETREG_UNREGISTERED; dev->reg_state = NETREG_UNREGISTERED;
netdev_wait_allrefs(dev); netdev_wait_allrefs(dev);
/* paranoia */
BUG_ON(atomic_read(&dev->refcnt)); BUG_ON(atomic_read(&dev->refcnt));
BUG_TRAP(!dev->ip_ptr);
netdev_finish_unregister(dev); BUG_TRAP(!dev->ip6_ptr);
BUG_TRAP(!dev->dn_ptr);
/* It must be the very last action,
* after this 'dev' may point to freed up memory.
*/
if (dev->destructor)
dev->destructor(dev);
break; break;
default: default:
......
This diff is collapsed.
...@@ -1983,10 +1983,11 @@ void __init ip6_route_init(void) ...@@ -1983,10 +1983,11 @@ void __init ip6_route_init(void)
NULL, NULL); NULL, NULL);
fib6_init(); fib6_init();
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
proc_net_create("ipv6_route", 0, rt6_proc_info); p = proc_net_create("ipv6_route", 0, rt6_proc_info);
p = create_proc_entry("rt6_stats", S_IRUGO, proc_net);
if (p) if (p)
p->proc_fops = &rt6_stats_seq_fops; p->owner = THIS_MODULE;
proc_net_fops_create("rt6_stats", S_IRUGO, &rt6_stats_seq_fops);
#endif #endif
#ifdef CONFIG_XFRM #ifdef CONFIG_XFRM
xfrm6_init(); xfrm6_init();
...@@ -2000,7 +2001,9 @@ void ip6_route_cleanup(void) ...@@ -2000,7 +2001,9 @@ void ip6_route_cleanup(void)
proc_net_remove("ipv6_route"); proc_net_remove("ipv6_route");
proc_net_remove("rt6_stats"); proc_net_remove("rt6_stats");
#endif #endif
#ifdef CONFIG_XFRM
xfrm6_fini(); xfrm6_fini();
#endif
rt6_ifdown(NULL); rt6_ifdown(NULL);
fib6_gc_cleanup(); fib6_gc_cleanup();
kmem_cache_destroy(ip6_dst_ops.kmem_cachep); kmem_cache_destroy(ip6_dst_ops.kmem_cachep);
......
...@@ -383,10 +383,8 @@ static void irda_device_destructor(struct net_device *dev) ...@@ -383,10 +383,8 @@ static void irda_device_destructor(struct net_device *dev)
* This function should be used by low level device drivers in a similar way * This function should be used by low level device drivers in a similar way
* as ether_setup() is used by normal network device drivers * as ether_setup() is used by normal network device drivers
*/ */
int irda_device_setup(struct net_device *dev) void irda_device_setup(struct net_device *dev)
{ {
ASSERT(dev != NULL, return -1;);
dev->hard_header_len = 0; dev->hard_header_len = 0;
dev->addr_len = 0; dev->addr_len = 0;
...@@ -399,7 +397,6 @@ int irda_device_setup(struct net_device *dev) ...@@ -399,7 +397,6 @@ int irda_device_setup(struct net_device *dev)
dev->mtu = 2048; dev->mtu = 2048;
dev->flags = IFF_NOARP; dev->flags = IFF_NOARP;
return 0;
} }
/* /*
......
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
#include <net/irda/timer.h> #include <net/irda/timer.h>
#include <net/irda/qos.h> #include <net/irda/qos.h>
hashbin_t *irlap = NULL; static hashbin_t *irlap = NULL;
int sysctl_slot_timeout = SLOT_TIMEOUT * 1000 / HZ; int sysctl_slot_timeout = SLOT_TIMEOUT * 1000 / HZ;
/* This is the delay of missed pf period before generating an event /* This is the delay of missed pf period before generating an event
...@@ -110,7 +110,7 @@ void __exit irlap_cleanup(void) ...@@ -110,7 +110,7 @@ void __exit irlap_cleanup(void)
* *
*/ */
struct irlap_cb *irlap_open(struct net_device *dev, struct qos_info *qos, struct irlap_cb *irlap_open(struct net_device *dev, struct qos_info *qos,
char * hw_name) const char *hw_name)
{ {
struct irlap_cb *self; struct irlap_cb *self;
......
...@@ -43,7 +43,7 @@ config SCTP_ADLER32 ...@@ -43,7 +43,7 @@ config SCTP_ADLER32
bool "SCTP: Use old checksum (Adler-32)" bool "SCTP: Use old checksum (Adler-32)"
depends on IP_SCTP depends on IP_SCTP
help help
RCF2960 currently specifies the Adler-32 checksum algorithm for SCTP. RFC2960 currently specifies the Adler-32 checksum algorithm for SCTP.
This has been deprecated and replaced by an algorithm now referred This has been deprecated and replaced by an algorithm now referred
to as crc32c. to as crc32c.
......
...@@ -217,6 +217,40 @@ static struct xfrm_algo_desc ealg_list[] = { ...@@ -217,6 +217,40 @@ static struct xfrm_algo_desc ealg_list[] = {
.sadb_alg_maxbits = 256 .sadb_alg_maxbits = 256
} }
}, },
{
.name = "serpent",
.uinfo = {
.encr = {
.blockbits = 128,
.defkeybits = 128,
}
},
.desc = {
.sadb_alg_id = SADB_X_EALG_SERPENTCBC,
.sadb_alg_ivlen = 8,
.sadb_alg_minbits = 128,
.sadb_alg_maxbits = 256,
}
},
{
.name = "twofish",
.uinfo = {
.encr = {
.blockbits = 128,
.defkeybits = 128,
}
},
.desc = {
.sadb_alg_id = SADB_X_EALG_TWOFISHCBC,
.sadb_alg_ivlen = 8,
.sadb_alg_minbits = 128,
.sadb_alg_maxbits = 256
}
},
}; };
static struct xfrm_algo_desc calg_list[] = { static struct xfrm_algo_desc calg_list[] = {
......
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