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

This forum is for admins who are looking to build or expand their OpenVPN setup.

Moderators: TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech

Forum rules
Please use the [oconf] BB tag for openvpn Configurations. See viewtopic.php?f=30&t=21589 for an example.
Post Reply
shakemid
OpenVpn Newbie
Posts: 2
Joined: Wed Sep 08, 2010 11:45 am

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

Post by shakemid » Wed Sep 08, 2010 11:53 am

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.

User avatar
krzee
Forum Team
Posts: 728
Joined: Fri Aug 29, 2008 5:42 pm

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

Post by krzee » Mon Sep 13, 2010 4:16 am

This looks worthy of a trac ticket
https://community.openvpn.net
you can use the same login / password as here

shakemid
OpenVpn Newbie
Posts: 2
Joined: Wed Sep 08, 2010 11:45 am

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

Post by shakemid » Mon Sep 13, 2010 2:41 pm

>>krzee
Thank you for your reply. I created a ticket for this issue.
https://community.openvpn.net/openvpn/ticket/53

Post Reply