diff options
author | Brad Smith <brad@cvs.openbsd.org> | 2008-10-02 20:21:16 +0000 |
---|---|---|
committer | Brad Smith <brad@cvs.openbsd.org> | 2008-10-02 20:21:16 +0000 |
commit | 8d3b73e0ab70c1110b5b479b02809b80891945cc (patch) | |
tree | 6f9f4aecd17358436877da1307c753e5db774045 /sys/net/if_tun.c | |
parent | 6d6833da157e83635382235a3f52b938de757cc4 (diff) |
First step towards cleaning up the Ethernet driver ioctl handling.
Move calling ether_ioctl() from the top of the ioctl function, which
at the moment does absolutely nothing, to the default switch case.
Thus allowing drivers to define their own ioctl handlers and then
falling back on ether_ioctl(). The only functional change this results
in at the moment is having all Ethernet drivers returning the proper
errno of ENOTTY instead of EINVAL/ENXIO when encountering unknown
ioctl's.
Shrinks the i386 kernels by..
RAMDISK - 1024 bytes
RAMDISKB - 1120 bytes
RAMDISKC - 832 bytes
Tested by martin@/jsing@/todd@/brad@
Build tested on almost all archs by todd@/brad@
ok jsing@
Diffstat (limited to 'sys/net/if_tun.c')
-rw-r--r-- | sys/net/if_tun.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/sys/net/if_tun.c b/sys/net/if_tun.c index bd20a295b48..9b37e7ab460 100644 --- a/sys/net/if_tun.c +++ b/sys/net/if_tun.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_tun.c,v 1.94 2008/08/04 18:55:08 damien Exp $ */ +/* $OpenBSD: if_tun.c,v 1.95 2008/10/02 20:21:14 brad Exp $ */ /* $NetBSD: if_tun.c,v 1.24 1996/05/07 02:40:48 thorpej Exp $ */ /* @@ -438,11 +438,7 @@ tun_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) int error = 0, s; s = splnet(); - if (tp->tun_flags & TUN_LAYER2) - if ((error = ether_ioctl(ifp, &tp->arpcom, cmd, data)) > 0) { - splx(s); - return (error); - } + switch (cmd) { case SIOCSIFADDR: tuninit(tp); @@ -515,8 +511,12 @@ tun_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) ifp->if_flags & IFF_LINK0 ? TUN_LAYER2 : 0); break; default: - error = ENOTTY; + if (tp->tun_flags & TUN_LAYER2) + error = ether_ioctl(ifp, &tp->arpcom, cmd, data); + else + error = ENOTTY; } + splx(s); return (error); } |