bmx-routing / bmx6

BMX6 Mesh Networking Protocol
http://bmx6.net
56 stars 26 forks source link

startup trouble due to missing interfaces #19

Open pedro-nonfree opened 6 years ago

pedro-nonfree commented 6 years ago

At the moment I'm newbie with this, but we had race conditions issues during boot because of /etc/init.d/bmx6 file

question: what do you think about this issue => https://gitlab.com/guifi-exo/temba/issues/18

we are going to patch on temba "firmware", but probably this is useful for bmx6 in general (so should we patch it to upstream? where is it?)

Thanks for reading

aparcar commented 6 years ago

Check put openwrt-routing/packages here on github. It stores all OpenWrt specific files for bmx6

pedro-nonfree commented 6 years ago

Thanks!

https://github.com/openwrt-routing/packages/blob/master/bmx6/files/etc/init.d/bmx6

https://github.com/openwrt-routing/packages/blob/master/bmx7/files/etc/init.d/bmx7

@aparcar @axn and what do you think to change from START=91 to START=99 in that files? Is enough having the discussion here?

aparcar commented 6 years ago

Are you sure that solves the issue. Checking the gitlab issue a few more logs could help. What is blocking?

dyangol commented 6 years ago

Hi @aparcar,

really we're not sure if this solves the issue. The performed tests suggest bmx6 needs to be start later almost in LEDE 17.01.4. If we delay it in someway (START=99, including sleep 8 in /etc/init.d/bmx6 or both of them) tunnels are set up. If we start bmx6 without these modifications the tunnels are not set up.

Can you confirm this issue in a fresh LEDE/OpenWRT?

aparcar commented 6 years ago

@pedro-nonfree @dyangol hi, thanks for the clarification

I patched and cleaned the inti script so that it looks for interface changes and reloads bmx automatically, please test this (untested) version here

https://github.com/aparcar/packages-1/commit/9c0e733af12a553be53bd8a296c83b6771b0893f

If it works I'll create a PR to merge it upstream

aparcar commented 6 years ago

@dangowrt @axn can you explain the magic of this part? It looks a bit hacky and could be replaced by the procd triggers, can't it?

https://github.com/aparcar/packages-1/commit/9c0e733af12a553be53bd8a296c83b6771b0893f#diff-f0406929ccdf40437e581b6196d5ab1cR19

dyangol commented 6 years ago

@aparcar I've just tried your commited /etc/init.d/bmx6 in a Nanostation M5 (17.01.4) and it does not work for me. My specific network configuration /etc/config/network:

config interface 'loopback'                                                                                                                                                [10/1873]
        option ifname 'lo' 
        option proto 'static'        
        option ipaddr '127.0.0.1'         
        option netmask '255.0.0.0'  

config globals 'globals'       

config interface 'lan'              
        option type 'bridge'    
        option ifname 'eth0.1'
        option proto 'static'
        option ipaddr '10.1.71.161'
        option netmask '255.255.255.224'
        option ip6assign '64'

config interface 'wan'
        option ifname 'eth0.2'
        option proto 'dhcp'

config interface 'wan6'
        option ifname 'eth0.2'
        option proto 'dhcpv6'

config interface 'iaac'
        option ifname 'eth0.3'
        option proto 'dhcp'

config switch
        option name 'switch0'
        option reset '1'
        option enable_vlan '1'

config switch_vlan
        option device 'switch0'
        option vlan '1'
        option ports '5t 0t'

config switch_vlan
        option device 'switch0'
        option vlan '2'
        option ports '1 0t'

config switch_vlan
        option device 'switch0'
        option vlan '3'
        option ports '5t 0t'

config device 'wif0_t'
        option type '8021q'
        option name 'wif0_t'
        option ifname '@wif0'
        option vid '12'

config interface 'wif0'
        option proto 'none'
        option mtu '1500'

config interface 'mesh'
        option ifname 'wif0_t'
        option auto '1'
dyangol commented 6 years ago

@aparcar apparently bmx6 try to start on an interface name wif0_t that is futher created. When it is finally created bmx6 does not retry. I append this logread sample:

