Modify

Opened 4 years ago

Last modified 4 years ago

#15187 new defect

openvpn does not create correct tun interface (after r39439)

Reported by: risa2000 Owned by: developers
Priority: normal Milestone: Barrier Breaker 14.07
Component: packages Version: Trunk
Keywords: openvpn Cc:

Description

I am running OpenWRT on TL-WR1043NDv1, with openvpn and after r39439 I noticed that after boot tun interface is not correctly created. So r39439 works fine, but I do not know, which rev breaks it.

The log from logread for openvpn start looks fine:

Sat Mar  8 16:40:36 2014 daemon.notice openvpn(risa_wrt_srv)[879]: OpenVPN 2.3.2 mips-openwrt-linux-gnu [SSL (PolarSSL)] [LZO] [EPOLL] [MH] [IPv6] built on Mar  8 2014
Sat Mar  8 16:40:36 2014 daemon.notice openvpn(risa_wrt_srv)[879]: Diffie-Hellman initialized with 1024 bit key
Sat Mar  8 16:40:36 2014 daemon.notice openvpn(risa_wrt_srv)[879]: Socket Buffers: R=[163840->131072] S=[163840->131072]
Sat Mar  8 16:40:36 2014 daemon.notice openvpn(risa_wrt_srv)[879]: TUN/TAP device tun0 opened
Sat Mar  8 16:40:36 2014 daemon.notice openvpn(risa_wrt_srv)[879]: TUN/TAP TX queue length set to 100
Sat Mar  8 16:40:36 2014 daemon.notice openvpn(risa_wrt_srv)[879]: do_ifconfig, tt->ipv6=0, tt->did_ifconfig_ipv6_setup=0
Sat Mar  8 16:40:36 2014 daemon.notice openvpn(risa_wrt_srv)[879]: /usr/sbin/ip link set dev tun0 up mtu 1500
Sat Mar  8 16:40:36 2014 daemon.notice openvpn(risa_wrt_srv)[879]: /usr/sbin/ip addr add dev tun0 local 192.168.100.1 peer 192.168.100.2
Sat Mar  8 16:40:36 2014 daemon.notice openvpn(risa_wrt_srv)[879]: /usr/sbin/ip route add 192.168.4.0/24 via 192.168.100.2
Sat Mar  8 16:40:36 2014 daemon.notice openvpn(risa_wrt_srv)[879]: /usr/sbin/ip route add 192.168.100.0/24 via 192.168.100.2
Sat Mar  8 16:40:37 2014 daemon.notice openvpn(risa_wrt_srv)[879]: UDPv4 link local (bound): [undef]
Sat Mar  8 16:40:37 2014 daemon.notice openvpn(risa_wrt_srv)[879]: UDPv4 link remote: [undef]
Sat Mar  8 16:40:37 2014 daemon.notice openvpn(risa_wrt_srv)[879]: MULTI: multi_init called, r=256 v=256
Sat Mar  8 16:40:37 2014 daemon.notice openvpn(risa_wrt_srv)[879]: IFCONFIG POOL: base=192.168.100.4 size=62, ipv6=0
Sat Mar  8 16:40:37 2014 daemon.notice openvpn(risa_wrt_srv)[879]: IFCONFIG POOL LIST
Sat Mar  8 16:40:37 2014 daemon.notice openvpn(risa_wrt_srv)[879]: Initialization Sequence Completed

but the tun interface looks like this:

root@risa-wrt:/# ip addr show dev tun0
4: tun0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UNKNOWN group default qlen 100
    link/none

When I then manually restart openvpn, it show this in the log:

