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

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

into nuts.ninka.net:/disk1/davem/BK/net-2.5
parents 016b1894 8697648c
...@@ -2,11 +2,10 @@ ...@@ -2,11 +2,10 @@
# Cryptographic API # Cryptographic API
# #
autoload-crypto-$(CONFIG_KMOD) = autoload.o
proc-crypto-$(CONFIG_PROC_FS) = proc.o proc-crypto-$(CONFIG_PROC_FS) = proc.o
obj-$(CONFIG_CRYPTO) += api.o cipher.o digest.o compress.o \ obj-$(CONFIG_CRYPTO) += api.o cipher.o digest.o compress.o \
$(autoload-crypto-y) $(proc-crypto-y) $(proc-crypto-y)
obj-$(CONFIG_CRYPTO_HMAC) += hmac.o obj-$(CONFIG_CRYPTO_HMAC) += hmac.o
obj-$(CONFIG_CRYPTO_NULL) += crypto_null.o obj-$(CONFIG_CRYPTO_NULL) += crypto_null.o
......
/*
* Cryptographic API.
*
* Algorithm autoloader.
*
* Copyright (c) 2002 James Morris <jmorris@intercode.com.au>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation; either version 2 of the License, or (at your option)
* any later version.
*
*/
#include <linux/kernel.h>
#include <linux/crypto.h>
#include <linux/string.h>
#include <linux/kmod.h>
#include "internal.h"
/*
* A far more intelligent version of this is planned. For now, just
* try an exact match on the name of the algorithm.
*/
void crypto_alg_autoload(const char *name)
{
request_module("%s", name);
}
struct crypto_alg *crypto_alg_mod_lookup(const char *name)
{
struct crypto_alg *alg = crypto_alg_lookup(name);
if (alg == NULL) {
crypto_alg_autoload(name);
alg = crypto_alg_lookup(name);
}
return alg;
}
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include <linux/highmem.h> #include <linux/highmem.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/kmod.h>
#include <asm/hardirq.h> #include <asm/hardirq.h>
#include <asm/kmap_types.h> #include <asm/kmap_types.h>
...@@ -48,15 +49,12 @@ static inline void *crypto_tfm_ctx(struct crypto_tfm *tfm) ...@@ -48,15 +49,12 @@ static inline void *crypto_tfm_ctx(struct crypto_tfm *tfm)
struct crypto_alg *crypto_alg_lookup(const char *name); struct crypto_alg *crypto_alg_lookup(const char *name);
#ifdef CONFIG_KMOD /* A far more intelligent version of this is planned. For now, just
void crypto_alg_autoload(const char *name); * try an exact match on the name of the algorithm. */
struct crypto_alg *crypto_alg_mod_lookup(const char *name);
#else
static inline struct crypto_alg *crypto_alg_mod_lookup(const char *name) static inline struct crypto_alg *crypto_alg_mod_lookup(const char *name)
{ {
return crypto_alg_lookup(name); return try_then_request_module(crypto_alg_lookup(name), name);
} }
#endif
#ifdef CONFIG_CRYPTO_HMAC #ifdef CONFIG_CRYPTO_HMAC
int crypto_alloc_hmac_block(struct crypto_tfm *tfm); int crypto_alloc_hmac_block(struct crypto_tfm *tfm);
......
...@@ -29,7 +29,7 @@ extern int request_module(const char * name, ...) __attribute__ ((format (printf ...@@ -29,7 +29,7 @@ extern int request_module(const char * name, ...) __attribute__ ((format (printf
static inline int request_module(const char * name, ...) { return -ENOSYS; } static inline int request_module(const char * name, ...) { return -ENOSYS; }
#endif #endif
#define try_then_request_module(x, mod...) ((x) ?: request_module(mod), (x)) #define try_then_request_module(x, mod...) ((x) ?: (request_module(mod), (x)))
extern int call_usermodehelper(char *path, char *argv[], char *envp[], int wait); extern int call_usermodehelper(char *path, char *argv[], char *envp[], int wait);
#ifdef CONFIG_HOTPLUG #ifdef CONFIG_HOTPLUG
......
Maintainers and developers for networking code sections
Code Section Bug Report Contact
-------------------+-------------------------------------------
802 [other ] alan@lxorguk.ukuu.org.uk
[token ring ] p.norton@computer.org
appletalk jschlst@samba.org
ax25 g4klx@g4klx.demon.co.uk
bridge buytenh@gnu.org
core alan@lxorguk.ukuu.org.uk
decnet SteveW@ACM.org
ethernet alan@lxorguk.ukuu.org.uk
ipv4 davem@caip.rutgers.edu,Eric.Schenk@dna.lth.se
ipv6 davem@caip.rutgers.edu,Eric.Schenk@dna.lth.se
ipx acme@conectiva.com.br
spx jschlst@samba.org
irda dagb@cs.uit.no
lapb g4klx@g4klx.demon.co.uk
netrom g4klx@g4klx.demon.co.uk
rose g4klx@g4klx.demon.co.uk
wanrouter gene@compuserve.com, jaspreet@sangoma and dm@sangoma.com
unix alan@lxorguk.ukuu.org.uk
x25 g4klx@g4klx.demon.co.uk
bluetooth maxk@qualcomm.com
8021q greearb@candelatech.com, vlan@scry.wanfear.com
...@@ -18,6 +18,7 @@ Author: Marcell GAL, 2000, XDSL Ltd, Hungary ...@@ -18,6 +18,7 @@ Author: Marcell GAL, 2000, XDSL Ltd, Hungary
#include <net/arp.h> #include <net/arp.h>
#include <linux/atm.h> #include <linux/atm.h>
#include <linux/atmdev.h> #include <linux/atmdev.h>
#include <linux/seq_file.h>
#include <linux/atmbr2684.h> #include <linux/atmbr2684.h>
...@@ -666,31 +667,57 @@ static int br2684_ioctl(struct atm_vcc *atmvcc, unsigned int cmd, ...@@ -666,31 +667,57 @@ static int br2684_ioctl(struct atm_vcc *atmvcc, unsigned int cmd,
return -ENOIOCTLCMD; return -ENOIOCTLCMD;
} }
/* Never put more than 256 bytes in at once */ #ifdef CONFIG_PROC_FS
static int br2684_proc_engine(loff_t pos, char *buf) static void *br2684_seq_start(struct seq_file *seq, loff_t *pos)
{ {
struct list_head *lhd, *lhc; loff_t offs = 0;
struct net_device *net_dev; struct br2684_dev *brd;
struct br2684_dev *brdev;
struct br2684_vcc *brvcc; read_lock(&devs_lock);
list_for_each(lhd, &br2684_devs) {
net_dev = list_entry_brdev(lhd); list_for_each_entry(brd, &br2684_devs, br2684_devs) {
brdev = BRPRIV(net_dev); if (offs == *pos)
if (pos-- == 0) return brd;
return sprintf(buf, "dev %.16s: num=%d, mac=%02X:%02X:" ++offs;
"%02X:%02X:%02X:%02X (%s)\n", net_dev->name, }
brdev->number, return NULL;
net_dev->dev_addr[0], }
net_dev->dev_addr[1],
net_dev->dev_addr[2], static void *br2684_seq_next(struct seq_file *seq, void *v, loff_t *pos)
net_dev->dev_addr[3], {
net_dev->dev_addr[4], struct br2684_dev *brd = v;
net_dev->dev_addr[5],
brdev->mac_was_set ? "set" : "auto"); ++*pos;
list_for_each(lhc, &brdev->brvccs) {
brvcc = list_entry_brvcc(lhc); brd = list_entry(brd->br2684_devs.next,
if (pos-- == 0) struct br2684_dev, br2684_devs);
return sprintf(buf, " vcc %d.%d.%d: encaps=%s" return (&brd->br2684_devs != &br2684_devs) ? brd : NULL;
}
static void br2684_seq_stop(struct seq_file *seq, void *v)
{
read_unlock(&devs_lock);
}
static int br2684_seq_show(struct seq_file *seq, void *v)
{
const struct br2684_dev *brdev = v;
const struct net_device *net_dev = brdev->net_dev;
const struct br2684_vcc *brvcc;
seq_printf(seq, "dev %.16s: num=%d, mac=%02X:%02X:"
"%02X:%02X:%02X:%02X (%s)\n", net_dev->name,
brdev->number,
net_dev->dev_addr[0],
net_dev->dev_addr[1],
net_dev->dev_addr[2],
net_dev->dev_addr[3],
net_dev->dev_addr[4],
net_dev->dev_addr[5],
brdev->mac_was_set ? "set" : "auto");
list_for_each_entry(brvcc, &brdev->brvccs, brvccs) {
seq_printf(seq, " vcc %d.%d.%d: encaps=%s"
#ifndef FASTER_VERSION #ifndef FASTER_VERSION
", failed copies %u/%u" ", failed copies %u/%u"
#endif /* FASTER_VERSION */ #endif /* FASTER_VERSION */
...@@ -711,63 +738,41 @@ static int br2684_proc_engine(loff_t pos, char *buf) ...@@ -711,63 +738,41 @@ static int br2684_proc_engine(loff_t pos, char *buf)
#undef bs #undef bs
#undef b1 #undef b1
#endif /* CONFIG_ATM_BR2684_IPFILTER */ #endif /* CONFIG_ATM_BR2684_IPFILTER */
}
} }
return 0; return 0;
} }
static ssize_t br2684_proc_read(struct file *file, char *buf, size_t count, static struct seq_operations br2684_seq_ops = {
loff_t *pos) .start = br2684_seq_start,
.next = br2684_seq_next,
.stop = br2684_seq_stop,
.show = br2684_seq_show,
};
static int br2684_proc_open(struct inode *inode, struct file *file)
{ {
unsigned long page; return seq_open(file, &br2684_seq_ops);
int len = 0, x, left;
page = get_zeroed_page(GFP_KERNEL);
if (!page)
return -ENOMEM;
left = PAGE_SIZE - 256;
if (count < left)
left = count;
read_lock(&devs_lock);
for (;;) {
x = br2684_proc_engine(*pos, &((char *) page)[len]);
if (x == 0)
break;
if (x > left)
/*
* This should only happen if the user passed in
* a "count" too small for even one line
*/
x = -EINVAL;
if (x < 0) {
len = x;
break;
}
len += x;
left -= x;
(*pos)++;
if (left < 256)
break;
}
read_unlock(&devs_lock);
if (len > 0 && copy_to_user(buf, (char *) page, len))
len = -EFAULT;
free_page(page);
return len;
} }
static struct file_operations br2684_proc_operations = { static struct file_operations br2684_proc_ops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.read = br2684_proc_read, .open = br2684_proc_open,
.read = seq_read,
.llseek = seq_lseek,
.release = seq_release,
}; };
extern struct proc_dir_entry *atm_proc_root; /* from proc.c */ extern struct proc_dir_entry *atm_proc_root; /* from proc.c */
#endif
static int __init br2684_init(void) static int __init br2684_init(void)
{ {
#ifdef CONFIG_PROC_FS
struct proc_dir_entry *p; struct proc_dir_entry *p;
if ((p = create_proc_entry("br2684", 0, atm_proc_root)) == NULL) if ((p = create_proc_entry("br2684", 0, atm_proc_root)) == NULL)
return -ENOMEM; return -ENOMEM;
p->proc_fops = &br2684_proc_operations; p->proc_fops = &br2684_proc_ops;
#endif
br2684_ioctl_set(br2684_ioctl); br2684_ioctl_set(br2684_ioctl);
return 0; return 0;
} }
...@@ -779,7 +784,9 @@ static void __exit br2684_exit(void) ...@@ -779,7 +784,9 @@ static void __exit br2684_exit(void)
struct br2684_vcc *brvcc; struct br2684_vcc *brvcc;
br2684_ioctl_set(NULL); br2684_ioctl_set(NULL);
#ifdef CONFIG_PROC_FS
remove_proc_entry("br2684", atm_proc_root); remove_proc_entry("br2684", atm_proc_root);
#endif
while (!list_empty(&br2684_devs)) { while (!list_empty(&br2684_devs)) {
net_dev = list_entry_brdev(br2684_devs.next); net_dev = list_entry_brdev(br2684_devs.next);
......
...@@ -111,6 +111,7 @@ ...@@ -111,6 +111,7 @@
#include <linux/tcp.h> #include <linux/tcp.h>
#include <net/af_unix.h> #include <net/af_unix.h>
#include <linux/proc_fs.h> #include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include <net/scm.h> #include <net/scm.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/poll.h> #include <linux/poll.h>
...@@ -1805,25 +1806,52 @@ static unsigned int unix_poll(struct file * file, struct socket *sock, poll_tabl ...@@ -1805,25 +1806,52 @@ static unsigned int unix_poll(struct file * file, struct socket *sock, poll_tabl
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
static int unix_read_proc(char *buffer, char **start, off_t offset, static struct sock *unix_seq_idx(int *iter, loff_t pos)
int length, int *eof, void *data)
{ {
off_t pos=0; loff_t off = 0;
off_t begin=0;
int len=0;
int i;
struct sock *s; struct sock *s;
len+= sprintf(buffer,"Num RefCount Protocol Flags Type St "
"Inode Path\n");
for (s = first_unix_socket(iter); s; s = next_unix_socket(iter, s)) {
if (off == pos)
return s;
++off;
}
return NULL;
}
static void *unix_seq_start(struct seq_file *seq, loff_t *pos)
{
read_lock(&unix_table_lock); read_lock(&unix_table_lock);
forall_unix_sockets (i,s) return *pos ? unix_seq_idx(seq->private, *pos - 1) : ((void *) 1);
{ }
static void *unix_seq_next(struct seq_file *seq, void *v, loff_t *pos)
{
++*pos;
if (v == (void *)1)
return first_unix_socket(seq->private);
return next_unix_socket(seq->private, v);
}
static void unix_seq_stop(struct seq_file *seq, void *v)
{
read_unlock(&unix_table_lock);
}
static int unix_seq_show(struct seq_file *seq, void *v)
{
if (v == (void *)1)
seq_puts(seq, "Num RefCount Protocol Flags Type St "
"Inode Path\n");
else {
struct sock *s = v;
struct unix_sock *u = unix_sk(s); struct unix_sock *u = unix_sk(s);
unix_state_rlock(s); unix_state_rlock(s);
len+=sprintf(buffer+len,"%p: %08X %08X %08X %04X %02X %5lu", seq_printf(seq, "%p: %08X %08X %08X %04X %02X %5lu",
s, s,
atomic_read(&s->sk_refcnt), atomic_read(&s->sk_refcnt),
0, 0,
...@@ -1835,39 +1863,61 @@ static int unix_read_proc(char *buffer, char **start, off_t offset, ...@@ -1835,39 +1863,61 @@ static int unix_read_proc(char *buffer, char **start, off_t offset,
sock_i_ino(s)); sock_i_ino(s));
if (u->addr) { if (u->addr) {
buffer[len++] = ' '; int i;
memcpy(buffer+len, u->addr->name->sun_path, seq_putc(seq, ' ');
u->addr->len-sizeof(short));
if (!UNIX_ABSTRACT(s)) for (i = 0; i < u->addr->len-sizeof(short); i++)
len--; seq_putc(seq, u->addr->name->sun_path[i]);
else
buffer[len] = '@';
len += u->addr->len - sizeof(short);
}
unix_state_runlock(s);
buffer[len++]='\n'; if (UNIX_ABSTRACT(s))
seq_putc(seq, '@');
pos = begin + len;
if(pos<offset)
{
len=0;
begin=pos;
} }
if(pos>offset+length) unix_state_runlock(s);
goto done; seq_putc(seq, '\n');
} }
*eof = 1;
done: return 0;
read_unlock(&unix_table_lock); }
*start=buffer+(offset-begin);
len-=(offset-begin); struct seq_operations unix_seq_ops = {
if(len>length) .start = unix_seq_start,
len=length; .next = unix_seq_next,
if (len < 0) .stop = unix_seq_stop,
len = 0; .show = unix_seq_show,
return len; };
static int unix_seq_open(struct inode *inode, struct file *file)
{
struct seq_file *seq;
int rc = -ENOMEM;
int *iter = kmalloc(sizeof(int), GFP_KERNEL);
if (!iter)
goto out;
rc = seq_open(file, &unix_seq_ops);
if (rc)
goto out_kfree;
seq = file->private_data;
seq->private = iter;
*iter = 0;
out:
return rc;
out_kfree:
kfree(iter);
goto out;
} }
static struct file_operations unix_seq_fops = {
.owner = THIS_MODULE,
.open = unix_seq_open,
.read = seq_read,
.llseek = seq_lseek,
.release = seq_release_private,
};
#endif #endif
struct proto_ops unix_stream_ops = { struct proto_ops unix_stream_ops = {
...@@ -1947,7 +1997,7 @@ static int __init af_unix_init(void) ...@@ -1947,7 +1997,7 @@ static int __init af_unix_init(void)
sock_register(&unix_family_ops); sock_register(&unix_family_ops);
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
create_proc_read_entry("net/unix", 0, 0, unix_read_proc, NULL); proc_net_fops_create("unix", 0, &unix_seq_fops);
#endif #endif
unix_sysctl_register(); unix_sysctl_register();
return 0; return 0;
...@@ -1957,7 +2007,7 @@ static void __exit af_unix_exit(void) ...@@ -1957,7 +2007,7 @@ static void __exit af_unix_exit(void)
{ {
sock_unregister(PF_UNIX); sock_unregister(PF_UNIX);
unix_sysctl_unregister(); unix_sysctl_unregister();
remove_proc_entry("net/unix", 0); proc_net_remove("unix");
kmem_cache_destroy(unix_sk_cachep); kmem_cache_destroy(unix_sk_cachep);
} }
......
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