diff options
author | Johannes Berg <johannes@sipsolutions.net> | 2007-04-26 23:43:56 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2007-04-26 23:43:56 -0400 |
commit | 295f4a1fa3ecdf816b18393ef7bcd37c032df2fa (patch) | |
tree | 231c71578608e46b45dd36006dd1112a6bc6c39a /net/wireless | |
parent | 11433ee450eb4a320f46ce5ed51410b52803ffcc (diff) |
[WEXT]: Clean up how wext is called.
This patch cleans up the call paths from the core code into wext.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/wireless')
-rw-r--r-- | net/wireless/wext.c | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/net/wireless/wext.c b/net/wireless/wext.c index fba295e05e7a..a6cf1034e07c 100644 --- a/net/wireless/wext.c +++ b/net/wireless/wext.c | |||
@@ -97,6 +97,7 @@ | |||
97 | #include <linux/wireless.h> /* Pretty obvious */ | 97 | #include <linux/wireless.h> /* Pretty obvious */ |
98 | #include <net/iw_handler.h> /* New driver API */ | 98 | #include <net/iw_handler.h> /* New driver API */ |
99 | #include <net/netlink.h> | 99 | #include <net/netlink.h> |
100 | #include <net/wext.h> | ||
100 | 101 | ||
101 | #include <asm/uaccess.h> /* copy_to_user() */ | 102 | #include <asm/uaccess.h> /* copy_to_user() */ |
102 | 103 | ||
@@ -696,7 +697,7 @@ static const struct file_operations wireless_seq_fops = { | |||
696 | .release = seq_release, | 697 | .release = seq_release, |
697 | }; | 698 | }; |
698 | 699 | ||
699 | int __init wireless_proc_init(void) | 700 | int __init wext_proc_init(void) |
700 | { | 701 | { |
701 | /* Create /proc/net/wireless entry */ | 702 | /* Create /proc/net/wireless entry */ |
702 | if (!proc_net_fops_create("wireless", S_IRUGO, &wireless_seq_fops)) | 703 | if (!proc_net_fops_create("wireless", S_IRUGO, &wireless_seq_fops)) |
@@ -1075,11 +1076,10 @@ static inline int ioctl_private_call(struct net_device * dev, | |||
1075 | 1076 | ||
1076 | /* ---------------------------------------------------------------- */ | 1077 | /* ---------------------------------------------------------------- */ |
1077 | /* | 1078 | /* |
1078 | * Main IOCTl dispatcher. Called from the main networking code | 1079 | * Main IOCTl dispatcher. |
1079 | * (dev_ioctl() in net/core/dev.c). | ||
1080 | * Check the type of IOCTL and call the appropriate wrapper... | 1080 | * Check the type of IOCTL and call the appropriate wrapper... |
1081 | */ | 1081 | */ |
1082 | int wireless_process_ioctl(struct ifreq *ifr, unsigned int cmd) | 1082 | static int wireless_process_ioctl(struct ifreq *ifr, unsigned int cmd) |
1083 | { | 1083 | { |
1084 | struct net_device *dev; | 1084 | struct net_device *dev; |
1085 | iw_handler handler; | 1085 | iw_handler handler; |
@@ -1143,6 +1143,26 @@ int wireless_process_ioctl(struct ifreq *ifr, unsigned int cmd) | |||
1143 | return -EINVAL; | 1143 | return -EINVAL; |
1144 | } | 1144 | } |
1145 | 1145 | ||
1146 | /* entry point from dev ioctl */ | ||
1147 | int wext_handle_ioctl(struct ifreq *ifr, unsigned int cmd, | ||
1148 | void __user *arg) | ||
1149 | { | ||
1150 | int ret; | ||
1151 | |||
1152 | /* If command is `set a parameter', or | ||
1153 | * `get the encoding parameters', check if | ||
1154 | * the user has the right to do it */ | ||
1155 | if (IW_IS_SET(cmd) || cmd == SIOCGIWENCODE || cmd == SIOCGIWENCODEEXT) | ||
1156 | if (!capable(CAP_NET_ADMIN)) | ||
1157 | return -EPERM; | ||
1158 | dev_load(ifr->ifr_name); | ||
1159 | rtnl_lock(); | ||
1160 | ret = wireless_process_ioctl(ifr, cmd); | ||
1161 | rtnl_unlock(); | ||
1162 | if (IW_IS_GET(cmd) && copy_to_user(arg, ifr, sizeof(struct ifreq))) | ||
1163 | return -EFAULT; | ||
1164 | return ret; | ||
1165 | } | ||
1146 | 1166 | ||
1147 | /************************* EVENT PROCESSING *************************/ | 1167 | /************************* EVENT PROCESSING *************************/ |
1148 | /* | 1168 | /* |