diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2000-07-08 00:53:00 +0000 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2000-07-08 00:53:00 +0000 |
commit | b8553086288629b4efb77e97f5582e08bc50ad65 (patch) | |
tree | 0a19bd1c21e148f35c7a0f76baa4f7a056b966b0 /net | |
parent | 75b6d92f2dd5112b02f4e78cf9f35f9825946ef0 (diff) |
Merge with 2.4.0-test3-pre4.
Diffstat (limited to 'net')
-rw-r--r-- | net/Makefile | 5 | ||||
-rw-r--r-- | net/bridge/br_input.c | 6 | ||||
-rw-r--r-- | net/ipx/af_ipx.c | 6 | ||||
-rw-r--r-- | net/khttpd/security.c | 4 | ||||
-rw-r--r-- | net/netlink/af_netlink.c | 3 | ||||
-rw-r--r-- | net/netlink/netlink_dev.c | 2 | ||||
-rw-r--r-- | net/socket.c | 66 | ||||
-rw-r--r-- | net/unix/af_unix.c | 18 |
8 files changed, 79 insertions, 31 deletions
diff --git a/net/Makefile b/net/Makefile index 6f473226a..0ecbb1a9d 100644 --- a/net/Makefile +++ b/net/Makefile @@ -11,11 +11,12 @@ MOD_SUB_DIRS := ipv4 ALL_SUB_DIRS := 802 ax25 bridge core ethernet ipv4 ipv6 ipx unix appletalk \ netrom rose lapb x25 wanrouter netlink sched packet sunrpc \ econet irda decnet atm khttpd ipv4/netfilter ipv6/netfilter -SUB_DIRS := core ethernet sched +SUB_DIRS := core ethernet MOD_LIST_NAME := NET_MISC_MODULES + ifeq ($(CONFIG_NET),y) -SUB_DIRS += 802 +SUB_DIRS += 802 sched endif ifeq ($(CONFIG_INET),y) diff --git a/net/bridge/br_input.c b/net/bridge/br_input.c index 2ca176f95..24cf40fa5 100644 --- a/net/bridge/br_input.c +++ b/net/bridge/br_input.c @@ -5,7 +5,7 @@ * Authors: * Lennert Buytenhek <buytenh@gnu.org> * - * $Id: br_input.c,v 1.5 2000/03/30 01:22:23 davem Exp $ + * $Id: br_input.c,v 1.6 2000/06/26 18:09:17 davem Exp $ * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -80,7 +80,9 @@ static void __br_handle_frame(struct sk_buff *skb) } } - if (!memcmp(dest, bridge_ula, 5) && !(dest[5] & 0xF0)) + if (br->stp_enabled && + !memcmp(dest, bridge_ula, 5) && + !(dest[5] & 0xF0)) goto handle_special_frame; if (p->state == BR_STATE_LEARNING || diff --git a/net/ipx/af_ipx.c b/net/ipx/af_ipx.c index 3f475bac8..afa955add 100644 --- a/net/ipx/af_ipx.c +++ b/net/ipx/af_ipx.c @@ -1571,7 +1571,7 @@ static int ipx_get_info(char *buffer, char **start, off_t offset, int length) #ifdef CONFIG_IPX_INTERN len += sprintf(buffer+len, "%08lX:%02X%02X%02X%02X%02X%02X:%04X ", - (long unsigned int) htonl(s->protinfo.af_ipx.intrfc->if_netnum), + (unsigned long) htonl(s->protinfo.af_ipx.intrfc->if_netnum), s->protinfo.af_ipx.node[0], s->protinfo.af_ipx.node[1], s->protinfo.af_ipx.node[2], @@ -1581,7 +1581,7 @@ static int ipx_get_info(char *buffer, char **start, off_t offset, int length) htons(s->protinfo.af_ipx.port)); #else len += sprintf(buffer+len,"%08lX:%04X ", - htonl(i->if_netnum), + (unsigned long)htonl(i->if_netnum), htons(s->protinfo.af_ipx.port)); #endif /* CONFIG_IPX_INTERN */ @@ -1591,7 +1591,7 @@ static int ipx_get_info(char *buffer, char **start, off_t offset, int length) { len += sprintf(buffer+len, "%08lX:%02X%02X%02X%02X%02X%02X:%04X ", - (long unsigned int) htonl(s->protinfo.af_ipx.dest_addr.net), + (unsigned long) htonl(s->protinfo.af_ipx.dest_addr.net), s->protinfo.af_ipx.dest_addr.node[0], s->protinfo.af_ipx.dest_addr.node[1], s->protinfo.af_ipx.dest_addr.node[2], diff --git a/net/khttpd/security.c b/net/khttpd/security.c index 16503ceb5..792abd083 100644 --- a/net/khttpd/security.c +++ b/net/khttpd/security.c @@ -113,12 +113,8 @@ struct file *OpenFileForSecurity(char *Filename) #endif /* Rule no. 3 -- Does the file exist ? */ - lock_kernel(); - filp = filp_open(Filename, O_RDONLY, 0); - unlock_kernel(); - if (IS_ERR(filp)) return NULL; diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c index 4f4263d56..be011a234 100644 --- a/net/netlink/af_netlink.c +++ b/net/netlink/af_netlink.c @@ -576,6 +576,9 @@ static int netlink_sendmsg(struct socket *sock, struct msghdr *msg, int len, goto out; } + err = -EMSGSIZE; + if ((unsigned)len > sk->sndbuf-32) + goto out; err = -ENOBUFS; skb = alloc_skb(len, GFP_KERNEL); if (skb==NULL) diff --git a/net/netlink/netlink_dev.c b/net/netlink/netlink_dev.c index 4da257555..d0e187aee 100644 --- a/net/netlink/netlink_dev.c +++ b/net/netlink/netlink_dev.c @@ -190,7 +190,7 @@ int __init init_netlink(void) printk(KERN_ERR "netlink: unable to get major %d\n", NETLINK_MAJOR); return -EIO; } - devfs_handle = devfs_mk_dir (NULL, "netlink", 7, NULL); + devfs_handle = devfs_mk_dir (NULL, "netlink", NULL); /* Someone tell me the official names for the uppercase ones */ make_devfs_entries ("route", 0); make_devfs_entries ("skip", 1); diff --git a/net/socket.c b/net/socket.c index b0978fb32..276940470 100644 --- a/net/socket.c +++ b/net/socket.c @@ -70,6 +70,7 @@ #include <linux/init.h> #include <linux/poll.h> #include <linux/cache.h> +#include <linux/module.h> #if defined(CONFIG_KMOD) && defined(CONFIG_NET) #include <linux/kmod.h> @@ -261,6 +262,55 @@ int move_addr_to_user(void *kaddr, int klen, void *uaddr, int *ulen) return __put_user(klen, ulen); } +#define SOCKFS_MAGIC 0x534F434B +static int sockfs_statfs(struct super_block *sb, struct statfs *buf) +{ + buf->f_type = SOCKFS_MAGIC; + buf->f_bsize = 1024; + buf->f_namelen = 255; + return 0; +} + +static struct super_operations sockfs_ops = { + statfs: sockfs_statfs, +}; + +static struct super_block * sockfs_read_super(struct super_block *sb, void *data, int silent) +{ + struct inode *root = get_empty_inode(); + if (!root) + return NULL; + root->i_mode = S_IFDIR | S_IRUSR | S_IWUSR; + root->i_uid = root->i_gid = 0; + root->i_atime = root->i_mtime = root->i_ctime = CURRENT_TIME; + root->i_sb = sb; + root->i_dev = sb->s_dev; + sb->s_blocksize = 1024; + sb->s_blocksize_bits = 10; + sb->s_magic = SOCKFS_MAGIC; + sb->s_op = &sockfs_ops; + sb->s_root = d_alloc(NULL, &(const struct qstr) { "socket:", 7, 0 }); + if (!sb->s_root) { + iput(root); + return NULL; + } + sb->s_root->d_sb = sb; + sb->s_root->d_parent = sb->s_root; + d_instantiate(sb->s_root, root); + return sb; +} + +static struct vfsmount *sock_mnt; +static DECLARE_FSTYPE(sock_fs_type, "sockfs", sockfs_read_super, + FS_NOMOUNT|FS_SINGLE); +static int sockfs_delete_dentry(struct dentry *dentry) +{ + return 1; +} +static struct dentry_operations sockfs_dentry_operations = { + d_delete: sockfs_delete_dentry, +}; + /* * Obtains the first available file descriptor and sets it up for use. * @@ -281,6 +331,8 @@ int move_addr_to_user(void *kaddr, int klen, void *uaddr, int *ulen) static int sock_map_fd(struct socket *sock) { int fd; + struct qstr this; + char name[32]; /* * Find a file descriptor suitable for return to the user. @@ -296,15 +348,21 @@ static int sock_map_fd(struct socket *sock) goto out; } - file->f_dentry = d_alloc_root(sock->inode); - /* MOUNT_REWRITE: set to sockfs internal vfsmnt */ - file->f_vfsmnt = NULL; + sprintf(name, "[%lu]", sock->inode->i_ino); + this.name = name; + this.len = strlen(name); + this.hash = sock->inode->i_ino; + + file->f_dentry = d_alloc(sock_mnt->mnt_sb->s_root, &this); if (!file->f_dentry) { put_filp(file); put_unused_fd(fd); fd = -ENOMEM; goto out; } + file->f_dentry->d_op = &sockfs_dentry_operations; + d_add(file->f_dentry, sock->inode); + file->f_vfsmnt = mntget(sock_mnt); sock->file = file; file->f_op = &socket_file_ops; @@ -1669,6 +1727,8 @@ void __init sock_init(void) #ifdef CONFIG_NETFILTER netfilter_init(); #endif + register_filesystem(&sock_fs_type); + sock_mnt = kern_mount(&sock_fs_type); } int socket_get_info(char *buffer, char **start, off_t offset, int length) diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index 20e0fc8c7..f0165c28b 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c @@ -8,7 +8,7 @@ * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. * - * Version: $Id: af_unix.c,v 1.99 2000/06/22 11:42:32 davem Exp $ + * Version: $Id: af_unix.c,v 1.100 2000/06/26 23:20:27 davem Exp $ * * Fixes: * Linus Torvalds : Assorted bug cures. @@ -381,10 +381,8 @@ static int unix_release_sock (unix_socket *sk, int embrion) } if (dentry) { - lock_kernel(); dput(dentry); mntput(mnt); - unlock_kernel(); } sock_put(sk); @@ -574,14 +572,10 @@ static unix_socket *unix_find_other(struct sockaddr_un *sunname, int len, int err = 0; if (sunname->sun_path[0]) { - /* Do not believe to VFS, grab kernel lock */ - lock_kernel(); if (path_init(sunname->sun_path, LOOKUP_POSITIVE, &nd)) err = path_walk(sunname->sun_path, &nd); - if (err) { - unlock_kernel(); + if (err) goto fail; - } err = permission(nd.dentry->d_inode,MAY_WRITE); if (err) goto put_fail; @@ -594,7 +588,6 @@ static unix_socket *unix_find_other(struct sockaddr_un *sunname, int len, goto put_fail; path_release(&nd); - unlock_kernel(); err=-EPROTOTYPE; if (u->type != type) { @@ -611,7 +604,6 @@ static unix_socket *unix_find_other(struct sockaddr_un *sunname, int len, put_fail: path_release(&nd); - unlock_kernel(); fail: *error=err; return NULL; @@ -660,7 +652,6 @@ static int unix_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) atomic_set(&addr->refcnt, 1); if (sunaddr->sun_path[0]) { - lock_kernel(); err = 0; /* * Get the parent directory, calculate the hash for last @@ -707,7 +698,6 @@ static int unix_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) up(&nd.dentry->d_inode->i_sem); dput(nd.dentry); nd.dentry = dentry; - unlock_kernel(); addr->hash = UNIX_HASH_SIZE; } @@ -748,7 +738,6 @@ out_mknod_unlock: out_mknod: path_release(&nd); out_mknod_parent: - unlock_kernel(); if (err==-EEXIST) err=-EADDRINUSE; unix_release_addr(addr); @@ -963,11 +952,8 @@ restart: newsk->protinfo.af_unix.addr=other->protinfo.af_unix.addr; } if (other->protinfo.af_unix.dentry) { - /* Damn, even dget is not SMP safe. It becomes ridiculous... */ - lock_kernel(); newsk->protinfo.af_unix.dentry=dget(other->protinfo.af_unix.dentry); newsk->protinfo.af_unix.mnt=mntget(other->protinfo.af_unix.mnt); - unlock_kernel(); } /* Set credentials */ |