summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2007-02-21 13:24:56 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2007-02-21 13:24:56 +0000
commitc8857fc70b11845025b4bf7ff33f789a21a27e0a (patch)
treeb77027fd01414a90d03e06f37383d68b1f907495
parentaf118c5c6af9f98f063f3e9d0b4e3f793e5d7132 (diff)
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.c7
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);