openwrt / openwrt/netifd

multiple openvpn interfaces restart badly

Open
#37 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
37
Forks
62
PR merge metrics
No merged PRs in 30d

Description

Steps to reproduce:

  1. configure multiple openvpn servers
  2. service openvpn restart

Expected result: reconfigured network for each openvpn interface brought up
Actually, the expected result is achieved in less than about 10% of tries. In other 90% only one of interfaces get configured fully.

good run:

daemon.notice netifd: Network device 'mTunUdp' link is down
daemon.notice netifd: Interface 'm_tun_udp' has link connectivity loss
daemon.notice netifd: Interface 'm_tun_udp' is now down
daemon.err netifd[1006]: interface_queue_event(124): Queue hotplug handler for interface 'm_tun_udp', event 'ifdown'
daemon.err netifd[1006]: call_hotplug(100): Call hotplug handler for interface 'm_tun_udp', event 'ifdown' (none)
daemon.err netifd[1006]: device_remove_user(1113): Remove user for device 'mTunUdp', refcount=1
daemon.err netifd[1006]: device_set_present(951): Network device 'mTunUdp' is no longer present
daemon.err netifd[1006]: interface_set_available(487): Interface 'm_tun_udp', available=0
daemon.err netifd[1006]: device_release(731): Release Network device mTunUdp, new active count: 0
daemon.notice netifd: Interface 'm_tun_udp' is disabled
daemon.err netifd[1006]: device_set_present(951): Network device 'mTunTcp' is no longer present
daemon.err netifd[1006]: interface_set_available(487): Interface 'm_tun_tcp', available=0
daemon.err netifd[1006]: interface_queue_event(124): Queue hotplug handler for interface 'm_tun_tcp', event 'ifdown'
daemon.notice netifd: Interface 'm_tun_tcp' is now down
daemon.err netifd[1006]: interface_queue_event(124): Queue hotplug handler for interface 'm_tun_tcp', event 'ifdown'
daemon.err netifd[1006]: device_release(731): Release Network device mTunTcp, new active count: 0
daemon.notice netifd: Interface 'm_tun_tcp' is disabled
daemon.err netifd[1006]: device_remove_user(1113): Remove user for device 'mTunTcp', refcount=1
daemon.err netifd[1006]: task_complete(109): Complete hotplug handler for interface 'm_tun_udp'
daemon.err netifd[1006]: call_hotplug(100): Call hotplug handler for interface 'm_tun_tcp', event 'ifdown' (none)
daemon.err netifd[1006]: device_set_present(951): Network device 'mTunTcp' is now present
daemon.err netifd[1006]: interface_set_available(487): Interface 'm_tun_tcp', available=1
daemon.err netifd[1006]: device_claim(694): Claim Network device mTunTcp, new active count: 1
daemon.notice netifd: Network device 'mTunTcp' link is down
daemon.err netifd[1006]: device_claim(714): claim Network device mTunTcp failed: -1
daemon.notice netifd: Interface 'm_tun_tcp' has link connectivity loss
daemon.err netifd[1006]: task_complete(109): Complete hotplug handler for interface 'm_tun_tcp'

ip rule shows:

...
3:      from all iif mTunUdp lookup ino
4:      from all iif mTunTcp lookup ino
...

bad run:

daemon.err netifd[1006]: device_set_present(951): Network device 'mTunUdp' is now present
daemon.err netifd[1006]: interface_set_available(487): Interface 'm_tun_udp', available=1
daemon.err netifd[1006]: device_claim(694): Claim Network device mTunUdp, new active count: 1
daemon.notice netifd: Interface 'm_tun_udp' is enabled
daemon.notice netifd: Network device 'mTunUdp' link is up
daemon.notice netifd: Interface 'm_tun_udp' has link connectivity
daemon.notice netifd: Interface 'm_tun_udp' is setting up now
daemon.err netifd[1006]: __device_add_user(1037): Add user for device 'mTunUdp', refcount=2
daemon.err netifd[1006]: interface_queue_event(124): Queue hotplug handler for interface 'm_tun_udp', event 'ifup'
daemon.notice netifd: Interface 'm_tun_udp' is now up
daemon.err netifd[1006]: call_hotplug(100): Call hotplug handler for interface 'm_tun_udp', event 'ifup' (mTunUdp)
daemon.notice netifd: Network device 'mTunTcp' link is up
daemon.notice netifd: Interface 'm_tun_tcp' has link connectivity
daemon.err netifd[1006]: task_complete(109): Complete hotplug handler for interface 'm_tun_udp'

as a result configured routes not get applied for mTunTcp

ip rule shows:

...
3:      from all iif mTunUdp lookup ino
...

I have this issue only restarting openvpn manually, after reboot all is configured correctly.

/etc/config/network:

config interface 'm_tun_tcp'
        option device 'mTunTcp'
        option proto 'none'
        option auto '1'

config interface 'm_tun_udp'
        option device 'mTunUdp'
        option proto 'none'
        option auto '1'

config rule
        option in 'm_tun_tcp'
        option lookup 'ino'

config rule
        option in 'm_tun_udp'
        option lookup 'ino'

/etc/config/openvpn:

config openvpn m_tun_tcp
	option enabled 1
	option config /etc/openvpn/server/m-tun-tcp.conf

config openvpn m_tun_udp
	option enabled 1
	option config /etc/openvpn/server/m-tun-udp.conf

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure with the two interfaces in /etc/config/network and the matching /etc/config/openvpn entries, using service openvpn restart and checking ip rule. Start by tracing netifd's device and hotplug event handling shown in the logs; done means both m_tun_tcp and m_tun_udp are fully configured and both routing rules are applied consistently after restart.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.