tap(4) should go UP if opened
Frank Behrens
frank at pinky.sax.de
Fri Mar 9 10:53:23 UTC 2007
I want to diskuss the tap(4) behaviour before I create a PR:
The tap(4) interface does not go automatically in UP state (IFF_UP) when opened by a
process. Therefore an additional command "ifconfig tapx up" is necessary, which can
execute root only. On the other site the interface goes down automatically when closed.
I propose that tap(4) is set to UP when opened by an user process. This can be achieved
with the following patch (on FreeBSD 6.2-STABLE-200703081613):
--- sys/net/if_tap.c.orig Thu Mar 8 19:10:59 2007
+++ sys/net/if_tap.c Fri Mar 9 10:05:57 2007
@@ -501,6 +501,7 @@
s = splimp();
ifp->if_drv_flags |= IFF_DRV_RUNNING;
ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
+ ifp->if_flags |= IFF_UP;
splx(s);
TAPDEBUG("%s is open. minor = %#x\n", ifp->if_xname, minor(dev));
How does tun(4) handle this? tun(4) is also set to down, when closed. It is not set to up, when
ist is opened, but when an address is assigned by the user process. This is fine, because it
needs always an ip address. tap(4) as layer 2 tunnel device does not need an ip address, so
setting it up on open is IMHO the best solution.
Sound this reasonable or how should I handle the tap(4) open by an user process, when this
process does not run as root?
Regards,
Frank
--
Frank Behrens, Osterwieck, Germany
PGP-key 0x5B7C47ED on public servers available.
More information about the freebsd-net
mailing list