Commit 06870e11 authored by Matthew Wilcox's avatar Matthew Wilcox Committed by David S. Miller

[NET]: Move more ioctls to top level.

parent 1ad2be64
...@@ -111,13 +111,6 @@ ...@@ -111,13 +111,6 @@
#ifdef CONFIG_IP_MROUTE #ifdef CONFIG_IP_MROUTE
#include <linux/mroute.h> #include <linux/mroute.h>
#endif #endif
#include <linux/if_bridge.h>
#ifdef CONFIG_KMOD
#include <linux/kmod.h>
#endif
#ifdef CONFIG_NET_DIVERT
#include <linux/divert.h>
#endif /* CONFIG_NET_DIVERT */
struct linux_mib net_statistics[NR_CPUS * 2]; struct linux_mib net_statistics[NR_CPUS * 2];
...@@ -127,22 +120,6 @@ atomic_t inet_sock_nr; ...@@ -127,22 +120,6 @@ atomic_t inet_sock_nr;
extern void ip_mc_drop_socket(struct sock *sk); extern void ip_mc_drop_socket(struct sock *sk);
#ifdef CONFIG_DLCI
extern int dlci_ioctl(unsigned int, void *);
#endif
#ifdef CONFIG_DLCI_MODULE
int (*dlci_ioctl_hook)(unsigned int, void *);
#endif
#if defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE)
int (*br_ioctl_hook)(unsigned long);
#endif
#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
int (*vlan_ioctl_hook)(unsigned long arg);
#endif
/* Per protocol sock slabcache */ /* Per protocol sock slabcache */
kmem_cache_t *tcp_sk_cachep; kmem_cache_t *tcp_sk_cachep;
static kmem_cache_t *udp_sk_cachep; static kmem_cache_t *udp_sk_cachep;
...@@ -890,60 +867,6 @@ int inet_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) ...@@ -890,60 +867,6 @@ int inet_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
case SIOCSIFFLAGS: case SIOCSIFFLAGS:
err = devinet_ioctl(cmd, (void *)arg); err = devinet_ioctl(cmd, (void *)arg);
break; break;
case SIOCGIFBR:
case SIOCSIFBR:
#if defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE)
#ifdef CONFIG_KMOD
if (!br_ioctl_hook)
request_module("bridge");
#endif
if (br_ioctl_hook)
err = br_ioctl_hook(arg);
else
#endif
err = -ENOPKG;
break;
case SIOCGIFVLAN:
case SIOCSIFVLAN:
#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
#ifdef CONFIG_KMOD
if (!vlan_ioctl_hook)
request_module("8021q");
#endif
if (vlan_ioctl_hook)
err = vlan_ioctl_hook(arg);
else
#endif
err = -ENOPKG;
break;
case SIOCGIFDIVERT:
case SIOCSIFDIVERT:
#ifdef CONFIG_NET_DIVERT
err = divert_ioctl(cmd, (struct divert_cf *)arg);
#else
err = -ENOPKG;
#endif /* CONFIG_NET_DIVERT */
break;
case SIOCADDDLCI:
case SIOCDELDLCI:
#ifdef CONFIG_DLCI
lock_kernel();
err = dlci_ioctl(cmd, (void *)arg);
unlock_kernel();
break;
#elif CONFIG_DLCI_MODULE
#ifdef CONFIG_KMOD
if (!dlci_ioctl_hook)
request_module("dlci");
#endif
if (dlci_ioctl_hook) {
lock_kernel();
err = (*dlci_ioctl_hook)(cmd, (void *)arg);
unlock_kernel();
} else
#endif
err = -ENOPKG;
break;
default: default:
if (!sk->prot->ioctl || if (!sk->prot->ioctl ||
(err = sk->prot->ioctl(sk, cmd, arg)) == (err = sk->prot->ioctl(sk, cmd, arg)) ==
......
...@@ -221,22 +221,19 @@ EXPORT_SYMBOL(destroy_EII_client); ...@@ -221,22 +221,19 @@ EXPORT_SYMBOL(destroy_EII_client);
/* for 801q VLAN support */ /* for 801q VLAN support */
#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE) #if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
EXPORT_SYMBOL(dev_change_flags); EXPORT_SYMBOL(dev_change_flags);
EXPORT_SYMBOL(vlan_ioctl_hook);
#endif #endif
EXPORT_SYMBOL(vlan_ioctl_hook);
EXPORT_SYMBOL(scm_detach_fds); EXPORT_SYMBOL(scm_detach_fds);
#if defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE) #if defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE)
EXPORT_SYMBOL(br_handle_frame_hook); EXPORT_SYMBOL(br_handle_frame_hook);
#ifdef CONFIG_INET
EXPORT_SYMBOL(br_ioctl_hook);
#endif
#endif #endif
EXPORT_SYMBOL(br_ioctl_hook);
#ifdef CONFIG_NET_DIVERT #ifdef CONFIG_NET_DIVERT
EXPORT_SYMBOL(alloc_divert_blk); EXPORT_SYMBOL(alloc_divert_blk);
EXPORT_SYMBOL(free_divert_blk); EXPORT_SYMBOL(free_divert_blk);
EXPORT_SYMBOL(divert_ioctl);
#endif /* CONFIG_NET_DIVERT */ #endif /* CONFIG_NET_DIVERT */
#ifdef CONFIG_INET #ifdef CONFIG_INET
......
...@@ -67,20 +67,11 @@ ...@@ -67,20 +67,11 @@
#include <linux/poll.h> #include <linux/poll.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/if_bridge.h>
#ifdef CONFIG_NET_DIVERT
#include <linux/divert.h>
#endif /* CONFIG_NET_DIVERT */
#ifdef CONFIG_INET #ifdef CONFIG_INET
#include <net/inet_common.h> #include <net/inet_common.h>
#endif #endif
#ifdef CONFIG_DLCI
extern int dlci_ioctl(unsigned int, void*);
#endif
#define CONFIG_SOCK_PACKET 1 #define CONFIG_SOCK_PACKET 1
/* /*
...@@ -1491,28 +1482,6 @@ static int packet_ioctl(struct socket *sock, unsigned int cmd, ...@@ -1491,28 +1482,6 @@ static int packet_ioctl(struct socket *sock, unsigned int cmd,
case SIOCSIFHWBROADCAST: case SIOCSIFHWBROADCAST:
return(dev_ioctl(cmd,(void *) arg)); return(dev_ioctl(cmd,(void *) arg));
case SIOCGIFBR:
case SIOCSIFBR:
#if defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE)
#ifdef CONFIG_INET
#ifdef CONFIG_KMOD
if (br_ioctl_hook == NULL)
request_module("bridge");
#endif
if (br_ioctl_hook != NULL)
return br_ioctl_hook(arg);
#endif
#endif
return -ENOPKG;
case SIOCGIFDIVERT:
case SIOCSIFDIVERT:
#ifdef CONFIG_NET_DIVERT
return divert_ioctl(cmd, (struct divert_cf *) arg);
#else
return -ENOPKG;
#endif /* CONFIG_NET_DIVERT */
#ifdef CONFIG_INET #ifdef CONFIG_INET
case SIOCADDRT: case SIOCADDRT:
case SIOCDELRT: case SIOCDELRT:
...@@ -1528,8 +1497,6 @@ static int packet_ioctl(struct socket *sock, unsigned int cmd, ...@@ -1528,8 +1497,6 @@ static int packet_ioctl(struct socket *sock, unsigned int cmd,
case SIOCGIFDSTADDR: case SIOCGIFDSTADDR:
case SIOCSIFDSTADDR: case SIOCSIFDSTADDR:
case SIOCSIFFLAGS: case SIOCSIFFLAGS:
case SIOCADDDLCI:
case SIOCDELDLCI:
return inet_dgram_ops.ioctl(sock, cmd, arg); return inet_dgram_ops.ioctl(sock, cmd, arg);
#endif #endif
......
...@@ -74,6 +74,8 @@ ...@@ -74,6 +74,8 @@
#include <linux/cache.h> #include <linux/cache.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/highmem.h> #include <linux/highmem.h>
#include <linux/wireless.h>
#include <linux/divert.h>
#if defined(CONFIG_KMOD) && defined(CONFIG_NET) #if defined(CONFIG_KMOD) && defined(CONFIG_NET)
#include <linux/kmod.h> #include <linux/kmod.h>
...@@ -708,6 +710,15 @@ static ssize_t sock_writev(struct file *file, const struct iovec *vector, ...@@ -708,6 +710,15 @@ static ssize_t sock_writev(struct file *file, const struct iovec *vector,
file, vector, count, tot_len); file, vector, count, tot_len);
} }
int (*br_ioctl_hook)(unsigned long arg);
int (*vlan_ioctl_hook)(unsigned long arg);
#ifdef CONFIG_DLCI
extern int dlci_ioctl(unsigned int, void *);
#else
int (*dlci_ioctl_hook)(unsigned int, void *);
#endif
/* /*
* With an ioctl, arg may well be a user mode pointer, but we don't know * With an ioctl, arg may well be a user mode pointer, but we don't know
* what to do with it - that's up to the protocol still. * what to do with it - that's up to the protocol still.
...@@ -743,6 +754,56 @@ int sock_ioctl(struct inode *inode, struct file *file, unsigned int cmd, ...@@ -743,6 +754,56 @@ int sock_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
case SIOCGPGRP: case SIOCGPGRP:
err = put_user(sock->file->f_owner.pid, (int *)arg); err = put_user(sock->file->f_owner.pid, (int *)arg);
break; break;
case SIOCGIFBR:
case SIOCSIFBR:
err = -ENOPKG;
#ifdef CONFIG_KMOD
if (!br_ioctl_hook)
request_module("bridge");
#endif
if (br_ioctl_hook)
err = br_ioctl_hook(arg);
break;
case SIOCGIFVLAN:
case SIOCSIFVLAN:
err = -ENOPKG;
#ifdef CONFIG_KMOD
if (!vlan_ioctl_hook)
request_module("8021q");
#endif
if (vlan_ioctl_hook)
err = vlan_ioctl_hook(arg);
break;
case SIOCGIFDIVERT:
case SIOCSIFDIVERT:
/* Convert this to call through a hook */
#ifdef CONFIG_NET_DIVERT
err = divert_ioctl(cmd, (struct divert_cf *)arg);
#else
err = -ENOPKG;
#endif /* CONFIG_NET_DIVERT */
break;
case SIOCADDDLCI:
case SIOCDELDLCI:
/* Convert this to always call through a hook */
#ifdef CONFIG_DLCI
lock_kernel();
err = dlci_ioctl(cmd, (void *)arg);
unlock_kernel();
break;
#else
err = -ENOPKG;
#ifdef CONFIG_KMOD
if (!dlci_ioctl_hook)
request_module("dlci");
#endif
if (dlci_ioctl_hook) {
lock_kernel();
err = dlci_ioctl_hook(cmd, (void *)arg);
unlock_kernel();
}
#endif
break;
default: default:
err = sock->ops->ioctl(sock, cmd, arg); err = sock->ops->ioctl(sock, cmd, arg);
break; break;
......
...@@ -1964,8 +1964,6 @@ static int wanpipe_ioctl(struct socket *sock, unsigned int cmd, unsigned long ar ...@@ -1964,8 +1964,6 @@ static int wanpipe_ioctl(struct socket *sock, unsigned int cmd, unsigned long ar
case SIOCGIFDSTADDR: case SIOCGIFDSTADDR:
case SIOCSIFDSTADDR: case SIOCSIFDSTADDR:
case SIOCSIFFLAGS: case SIOCSIFFLAGS:
case SIOCADDDLCI:
case SIOCDELDLCI:
return inet_dgram_ops.ioctl(sock, cmd, arg); return inet_dgram_ops.ioctl(sock, cmd, arg);
#endif #endif
......
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