diff options
author | 2007-02-21 13:24:55 +0000 | |
---|---|---|
committer | 2007-02-21 13:24:55 +0000 | |
commit | aa986744ddec15535472aa08b132a3a211b2b3a0 (patch) | |
tree | 631451e8dfefc8675850d0c841d6d40e7f56c3e9 | |
parent | sync (diff) | |
download | wireguard-openbsd-aa986744ddec15535472aa08b132a3a211b2b3a0.tar.xz wireguard-openbsd-aa986744ddec15535472aa08b132a3a211b2b3a0.zip |
For TUNSIFMODE protect the if_flags similar to the TUNSIFINFO case.
Don't allow the userland to fiddle with flags reserved by the driver.
Noticed by Ingo Schwarze.
-rw-r--r-- | sys/net/if_tun.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/sys/net/if_tun.c b/sys/net/if_tun.c index 20b629bb6f0..09e3cc4bd2d 100644 --- a/sys/net/if_tun.c +++ b/sys/net/if_tun.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_tun.c,v 1.84 2007/02/16 13:41:21 claudio Exp $ */ +/* $OpenBSD: if_tun.c,v 1.85 2007/02/21 13:24:55 claudio Exp $ */ /* $NetBSD: if_tun.c,v 1.24 1996/05/07 02:40:48 thorpej Exp $ */ /* @@ -645,9 +645,8 @@ tunioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) switch (*(int *)data & (IFF_POINTOPOINT|IFF_BROADCAST)) { case IFF_POINTOPOINT: case IFF_BROADCAST: - tp->tun_if.if_flags &= - ~(IFF_BROADCAST|IFF_POINTOPOINT|IFF_MULTICAST); - tp->tun_if.if_flags |= *(int *)data; + tp->tun_if.if_flags &= ~TUN_IFF_FLAGS; + tp->tun_if.if_flags |= *(int *)data & TUN_IFF_FLAGS; break; default: splx(s); |