Fix a bug that SIOC[GZ]IFDATA returned old ifreq structure.
This commit is contained in:
parent
23db4e9bae
commit
621f6a129f
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: uipc_syscalls_50.c,v 1.5 2018/04/26 08:11:18 roy Exp $ */
|
||||
/* $NetBSD: uipc_syscalls_50.c,v 1.6 2018/09/12 02:24:25 msaitoh Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2008 The NetBSD Foundation, Inc.
|
||||
|
@ -37,7 +37,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls_50.c,v 1.5 2018/04/26 08:11:18 roy Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls_50.c,v 1.6 2018/09/12 02:24:25 msaitoh Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/kernel.h>
|
||||
|
@ -65,23 +65,24 @@ compat_ifdatareq(struct lwp *l, u_long cmd, void *data)
|
|||
|
||||
/* 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,
|
||||
|
|
Loading…
Reference in New Issue