Current-Users archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
SIOC[GZ]IFDATA fix
Hi.
I noticed that -current's SIOC[GZ]IFDATA doesn't work correctly.
It's OK on netbsd-8.
static int
doifioctl(struct socket *so, u_long cmd, void *data, struct lwp *l)
{
struct ifnet *ifp;
struct ifreq *ifr;
int error = 0;
#if defined(COMPAT_OSOCK) || defined(COMPAT_OIFREQ)
u_long ocmd = cmd;
#endif
short oif_flags;
#ifdef COMPAT_OIFREQ
struct ifreq ifrb;
struct oifreq *oifr = NULL;
#endif
int r;
struct psref psref;
int bound;
switch (cmd) {
case SIOCGIFCONF:
return ifconf(cmd, data);
case SIOCINITIFADDR:
return EPERM;
default:
error = (*vec_compat_ifconf)(l, cmd, data);
if (error != ENOSYS)
return error;
error = (*vec_compat_ifdatareq)(l, cmd, data);
if (error != ENOSYS) <<==================
return error;
break;
}
The call of vec_compat_ifdatareq() always returns other than ENOSYS.
Patch:
----------------
Index: uipc_syscalls_50.c
===================================================================
RCS file: /cvsroot/src/sys/compat/common/uipc_syscalls_50.c,v
retrieving revision 1.5
diff -u -p -r1.5 uipc_syscalls_50.c
--- uipc_syscalls_50.c 26 Apr 2018 08:11:18 -0000 1.5
+++ uipc_syscalls_50.c 11 Sep 2018 09:45:31 -0000
@@ -65,23 +65,24 @@ compat_ifdatareq(struct lwp *l, u_long c
/* Validate arguments. */
switch (cmd) {
- case SIOCGIFDATA:
- case SIOCZIFDATA:
- ifp = ifunit(ifdr->ifdr_name);
- if (ifp == NULL)
- return ENXIO;
+ case OSIOCGIFDATA:
+ case OSIOCZIFDATA:
break;
default:
return ENOSYS;
}
+ ifp = ifunit(ifdr->ifdr_name);
+ if (ifp == NULL)
+ return ENXIO;
+
/* Do work. */
switch (cmd) {
- case SIOCGIFDATA:
+ case OSIOCGIFDATA:
ifdatan2o(&ifdr->ifdr_data, &ifp->if_data);
return 0;
- case SIOCZIFDATA:
+ case OSIOCZIFDATA:
if (l != NULL) {
error = kauth_authorize_network(l->l_cred,
KAUTH_NETWORK_INTERFACE,
----------------
OK?
--
-----------------------------------------------
SAITOH Masanobu (msaitoh%execsw.org@localhost
msaitoh%netbsd.org@localhost)
Home |
Main Index |
Thread Index |
Old Index