Wed Jul 11 10:46:19 2018 daemon.notice netifd: Network device 'wlan0' link is up
Wed Jul 11 10:46:19 2018 daemon.notice netifd: Interface 'wif0' is enabled
Wed Jul 11 10:46:19 2018 daemon.notice netifd: Interface 'wif0' has link connectivity
Wed Jul 11 10:46:19 2018 daemon.notice netifd: Interface 'wif0' is setting up now
Wed Jul 11 10:46:20 2018 daemon.notice netifd: Interface 'mesh' is enabled
Wed Jul 11 10:46:20 2018 daemon.notice netifd: Network alias 'wlan0' link is up
Wed Jul 11 10:46:20 2018 daemon.notice netifd: Interface 'wif0' is now up
Wed Jul 11 10:46:20 2018 daemon.notice netifd: 8021q 'wif0_t' link is up
Wed Jul 11 10:46:20 2018 daemon.info bmx6[766]: [766     5390] INFO  dev_if_fix: Autoconfiguring dev=wif0_t idx=10 ip=fd66:66:66:a:822a:a8ff:fee4:be35/64
Wed Jul 11 10:46:20 2018 daemon.notice netifd: Interface 'mesh' has link connectivity
Wed Jul 11 10:46:20 2018 daemon.notice netifd: Interface 'mesh' is setting up now
Wed Jul 11 10:46:20 2018 daemon.notice netifd: Interface 'mesh' is now up
Wed Jul 11 10:46:20 2018 daemon.notice procd: /etc/rc.d/S99bird4: bird4 Daemon Start Status: [ STARTED ]
Wed Jul 11 10:46:20 2018 daemon.info bmx6[766]: [766     5828] ERROR dev_init_sockets: can't bind unicast socket to IP=fe80::822a:a8ff:fee4:be35 : Address not available (retrying l
ater...)
Wed Jul 11 10:46:20 2018 daemon.info bmx6[766]: [766     5828] ERROR dev_activate: error intitializing dev=wif0_t
Wed Jul 11 10:46:20 2018 daemon.info bmx6[766]: [766     5828] WARN  dev_deactivate: deactivating dev=wif0_t llocal=:: global=
Wed Jul 11 10:46:20 2018 daemon.info bmx6[766]: [766     5828] ERROR dev_deactivate: no address given to remove in dev_ip_tree!
Wed Jul 11 10:46:20 2018 daemon.info procd: - init complete -
Wed Jul 11 10:46:20 2018 user.notice firewall: Reloading firewall due to ifup of wif0 (wlan0)
Wed Jul 11 10:46:21 2018 daemon.info odhcpd[675]: Raising SIGUSR1 due to address change on wif0_t
Wed Jul 11 10:46:21 2018 daemon.notice netifd: wan (983): udhcpc: sending discover
Wed Jul 11 10:46:21 2018 user.notice firewall: Reloading firewall due to ifup of mesh (wif0_t)
Wed Jul 11 10:46:21 2018 daemon.info bmx6[766]: [766     7321] INFO  check_proc_sys_net: changing /proc/sys/net/ipv4/conf/all/rp_filter from 0 to 2
Wed Jul 11 10:46:21 2018 daemon.info bmx6[766]: [766     7321] INFO  check_proc_sys_net: changing /proc/sys/net/ipv4/conf/default/rp_filter from 0 to 2
Wed Jul 11 10:46:21 2018 daemon.info bmx6[766]: [766     7321] INFO  check_proc_sys_net: changing /proc/sys/net/ipv4/conf/all/send_redirects from 1 to 0
Wed Jul 11 10:46:21 2018 daemon.info bmx6[766]: [766     7321] INFO  check_proc_sys_net: changing /proc/sys/net/ipv4/conf/default/send_redirects from 1 to 0
Wed Jul 11 10:46:22 2018 user.notice dnsmasq: found already running DHCP-server on interface 'br-lan' refusing to start, use 'option force 1' to override
aparcar commented 6 years ago

Please show the contents of /etc/config/bmx6. The idea of the interface triggers is that automatically reloads once one of the "to be used" interfaces changes it state. Therefore it should work even if wif0_t appears late...

dyangol commented 6 years ago

This is the content of my /etc/config/bmx6:

config bmx6 'general'
        option dbgMuteTimeout '1000000'
        option tunOutTimeout '100000'
        option configSync '0'
        option syslog '0'

config plugin 'bmx6_config_plugin'
        option plugin 'bmx6_config.so'

config plugin 'bmx6_json_plugin'
        option plugin 'bmx6_json.so'

config plugin 'bmx6_sms_plugin'
        option plugin 'bmx6_sms.so'

config plugin 'bmx6_table_plugin'
        option plugin 'bmx6_table.so'

config ipVersion 'ipVersion'
        option ipVersion '6'

config dev 'mesh_1'
        option dev 'wif0_t'
        option linklayer '2'

config tunDev 'main'
        option tunDev 'main'
        option tun4Address '10.1.71.161/27'
#       option tun6Address 'fde4:cf9e:40f9::1/64'

config tunOut 'inet6'
        option tunOut 'inet6'
        option network '::/0'
        option maxPrefixLen '0'

config tunOut 'inner_zone'
        option tunOut 'inner_zone'
        option network '10.0.0.0/8'
aparcar commented 6 years ago

@dyangol could you change this line from reload to restart? I'm not sure if bmx accepts new interfaces via a reload. If that doesn't help neither I'll get in contact with @axn to fix the problem

dyangol commented 6 years ago

No luck :-( I've applied the suggested modification in /etc/init.d/bmx6, in the last line:

dev_trigger() {
    local cfg="$1"
    config_get dev "$cfg" dev
    procd_add_interface_trigger "interface.*" ${dev} "/etc/init.d/$NAME" restart
aparcar commented 6 years ago

@dangowrt can you please have a look at the trigger part of the init script?

axn commented 6 years ago

In general, Bmx accepts new interfaces via reload. Used many times

Am 15. Juli 2018 07:38:26 MESZ schrieb Paul Spooren notifications@github.com:

@dyangol could you change this line from reload to restart? I'm not sure if bmx accepts new interfaces via a reload. If that doesn't help neither I'll get in contact with @axn to fix the problem

-- You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub: https://github.com/bmx-routing/bmx6/issues/19#issuecomment-405068773

-- Diese Nachricht wurde von meinem Android-Gerät mit K-9 Mail gesendet.