From 2c4b13aa32cbe05801857d3a1a0080d8b0030155 Mon Sep 17 00:00:00 2001 From: Damien Miller Date: Tue, 10 Aug 2010 12:47:40 +1000 Subject: - (djm) bz#1561: don't bother setting IFF_UP on tun(4) device if it is already set. Makes FreeBSD user openable tunnels useful; patch from richard.burakowski+ossh AT mrburak.net, ok dtucker@ --- ChangeLog | 5 +++++ openbsd-compat/port-tun.c | 8 +++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3bb45baff..184c36980 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +20100809 + - (djm) bz#1561: don't bother setting IFF_UP on tun(4) device if it is + already set. Makes FreeBSD user openable tunnels useful; patch from + richard.burakowski+ossh AT mrburak.net, ok dtucker@ + 20100809 - OpenBSD CVS Sync - djm@cvs.openbsd.org 2010/08/08 16:26:42 diff --git a/openbsd-compat/port-tun.c b/openbsd-compat/port-tun.c index ddc92d0f3..0d756f74f 100644 --- a/openbsd-compat/port-tun.c +++ b/openbsd-compat/port-tun.c @@ -173,9 +173,11 @@ sys_tun_open(int tun, int mode) if (ioctl(sock, SIOCGIFFLAGS, &ifr) == -1) goto failed; - ifr.ifr_flags |= IFF_UP; - if (ioctl(sock, SIOCSIFFLAGS, &ifr) == -1) - goto failed; + if ((ifr.ifr_flags & IFF_UP) == 0) { + ifr.ifr_flags |= IFF_UP; + if (ioctl(sock, SIOCSIFFLAGS, &ifr) == -1) + goto failed; + } close(sock); return (fd); -- cgit v1.2.3