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

startup trouble due to missing interfaces #19

Open
pedro-nonfree opened this issue Jul 9, 2018 · 14 comments
Open

startup trouble due to missing interfaces #19

pedro-nonfree opened this issue Jul 9, 2018 · 14 comments

Comments

@pedro-nonfree
Copy link

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
Copy link
Member

aparcar commented Jul 10, 2018

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

@pedro-nonfree
Copy link
Author

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
Copy link
Member

aparcar commented Jul 10, 2018

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

@dyangol
Copy link

dyangol commented Jul 10, 2018

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 aparcar changed the title where is /etc/init.d/bmx6 ? startup trouble due to missing interfaces Jul 11, 2018
@aparcar
Copy link
Member

aparcar commented Jul 11, 2018

@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

aparcar/packages-1@9c0e733

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

@aparcar
Copy link
Member

aparcar commented Jul 11, 2018

@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?

aparcar/packages-1@9c0e733#diff-f0406929ccdf40437e581b6196d5ab1cR19

@dyangol
Copy link

dyangol commented Jul 11, 2018

@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
Copy link

dyangol commented Jul 11, 2018

@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
Copy link
Member

aparcar commented Jul 11, 2018

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
Copy link

dyangol commented Jul 11, 2018

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
Copy link
Member

aparcar commented Jul 15, 2018

@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
Copy link

dyangol commented Jul 16, 2018

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
Copy link
Member

aparcar commented Jul 18, 2018

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

@axn
Copy link
Member

axn commented Aug 14, 2018 via email

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

4 participants