Mon Nov 27 14:07:53 2017 UTC ()
Pull up following revision(s) (requested by jmcneill in ticket #396):
	sys/compat/netbsd32/netbsd32_ioctl.h: revision 1.57
	sys/compat/netbsd32/netbsd32_ioctl.c: revision 1.90
Add support for SIOCGIFGENERIC and SIOCSIFGENERIC ioctls.


(martin)
diff -r1.89 -r1.89.8.1 src/sys/compat/netbsd32/netbsd32_ioctl.c
diff -r1.56 -r1.56.8.1 src/sys/compat/netbsd32/netbsd32_ioctl.h

cvs diff -r1.89 -r1.89.8.1 src/sys/compat/netbsd32/netbsd32_ioctl.c (expand / switch to unified diff)

--- src/sys/compat/netbsd32/netbsd32_ioctl.c 2017/01/14 16:34:44 1.89
+++ src/sys/compat/netbsd32/netbsd32_ioctl.c 2017/11/27 14:07:53 1.89.8.1
@@ -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
108static inline void 108static inline void
109netbsd32_to_ifreq(struct netbsd32_ifreq *s32p, struct ifreq *p, u_long cmd) 109netbsd32_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
123static inline void 129static inline void
124netbsd32_to_oifreq(struct netbsd32_oifreq *s32p, struct oifreq *p, u_long cmd) 130netbsd32_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
526static inline void 532static inline void
527netbsd32_from_ifreq(struct ifreq *p, struct netbsd32_ifreq *s32p, u_long cmd) 533netbsd32_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
541static inline void 553static inline void
542netbsd32_from_oifreq(struct oifreq *p, struct netbsd32_oifreq *s32p, u_long cmd) 554netbsd32_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);

cvs diff -r1.56 -r1.56.8.1 src/sys/compat/netbsd32/netbsd32_ioctl.h (expand / switch to unified diff)

--- src/sys/compat/netbsd32/netbsd32_ioctl.h 2016/12/26 23:05:06 1.56
+++ src/sys/compat/netbsd32/netbsd32_ioctl.h 2017/11/27 14:07:53 1.56.8.1
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: netbsd32_ioctl.h,v 1.56 2016/12/26 23:05:06 christos Exp $ */ 1/* $NetBSD: netbsd32_ioctl.h,v 1.56.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.
@@ -364,26 +364,29 @@ struct netbsd32_if_clonereq { @@ -364,26 +364,29 @@ struct netbsd32_if_clonereq {
364 364
365#define SIOCSIFADDRPREF32 _IOW('i', 31, struct netbsd32_if_addrprefreq) 365#define SIOCSIFADDRPREF32 _IOW('i', 31, struct netbsd32_if_addrprefreq)
366#define SIOCGIFADDRPREF32 _IOWR('i', 32, struct netbsd32_if_addrprefreq) 366#define SIOCGIFADDRPREF32 _IOWR('i', 32, struct netbsd32_if_addrprefreq)
367 367
368#define SIOCADDMULTI32 _IOW('i', 49, struct netbsd32_ifreq) /* add m'cast addr */ 368#define SIOCADDMULTI32 _IOW('i', 49, struct netbsd32_ifreq) /* add m'cast addr */
369#define OSIOCADDMULTI32 _IOW('i', 49, struct netbsd32_oifreq) /* add m'cast addr */ 369#define OSIOCADDMULTI32 _IOW('i', 49, struct netbsd32_oifreq) /* add m'cast addr */
370 370
371#define SIOCDELMULTI32 _IOW('i', 50, struct netbsd32_ifreq) /* del m'cast addr */ 371#define SIOCDELMULTI32 _IOW('i', 50, struct netbsd32_ifreq) /* del m'cast addr */
372#define OSIOCDELMULTI32 _IOW('i', 50, struct netbsd32_oifreq) /* del m'cast addr */ 372#define OSIOCDELMULTI32 _IOW('i', 50, struct netbsd32_oifreq) /* del m'cast addr */
373 373
374#define SIOCSIFMEDIA32 _IOWR('i', 53, struct netbsd32_ifreq) /* set net media */ 374#define SIOCSIFMEDIA32 _IOWR('i', 53, struct netbsd32_ifreq) /* set net media */
375#define OSIOCSIFMEDIA32 _IOWR('i', 53, struct netbsd32_oifreq) /* set net media */ 375#define OSIOCSIFMEDIA32 _IOWR('i', 53, struct netbsd32_oifreq) /* set net media */
376 376
 377#define SIOCSIFGENERIC32 _IOW('i', 57, struct netbsd32_ifreq) /* generic IF set op */
 378#define SIOCGIFGENERIC32 _IOWR('i', 58, struct netbsd32_ifreq) /* generic IF get op */
 379
377#define SIOCIFGCLONERS32 _IOWR('i', 120, struct netbsd32_if_clonereq) /* get cloners */ 380#define SIOCIFGCLONERS32 _IOWR('i', 120, struct netbsd32_if_clonereq) /* get cloners */
378 381
379#define SIOCSIFMTU32 _IOW('i', 127, struct netbsd32_ifreq) /* set ifnet mtu */ 382#define SIOCSIFMTU32 _IOW('i', 127, struct netbsd32_ifreq) /* set ifnet mtu */
380#define OSIOCSIFMTU32 _IOW('i', 127, struct netbsd32_oifreq) /* set ifnet mtu */ 383#define OSIOCSIFMTU32 _IOW('i', 127, struct netbsd32_oifreq) /* set ifnet mtu */
381 384
382#define SIOCGIFMTU32 _IOWR('i', 126, struct netbsd32_ifreq) /* get ifnet mtu */ 385#define SIOCGIFMTU32 _IOWR('i', 126, struct netbsd32_ifreq) /* get ifnet mtu */
383#define OSIOCGIFMTU32 _IOWR('i', 126, struct netbsd32_oifreq) /* get ifnet mtu */ 386#define OSIOCGIFMTU32 _IOWR('i', 126, struct netbsd32_oifreq) /* get ifnet mtu */
384/* was 125 SIOCSIFASYNCMAP32 */ 387/* was 125 SIOCSIFASYNCMAP32 */
385/* was 124 SIOCGIFASYNCMAP32 */ 388/* was 124 SIOCGIFASYNCMAP32 */
386/* from <net/bpf.h> */ 389/* from <net/bpf.h> */
387#define BIOCGETIF32 _IOR('B',107, struct netbsd32_ifreq) 390#define BIOCGETIF32 _IOR('B',107, struct netbsd32_ifreq)
388#define BIOCSETIF32 _IOW('B',108, struct netbsd32_ifreq) 391#define BIOCSETIF32 _IOW('B',108, struct netbsd32_ifreq)
389/* from <netatalk/phase2.h> */ 392/* from <netatalk/phase2.h> */