Page 1 of 1

tun device was closed when starting daemon (ver2.1.3)

Posted: Wed Sep 08, 2010 11:53 am
by shakemid
Hi,

I used 2.0.9 on OpenSolaris 2009.06. It worked well. But, 2.1.3 did not work well.
The configuration is the following.

openvpn --daemon --config server.conf
--
dev tun
proto udp
server 10.8.0.0 255.255.255.0

client-to-client
push "redirect-gateway def1"

ca /etc/openvpn/keys/ca.crt
cert /etc/openvpn/keys/server.crt
key /etc/openvpn/keys/server.key
dh /etc/openvpn/keys/dh1024.pem

comp-lzo
persist-key
persist-tun
keepalive 10 120

ifconfig-pool-persist ipp.txt
status openvpn-status.log
log-append /var/log/openvpn/openvpn.log
--

With daemon mode, tun device have been closed and routing have been deleted at once at starting. And, clients can connect, but can't send/receive packets. Output logs are the following.

--
Tue Sep 7 23:01:36 2010 TUN/TAP device tun0 opened
Tue Sep 7 23:01:36 2010 /usr/sbin/ifconfig tun0 10.8.0.1 10.8.0.2 mtu 1500 up
Tue Sep 7 23:01:36 2010 /usr/sbin/ifconfig tun0 netmask 255.255.255.255
add net 10.8.0.0: gateway 10.8.0.2
Tue Sep 7 23:01:36 2010 UDPv4 link local (bound): [undef]:1194
Tue Sep 7 23:01:36 2010 UDPv4 link remote: [undef]
Tue Sep 7 23:01:36 2010 Initialization Sequence Completed
delete net 10.8.0.0: gateway 10.8.0.2
--

I found openvpn_exit() is called after fork in misc.c. And, tun_abort() is called in openvpn_exit function, thus tun device is closed.

I modified error.c as follows.

$ diff error.c.orig error.c
698c698,699
< tun_abort();
---
> if (status == OPENVPN_EXIT_STATUS_ERROR)
> tun_abort();

After that, it seemed to work well.
Clients can connect, and can send/receive packets.

Is this a probrem depends on my configuration or environment?
Does anyone know about the issue?

Regards.

Re: tun device was closed when starting daemon (ver2.1.3)

Posted: Mon Sep 13, 2010 4:16 am
by krzee
This looks worthy of a trac ticket
https://community.openvpn.net
you can use the same login / password as here

Re: tun device was closed when starting daemon (ver2.1.3)

Posted: Mon Sep 13, 2010 2:41 pm
by shakemid
>>krzee
Thank you for your reply. I created a ticket for this issue.
https://community.openvpn.net/openvpn/ticket/53