ifconfig tun create/destroy invalid argument

Aaron LI aly at aaronly.me
Sat Jul 8 19:53:40 PDT 2017


Hi,

I'm trying to setup ocserv [0], the OpenConnect VPN server on DragonFly
BSD, and I almost make it work, except for some PF configurations.

However, I found there are some problems about the "tun" pseudo device. 
Once ocserv created a connection with a client, there will be a new
"tun?" interface created, e.g., "tun4", which will normally be destroyed
 on disconnection.  But I got the following error message from ocserv:

------------------------------------------------------------------------
ocserv[560756]: main[aly]: xxx.xxx.xxx.xxx:xxxx user disconnected (reason: user disconnected, rx: xxxx, tx: xxxx)
ocserv[560756]: main: tun.c:680: tun4: Error destroying interface: Invalid argument
------------------------------------------------------------------------

Currently, I have a bunch of "tun?" devices left under "/dev" and "tun?"
interfaces:
------------------------------------------------------------------------
# ifconfig
...
tun0: flags=8010<POINTOPOINT,MULTICAST> mtu 1500
tun4: flags=8010<POINTOPOINT,MULTICAST> mtu 1162
tun5: flags=8010<POINTOPOINT,MULTICAST> mtu 1162
tun6: flags=8010<POINTOPOINT,MULTICAST> mtu 1162
tun7: flags=8010<POINTOPOINT,MULTICAST> mtu 1162
tun8: flags=8010<POINTOPOINT,MULTICAST> mtu 1162
tun9: flags=8010<POINTOPOINT,MULTICAST> mtu 1162

# ll /dev/tun*
crw-------  1 uucp  dialer   29, 0xffff00ff Apr 28 10:16 /dev/tun
crw-------  1 uucp  dialer   29, 0x00000000 Jun  2 23:38 /dev/tun0
crw-------  1 uucp  dialer   29, 0x00000001 Apr 28 10:16 /dev/tun1
crw-------  1 uucp  dialer   29, 0x00000002 Apr 28 10:16 /dev/tun2
crw-------  1 uucp  dialer   29, 0x00000003 Apr 28 10:16 /dev/tun3
crw-------  1 uucp  dialer   29, 0x00000004 Jul  8 16:44 /dev/tun4
crw-------  1 uucp  dialer   29, 0x00000004 Jul  8 16:49 /dev/tun5
crw-------  1 uucp  dialer   29, 0x00000004 Jul  8 18:45 /dev/tun6
crw-------  1 uucp  dialer   29, 0x00000004 Jul  8 18:53 /dev/tun7
crw-------  1 uucp  dialer   29, 0x00000004 Jul  8 18:56 /dev/tun8
crw-------  1 uucp  dialer   29, 0x00000004 Jul  8 19:00 /dev/tun9
------------------------------------------------------------------------
(NOTE: the "tun0" interface was previously created and left by OpenVPN.)

When I tried to manually destroy the "tun?" interfaces using "ifconfig":
------------------------------------------------------------------------
# ifconfig tun4 destropy
ifconfig: SIOCIFDESTROY: Invalid argument
------------------------------------------------------------------------

On the other hand, I cannot create a new "tun?" interface with
"ifconfig":
------------------------------------------------------------------------
# ifconfig tun10 create
ifconfig: SIOCIFCREATE2: Invalid argument
# ifconfig tun create
ifconfig: SIOCIFCREATE2: Invalid argument
------------------------------------------------------------------------

I tested these problems both on DragonFly BSD 4.8.0-RELEASE and 4.9-
DEVELOPMENT (Jun-8).

Also there is a mail reporting a similar issue on 2008-Aug [1], but got
no response.


[0] ocserv: https://www.infradead.org/ocserv/
[1] http://lists.dragonflybsd.org/pipermail/users/2014-August/290221.html


Regards,
-- 
Aly
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <http://lists.dragonflybsd.org/pipermail/users/attachments/20170709/28633ae7/attachment.bin>


More information about the Users mailing list