| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: netbsd32_ioctl.c,v 1.89 2017/01/14 16:34:44 maya Exp $ */ | | 1 | /* $NetBSD: netbsd32_ioctl.c,v 1.89.8.1 2017/11/27 14:07:53 martin Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 1998, 2001 Matthew R. Green | | 4 | * Copyright (c) 1998, 2001 Matthew R. Green |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * Redistribution and use in source and binary forms, with or without | | 7 | * Redistribution and use in source and binary forms, with or without |
8 | * modification, are permitted provided that the following conditions | | 8 | * modification, are permitted provided that the following conditions |
9 | * are met: | | 9 | * are met: |
10 | * 1. Redistributions of source code must retain the above copyright | | 10 | * 1. Redistributions of source code must retain the above copyright |
11 | * notice, this list of conditions and the following disclaimer. | | 11 | * notice, this list of conditions and the following disclaimer. |
12 | * 2. Redistributions in binary form must reproduce the above copyright | | 12 | * 2. Redistributions in binary form must reproduce the above copyright |
13 | * notice, this list of conditions and the following disclaimer in the | | 13 | * notice, this list of conditions and the following disclaimer in the |
14 | * documentation and/or other materials provided with the distribution. | | 14 | * documentation and/or other materials provided with the distribution. |
| @@ -21,27 +21,27 @@ | | | @@ -21,27 +21,27 @@ |
21 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | | 21 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED | | 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
23 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | | 23 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | | 24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
25 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | | 25 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
26 | * SUCH DAMAGE. | | 26 | * SUCH DAMAGE. |
27 | */ | | 27 | */ |
28 | | | 28 | |
29 | /* | | 29 | /* |
30 | * handle ioctl conversions from netbsd32 -> 64-bit kernel | | 30 | * handle ioctl conversions from netbsd32 -> 64-bit kernel |
31 | */ | | 31 | */ |
32 | | | 32 | |
33 | #include <sys/cdefs.h> | | 33 | #include <sys/cdefs.h> |
34 | __KERNEL_RCSID(0, "$NetBSD: netbsd32_ioctl.c,v 1.89 2017/01/14 16:34:44 maya Exp $"); | | 34 | __KERNEL_RCSID(0, "$NetBSD: netbsd32_ioctl.c,v 1.89.8.1 2017/11/27 14:07:53 martin Exp $"); |
35 | | | 35 | |
36 | #if defined(_KERNEL_OPT) | | 36 | #if defined(_KERNEL_OPT) |
37 | #include "opt_ntp.h" | | 37 | #include "opt_ntp.h" |
38 | #endif | | 38 | #endif |
39 | | | 39 | |
40 | #include <sys/param.h> | | 40 | #include <sys/param.h> |
41 | #include <sys/systm.h> | | 41 | #include <sys/systm.h> |
42 | #include <sys/filedesc.h> | | 42 | #include <sys/filedesc.h> |
43 | #include <sys/ioctl.h> | | 43 | #include <sys/ioctl.h> |
44 | #include <sys/file.h> | | 44 | #include <sys/file.h> |
45 | #include <sys/proc.h> | | 45 | #include <sys/proc.h> |
46 | #include <sys/socketvar.h> | | 46 | #include <sys/socketvar.h> |
47 | #include <sys/audioio.h> | | 47 | #include <sys/audioio.h> |
| @@ -106,28 +106,34 @@ netbsd32_to_format_op(struct netbsd32_fo | | | @@ -106,28 +106,34 @@ netbsd32_to_format_op(struct netbsd32_fo |
106 | #endif | | 106 | #endif |
107 | | | 107 | |
108 | static inline void | | 108 | static inline void |
109 | netbsd32_to_ifreq(struct netbsd32_ifreq *s32p, struct ifreq *p, u_long cmd) | | 109 | netbsd32_to_ifreq(struct netbsd32_ifreq *s32p, struct ifreq *p, u_long cmd) |
110 | { | | 110 | { |
111 | | | 111 | |
112 | memcpy(p, s32p, sizeof *s32p); | | 112 | memcpy(p, s32p, sizeof *s32p); |
113 | /* | | 113 | /* |
114 | * XXX | | 114 | * XXX |
115 | * struct ifreq says the same, but sometimes the ifr_data | | 115 | * struct ifreq says the same, but sometimes the ifr_data |
116 | * union member needs to be converted to 64 bits... this | | 116 | * union member needs to be converted to 64 bits... this |
117 | * is very driver specific and so we ignore it for now.. | | 117 | * is very driver specific and so we ignore it for now.. |
118 | */ | | 118 | */ |
119 | if (cmd == SIOCGIFDATA || cmd == SIOCZIFDATA) | | 119 | switch (cmd) { |
| | | 120 | case SIOCGIFDATA: |
| | | 121 | case SIOCZIFDATA: |
| | | 122 | case SIOCGIFGENERIC: |
| | | 123 | case SIOCSIFGENERIC: |
120 | p->ifr_data = (void *)NETBSD32PTR64(s32p->ifr_data); | | 124 | p->ifr_data = (void *)NETBSD32PTR64(s32p->ifr_data); |
| | | 125 | break; |
| | | 126 | } |
121 | } | | 127 | } |
122 | | | 128 | |
123 | static inline void | | 129 | static inline void |
124 | netbsd32_to_oifreq(struct netbsd32_oifreq *s32p, struct oifreq *p, u_long cmd) | | 130 | netbsd32_to_oifreq(struct netbsd32_oifreq *s32p, struct oifreq *p, u_long cmd) |
125 | { | | 131 | { |
126 | | | 132 | |
127 | memcpy(p, s32p, sizeof *s32p); | | 133 | memcpy(p, s32p, sizeof *s32p); |
128 | /* | | 134 | /* |
129 | * XXX | | 135 | * XXX |
130 | * struct ifreq says the same, but sometimes the ifr_data | | 136 | * struct ifreq says the same, but sometimes the ifr_data |
131 | * union member needs to be converted to 64 bits... this | | 137 | * union member needs to be converted to 64 bits... this |
132 | * is very driver specific and so we ignore it for now.. | | 138 | * is very driver specific and so we ignore it for now.. |
133 | */ | | 139 | */ |
| @@ -524,28 +530,34 @@ netbsd32_from_format_op(struct format_op | | | @@ -524,28 +530,34 @@ netbsd32_from_format_op(struct format_op |
524 | #endif | | 530 | #endif |
525 | | | 531 | |
526 | static inline void | | 532 | static inline void |
527 | netbsd32_from_ifreq(struct ifreq *p, struct netbsd32_ifreq *s32p, u_long cmd) | | 533 | netbsd32_from_ifreq(struct ifreq *p, struct netbsd32_ifreq *s32p, u_long cmd) |
528 | { | | 534 | { |
529 | | | 535 | |
530 | /* | | 536 | /* |
531 | * XXX | | 537 | * XXX |
532 | * struct ifreq says the same, but sometimes the ifr_data | | 538 | * struct ifreq says the same, but sometimes the ifr_data |
533 | * union member needs to be converted to 64 bits... this | | 539 | * union member needs to be converted to 64 bits... this |
534 | * is very driver specific and so we ignore it for now.. | | 540 | * is very driver specific and so we ignore it for now.. |
535 | */ | | 541 | */ |
536 | memcpy(s32p, p, sizeof *s32p); | | 542 | memcpy(s32p, p, sizeof *s32p); |
537 | if (cmd == SIOCGIFDATA || cmd == SIOCZIFDATA) | | 543 | switch (cmd) { |
| | | 544 | case SIOCGIFDATA: |
| | | 545 | case SIOCZIFDATA: |
| | | 546 | case SIOCGIFGENERIC: |
| | | 547 | case SIOCSIFGENERIC: |
538 | NETBSD32PTR32(s32p->ifr_data, p->ifr_data); | | 548 | NETBSD32PTR32(s32p->ifr_data, p->ifr_data); |
| | | 549 | break; |
| | | 550 | } |
539 | } | | 551 | } |
540 | | | 552 | |
541 | static inline void | | 553 | static inline void |
542 | netbsd32_from_oifreq(struct oifreq *p, struct netbsd32_oifreq *s32p, u_long cmd) | | 554 | netbsd32_from_oifreq(struct oifreq *p, struct netbsd32_oifreq *s32p, u_long cmd) |
543 | { | | 555 | { |
544 | | | 556 | |
545 | /* | | 557 | /* |
546 | * XXX | | 558 | * XXX |
547 | * struct ifreq says the same, but sometimes the ifr_data | | 559 | * struct ifreq says the same, but sometimes the ifr_data |
548 | * union member needs to be converted to 64 bits... this | | 560 | * union member needs to be converted to 64 bits... this |
549 | * is very driver specific and so we ignore it for now.. | | 561 | * is very driver specific and so we ignore it for now.. |
550 | */ | | 562 | */ |
551 | memcpy(s32p, p, sizeof *s32p); | | 563 | memcpy(s32p, p, sizeof *s32p); |
| @@ -1223,26 +1235,31 @@ netbsd32_ioctl(struct lwp *l, const stru | | | @@ -1223,26 +1235,31 @@ netbsd32_ioctl(struct lwp *l, const stru |
1223 | IOCTL_STRUCT_CONV_TO(SIOCGIFADDRPREF, if_addrprefreq); | | 1235 | IOCTL_STRUCT_CONV_TO(SIOCGIFADDRPREF, if_addrprefreq); |
1224 | case SIOCSIFADDRPREF32: | | 1236 | case SIOCSIFADDRPREF32: |
1225 | IOCTL_STRUCT_CONV_TO(SIOCSIFADDRPREF, if_addrprefreq); | | 1237 | IOCTL_STRUCT_CONV_TO(SIOCSIFADDRPREF, if_addrprefreq); |
1226 | | | 1238 | |
1227 | | | 1239 | |
1228 | case OSIOCGIFFLAGS32: | | 1240 | case OSIOCGIFFLAGS32: |
1229 | IOCTL_STRUCT_CONV_TO(OSIOCGIFFLAGS, oifreq); | | 1241 | IOCTL_STRUCT_CONV_TO(OSIOCGIFFLAGS, oifreq); |
1230 | case OSIOCSIFFLAGS32: | | 1242 | case OSIOCSIFFLAGS32: |
1231 | IOCTL_STRUCT_CONV_TO(OSIOCSIFFLAGS, oifreq); | | 1243 | IOCTL_STRUCT_CONV_TO(OSIOCSIFFLAGS, oifreq); |
1232 | | | 1244 | |
1233 | case SIOCGIFMEDIA32: | | 1245 | case SIOCGIFMEDIA32: |
1234 | IOCTL_STRUCT_CONV_TO(SIOCGIFMEDIA, ifmediareq); | | 1246 | IOCTL_STRUCT_CONV_TO(SIOCGIFMEDIA, ifmediareq); |
1235 | | | 1247 | |
| | | 1248 | case SIOCGIFGENERIC32: |
| | | 1249 | IOCTL_STRUCT_CONV_TO(SIOCGIFGENERIC, ifreq); |
| | | 1250 | case SIOCSIFGENERIC32: |
| | | 1251 | IOCTL_STRUCT_CONV_TO(SIOCSIFGENERIC, ifreq); |
| | | 1252 | |
1236 | case PPPOESETPARMS32: | | 1253 | case PPPOESETPARMS32: |
1237 | IOCTL_STRUCT_CONV_TO(PPPOESETPARMS, pppoediscparms); | | 1254 | IOCTL_STRUCT_CONV_TO(PPPOESETPARMS, pppoediscparms); |
1238 | case PPPOEGETPARMS32: | | 1255 | case PPPOEGETPARMS32: |
1239 | IOCTL_STRUCT_CONV_TO(PPPOEGETPARMS, pppoediscparms); | | 1256 | IOCTL_STRUCT_CONV_TO(PPPOEGETPARMS, pppoediscparms); |
1240 | case SPPPGETAUTHCFG32: | | 1257 | case SPPPGETAUTHCFG32: |
1241 | IOCTL_STRUCT_CONV_TO(SPPPGETAUTHCFG, spppauthcfg); | | 1258 | IOCTL_STRUCT_CONV_TO(SPPPGETAUTHCFG, spppauthcfg); |
1242 | case SPPPSETAUTHCFG32: | | 1259 | case SPPPSETAUTHCFG32: |
1243 | IOCTL_STRUCT_CONV_TO(SPPPSETAUTHCFG, spppauthcfg); | | 1260 | IOCTL_STRUCT_CONV_TO(SPPPSETAUTHCFG, spppauthcfg); |
1244 | | | 1261 | |
1245 | case SIOCSDRVSPEC32: | | 1262 | case SIOCSDRVSPEC32: |
1246 | IOCTL_STRUCT_CONV_TO(SIOCSDRVSPEC, ifdrv); | | 1263 | IOCTL_STRUCT_CONV_TO(SIOCSDRVSPEC, ifdrv); |
1247 | case SIOCGDRVSPEC32: | | 1264 | case SIOCGDRVSPEC32: |
1248 | IOCTL_STRUCT_CONV_TO(SIOCGDRVSPEC, ifdrv); | | 1265 | IOCTL_STRUCT_CONV_TO(SIOCGDRVSPEC, ifdrv); |