Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

siproxd: l3_device only set when interface up problem #860

Open
noguxx opened this issue Apr 11, 2024 · 2 comments
Open

siproxd: l3_device only set when interface up problem #860

noguxx opened this issue Apr 11, 2024 · 2 comments

Comments

@noguxx
Copy link

noguxx commented Apr 11, 2024

network_get_device $1 $2 || network_get_physdev $1 $2

For interfaces with physical devices like eth0, eth1... the layer 2 device is set even if the interface is down, but for the rest to have a l3_device set, the interface needs to be up.
I don't know if this is always true, but perhaps when interface fails layer 2, then the interface name is equal to l3_device.

Where is : network_get_device $1 $2 || network_get_physdev $1 $2
Suggest 1: network_get_physdev $1 $2 || eval $1=$2
Suggest 2 (wait interface up): network_get_physdev $1 $2 || for i in $(seq 1 10); do network_flush_cache; network_get_device $1 $2 && break || ([ $i -eq 10 ] && eval $1=$2 || sleep 2); done

This could be a possible fix for #855

Notify maintainer: @guidosarducci

@guidosarducci
Copy link
Contributor

To help investigate anything, could you describe the specific problem you encounter running siproxd. That includes details like those below.

  • the behaviour you see and what goes wrong
  • your use case and a simple means of reproducing
  • details of your siproxd and relevant network configuration
  • debug logs covering at least all siproxd and networking
  • what's seen in run-time config files e.g. /var/etc/siproxd/siproxd-general.conf

Knowing these details will help determine a long-term general solution and avoid throw-away kludges.

@noguxx
Copy link
Author

noguxx commented Apr 15, 2024

My setup is a pogo-e02 with a lan and a wg_wan interface, all internet traffic going through the wireguard.

# ip r
default dev wg_wan proto static scope link
...

siproxd config:

# uci show siproxd
siproxd.general=siproxd
siproxd.general.interface_inbound='lan'
siproxd.general.interface_outbound='wg_wan'

Because the siproxd init start before the wireguard is up, there will be no l3_device, and as a consequence no if_outbound = wg_wan directive in /var/etc/siproxd/siproxd-general.conf :

Mon Apr 15 08:53:08 2024 daemon.notice netifd: Interface 'lan' is enabled
Mon Apr 15 08:53:08 2024 daemon.notice netifd: Interface 'lan' is setting up now
Mon Apr 15 08:53:08 2024 daemon.notice netifd: Interface 'lan' is now up
Mon Apr 15 08:53:08 2024 daemon.notice netifd: Interface 'loopback' is enabled
Mon Apr 15 08:53:08 2024 daemon.notice netifd: Interface 'loopback' is setting up now
Mon Apr 15 08:53:08 2024 daemon.notice netifd: Interface 'loopback' is now up
Mon Apr 15 08:53:08 2024 daemon.notice netifd: Interface 'wg_wan' is setting up now
Mon Apr 15 08:53:08 2024 daemon.notice netifd: Network device 'lo' link is up
Mon Apr 15 08:53:08 2024 daemon.notice netifd: Interface 'loopback' has link connectivity
Mon Apr 15 08:53:09 2024 daemon.notice netifd: Interface 'wg_wan' is now up
Mon Apr 15 08:53:09 2024 daemon.notice netifd: Network device 'wg_wan' link is up
Mon Apr 15 08:53:09 2024 user.notice firewall: Reloading firewall due to ifup of lan (eth0)
Mon Apr 15 08:53:09 2024 daemon.notice siproxd[1]: siproxd.c:241 INFO:siproxd-0.8.4dev-none 2024-04-03T19:32:55 arm-openwrt-linux-gnu starting up
Mon Apr 15 08:53:09 2024 daemon.notice siproxd[1]: rtpproxy_relay.c:119 INFO:Current thread stacksize is 128 kB
Mon Apr 15 08:53:09 2024 daemon.notice siproxd[1]: sock.c:139 INFO:bound to port 5060
Mon Apr 15 08:53:09 2024 daemon.notice siproxd[1]: register.c:119 WARNING:registration file may be corrupt or URLMAP_SIZE has been resized
Mon Apr 15 08:53:09 2024 daemon.notice siproxd[1]: siproxd.c:351 INFO:siproxd-0.8.4dev-none 2024-04-03T19:32:55 arm-openwrt-linux-gnu started
Mon Apr 15 08:53:10 2024 daemon.notice netifd: Network device 'eth0' link is up
Mon Apr 15 08:53:10 2024 daemon.notice netifd: Interface 'lan' has link connectivity
Mon Apr 15 08:53:10 2024 daemon.notice netifd: Interface 'wg_wan' has lost the connection
Mon Apr 15 08:53:10 2024 kern.info kernel: [ 26.538510] mv643xx_eth_port mv643xx_eth_port.0 eth0: link up, 1000 Mb/s, full duplex, flow control enabled
Mon Apr 15 08:53:10 2024 daemon.notice netifd: Network device 'wg_wan' link is down
Mon Apr 15 08:53:10 2024 daemon.notice netifd: Interface 'wg_wan' is now down
Mon Apr 15 08:53:10 2024 daemon.notice netifd: Interface 'wg_wan' is setting up now
Mon Apr 15 08:53:11 2024 daemon.notice netifd: Interface 'wg_wan' is now up
Mon Apr 15 08:53:11 2024 daemon.notice netifd: Network device 'wg_wan' link is up
Mon Apr 15 08:53:11 2024 user.notice ucitrack: Setting up /etc/config/dhcp reload dependency on /etc/config/network
Mon Apr 15 08:53:11 2024 user.notice ucitrack: Setting up /etc/config/network reload dependency on /etc/config/wireless
Mon Apr 15 08:53:12 2024 user.notice ucitrack: Setting up /etc/config/luci-splash reload dependency on /etc/config/firewall
Mon Apr 15 08:53:12 2024 user.notice ucitrack: Setting up /etc/config/qos reload dependency on /etc/config/firewall
Mon Apr 15 08:53:12 2024 user.notice ucitrack: Setting up /etc/config/miniupnpd reload dependency on /etc/config/firewall
Mon Apr 15 08:53:12 2024 user.notice ucitrack: Setting up /etc/config/odhcpd reload dependency on /etc/config/dhcp
Mon Apr 15 08:53:13 2024 user.notice ucitrack: Setting up non-init /etc/config/fstab reload handler: /sbin/block mount
Mon Apr 15 08:53:13 2024 user.notice ucitrack: Setting up /etc/config/system reload trigger for non-procd /etc/init.d/led
Mon Apr 15 08:53:13 2024 user.notice ucitrack: Setting up /etc/config/luci_statistics reload dependency on /etc/config/system
Mon Apr 15 08:53:13 2024 user.notice ucitrack: Setting up /etc/config/dhcp reload dependency on /etc/config/system
Mon Apr 15 08:53:13 2024 user.notice firewall: Reloading firewall due to ifup of wg_wan (wg_wan)
...
Mon Apr 15 08:54:57 2024 daemon.err siproxd[1]: utils.c:401 ERROR:Don't know what interface to look for - configuration error?

My opinion is siproxd init should take care the set options interface_inbound and interface_outbound interfaces exist and are enabled, and log as errors if don't exist or disabled and prevent siproxd from starting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants