The path of SOICSIFMEDA or TAPGIFNAME calls are as follows:

doifioctl()

    pre-convert (if_cvtcmd_43_hook & ifreqo2n)

    (*ifp->if_ioctl)(ifp, cmd, data);

    post-convert (ifreqn2o)

so it's not required to check OSIOCSIFMEDIA and OTAPGIFNAME in if_tap.c.
Those two command is converted to new command in if_cvtcmd_43_hook and
always new commands are seen in tap_ioctl().

OK'd by pgoyette.
This commit is contained in:
msaitoh 2019-04-16 04:26:02 +00:00
parent 1532ab65e0
commit 01277d2430
1 changed files with 2 additions and 11 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_tap.c,v 1.109 2019/03/25 09:59:59 pgoyette Exp $ */ /* $NetBSD: if_tap.c,v 1.110 2019/04/16 04:26:02 msaitoh Exp $ */
/* /*
* Copyright (c) 2003, 2004, 2008, 2009 The NetBSD Foundation. * Copyright (c) 2003, 2004, 2008, 2009 The NetBSD Foundation.
@ -33,12 +33,11 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_tap.c,v 1.109 2019/03/25 09:59:59 pgoyette Exp $"); __KERNEL_RCSID(0, "$NetBSD: if_tap.c,v 1.110 2019/04/16 04:26:02 msaitoh Exp $");
#if defined(_KERNEL_OPT) #if defined(_KERNEL_OPT)
#include "opt_modular.h" #include "opt_modular.h"
#include "opt_compat_netbsd.h"
#endif #endif
#include <sys/param.h> #include <sys/param.h>
@ -70,8 +69,6 @@ __KERNEL_RCSID(0, "$NetBSD: if_tap.c,v 1.109 2019/03/25 09:59:59 pgoyette Exp $"
#include <net/if_tap.h> #include <net/if_tap.h>
#include <net/bpf.h> #include <net/bpf.h>
#include <compat/sys/sockio.h>
#include "ioconf.h" #include "ioconf.h"
/* /*
@ -581,9 +578,6 @@ tap_ioctl(struct ifnet *ifp, u_long cmd, void *data)
s = splnet(); s = splnet();
switch (cmd) { switch (cmd) {
#ifdef OSIOCSIFMEDIA
case OSIOCSIFMEDIA:
#endif
case SIOCSIFMEDIA: case SIOCSIFMEDIA:
case SIOCGIFMEDIA: case SIOCGIFMEDIA:
error = ifmedia_ioctl(ifp, ifr, &sc->sc_im, cmd); error = ifmedia_ioctl(ifp, ifr, &sc->sc_im, cmd);
@ -1164,9 +1158,6 @@ tap_dev_ioctl(int unit, u_long cmd, void *data, struct lwp *l)
else else
sc->sc_flags &= ~TAP_NBIO; sc->sc_flags &= ~TAP_NBIO;
return 0; return 0;
#ifdef OTAPGIFNAME
case OTAPGIFNAME:
#endif
case TAPGIFNAME: case TAPGIFNAME:
{ {
struct ifreq *ifr = (struct ifreq *)data; struct ifreq *ifr = (struct ifreq *)data;