summarylogtreecommitdiffstats
path: root/legacy-wireless-ioctls-4.9+.patch
blob: 715325283ff9b9d054a3adbd2e00cdd0eeb6b5f4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
fix: ioctl[RTL_IOCTL_HOSTAPD]: Operation not supported
from: https://github.com/lwfinger/rtl8188eu/issues/257
author: Ablinne
url: https://pastebin.com/2nmLS4d6

--- src_orig/archlinux-linux/net/wireless/wext-core.c	2018-12-07 15:55:27.385876108 +0100
+++ src/archlinux-linux/net/wireless/wext-core.c	2018-12-07 13:40:56.138049613 +0100
@@ -912,12 +912,13 @@
  * Main IOCTl dispatcher.
  * Check the type of IOCTL and call the appropriate wrapper...
  */
-static int wireless_process_ioctl(struct net *net, struct iwreq *iwr,
+static int wireless_process_ioctl(struct net *net, struct ifreq *ifr,
 				  unsigned int cmd,
 				  struct iw_request_info *info,
 				  wext_ioctl_func standard,
 				  wext_ioctl_func private)
 {
+	struct iwreq *iwr = (struct iwreq *) ifr;
 	struct net_device *dev;
 	iw_handler	handler;
 
@@ -925,7 +926,7 @@
 	 * The copy_to/from_user() of ifr is also dealt with in there */
 
 	/* Make sure the device exist */
-	if ((dev = __dev_get_by_name(net, iwr->ifr_name)) == NULL)
+	if ((dev = __dev_get_by_name(net, ifr->ifr_name)) == NULL)
 		return -ENODEV;
 
 	/* A bunch of special cases, then the generic case...
@@ -954,6 +955,9 @@
 		else if (private)
 			return private(dev, iwr, cmd, info, handler);
 	}
+	/* Old driver API : call driver ioctl handler */
+	if (dev->netdev_ops->ndo_do_ioctl)
+		return dev->netdev_ops->ndo_do_ioctl(dev, ifr, cmd);
 	return -EOPNOTSUPP;
 }
 
@@ -971,7 +975,7 @@
 }
 
 /* entry point from dev ioctl */
-static int wext_ioctl_dispatch(struct net *net, struct iwreq *iwr,
+static int wext_ioctl_dispatch(struct net *net, struct ifreq *ifr,
 			       unsigned int cmd, struct iw_request_info *info,
 			       wext_ioctl_func standard,
 			       wext_ioctl_func private)
@@ -981,9 +985,9 @@
 	if (ret)
 		return ret;
 
-	dev_load(net, iwr->ifr_name);
+	dev_load(net, ifr->ifr_name);
 	rtnl_lock();
-	ret = wireless_process_ioctl(net, iwr, cmd, info, standard, private);
+	ret = wireless_process_ioctl(net, ifr, cmd, info, standard, private);
 	rtnl_unlock();
 
 	return ret;
@@ -1044,7 +1048,7 @@
 
 	iwr.ifr_name[sizeof(iwr.ifr_name) - 1] = 0;
 
-	ret = wext_ioctl_dispatch(net, &iwr, cmd, &info,
+	ret = wext_ioctl_dispatch(net, (struct ifreq *) &iwr, cmd, &info,
 				  ioctl_standard_call,
 				  ioctl_private_call);
 	if (ret >= 0 &&
@@ -1106,7 +1110,7 @@
 	info.cmd = cmd;
 	info.flags = IW_REQUEST_FLAG_COMPAT;
 
-	ret = wext_ioctl_dispatch(net, &iwr, cmd, &info,
+	ret = wext_ioctl_dispatch(net, (struct ifreq *) &iwr, cmd, &info,
 				  compat_standard_call,
 				  compat_private_call);