Sat Mar  8 16:54:10 2014 daemon.err openvpn(risa_wrt_srv)[879]: event_wait : Interrupted system call (code=4)
Sat Mar  8 16:54:10 2014 daemon.notice openvpn(risa_wrt_srv)[879]: /usr/sbin/ip route del 192.168.100.0/24
Sat Mar  8 16:54:10 2014 daemon.warn openvpn(risa_wrt_srv)[879]: ERROR: Linux route delete command failed: external program exited with error status: 2
Sat Mar  8 16:54:10 2014 daemon.notice openvpn(risa_wrt_srv)[879]: /usr/sbin/ip route del 192.168.4.0/24
Sat Mar  8 16:54:10 2014 daemon.warn openvpn(risa_wrt_srv)[879]: ERROR: Linux route delete command failed: external program exited with error status: 2
Sat Mar  8 16:54:10 2014 daemon.notice openvpn(risa_wrt_srv)[879]: Closing TUN/TAP interface
Sat Mar  8 16:54:10 2014 daemon.notice openvpn(risa_wrt_srv)[879]: /usr/sbin/ip addr del dev tun0 local 192.168.100.1 peer 192.168.100.2
Sat Mar  8 16:54:10 2014 daemon.warn openvpn(risa_wrt_srv)[879]: Linux ip addr del failed: external program exited with error status: 2
Sat Mar  8 16:54:10 2014 daemon.notice openvpn(risa_wrt_srv)[879]: SIGTERM[hard,] received, process exiting
Sat Mar  8 16:54:11 2014 daemon.notice openvpn(risa_wrt_srv)[1641]: OpenVPN 2.3.2 mips-openwrt-linux-gnu [SSL (PolarSSL)] [LZO] [EPOLL] [MH] [IPv6] built on Mar  8 2014
Sat Mar  8 16:54:11 2014 daemon.notice openvpn(risa_wrt_srv)[1641]: Diffie-Hellman initialized with 1024 bit key
Sat Mar  8 16:54:11 2014 daemon.notice openvpn(risa_wrt_srv)[1641]: Socket Buffers: R=[163840->131072] S=[163840->131072]
Sat Mar  8 16:54:11 2014 daemon.notice openvpn(risa_wrt_srv)[1641]: TUN/TAP device tun0 opened
Sat Mar  8 16:54:11 2014 daemon.notice openvpn(risa_wrt_srv)[1641]: TUN/TAP TX queue length set to 100
Sat Mar  8 16:54:11 2014 daemon.notice openvpn(risa_wrt_srv)[1641]: do_ifconfig, tt->ipv6=0, tt->did_ifconfig_ipv6_setup=0
Sat Mar  8 16:54:11 2014 daemon.notice openvpn(risa_wrt_srv)[1641]: /usr/sbin/ip link set dev tun0 up mtu 1500
Sat Mar  8 16:54:11 2014 daemon.notice openvpn(risa_wrt_srv)[1641]: /usr/sbin/ip addr add dev tun0 local 192.168.100.1 peer 192.168.100.2
Sat Mar  8 16:54:11 2014 daemon.notice openvpn(risa_wrt_srv)[1641]: /usr/sbin/ip route add 192.168.4.0/24 via 192.168.100.2
Sat Mar  8 16:54:11 2014 daemon.notice openvpn(risa_wrt_srv)[1641]: /usr/sbin/ip route add 192.168.100.0/24 via 192.168.100.2
Sat Mar  8 16:54:11 2014 daemon.notice openvpn(risa_wrt_srv)[1641]: UDPv4 link local (bound): [undef]
Sat Mar  8 16:54:11 2014 daemon.notice openvpn(risa_wrt_srv)[1641]: UDPv4 link remote: [undef]
Sat Mar  8 16:54:11 2014 daemon.notice openvpn(risa_wrt_srv)[1641]: MULTI: multi_init called, r=256 v=256
Sat Mar  8 16:54:11 2014 daemon.notice openvpn(risa_wrt_srv)[1641]: IFCONFIG POOL: base=192.168.100.4 size=62, ipv6=0
Sat Mar  8 16:54:11 2014 daemon.notice openvpn(risa_wrt_srv)[1641]: IFCONFIG POOL LIST
Sat Mar  8 16:54:11 2014 daemon.notice openvpn(risa_wrt_srv)[1641]: Initialization Sequence Completed

and tun interface is correctly set up:

root@risa-wrt:/# ip addr show dev tun0
9: tun0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UNKNOWN group default qlen 100
    link/none
    inet 192.168.100.1 peer 192.168.100.2/32 scope global tun0
       valid_lft forever preferred_lft forever

I assume there is some kind of race condition after r39439 which blocks correct creation, but what is strange that openvpn log output does not show any error.

Attachments (0)

Change History (3)

comment:1 Changed 4 years ago by bubik@…

Same problem on TL-WR741ND v4 with r40422. After reboot the tun0 interface is not configured with the P-t-P information. My guess is it is connected to the transition from init to procd. You can see commits dealing with procd here: https://dev.openwrt.org/search?q=procd&noquickjump=1&changeset=on Maybe the tun kernel module is not loaded yet when openvpn starts?

I found a workaround. Change /etc/init.d/openvpn to sleep one second during startup:

start_service() {
	config_load 'openvpn'
	config_foreach start_instance 'openvpn'
	sleep 1
}

comment:2 Changed 4 years ago by desigabri

thanks

comment:3 Changed 4 years ago by jow

  • Milestone changed from Attitude Adjustment 12.09 to Barrier Breaker 14.07

Milestone Attitude Adjustment 12.09 deleted

Add Comment

Modify Ticket

Action
as new .
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.