OpenWrt/LEDE Project

  • Status Unconfirmed
  • Percent Complete
    0%
  • Task Type Bug Report
  • Category Other
  • Assigned To No-one
  • Operating System All
  • Severity High
  • Priority Very Low
  • Reported Version All
  • Due in Version Undecided
  • Due Date Undecided
  • Private
Attached to Project: OpenWrt/LEDE Project
Opened by Kai Song - 08.06.2018

FS#1581 - netifd:Failed to bring up static 6rd tunnel after we modify 6rd tunnel from dynamic type to static

Supply the following if possible:
- Device problem occurs on
- Software versions of OpenWrt/LEDE release, packages, etc.

netifd-0f96606b7040b8e14190ff055d5761744bc15f6d

- Steps to reproduce

Step 1: Create a DHCPv4 + dynamic 6rd wan connection. Below is the /etc/config/network. wan and wan6 go up after “/etc/init.d/network reload”

[CXNK00123457] /lib/netifd/proto # cat /etc/config/network 

config interface 'loopback'
	option ifname 'lo'
	option proto 'static'
	option ipaddr '127.0.0.1'
	option netmask '255.0.0.0'

config globals 'globals'
	option ula_prefix 'auto'

config interface 'lan'
	option ifname 'eth0'
	option type 'bridge'
	option proto 'static'
	option ipaddr '192.168.1.1'
	option netmask '255.255.255.0'
	option ip6assign '64'

config interface 'pvtlan'
	option proto 'static'
	option ipaddr '169.254.1.1'
	option netmask '255.255.255.0'

config interface 'wan'
	option ifname 'eth1'
	option proto 'dhcp'
	option peerdns '1'
	option defaultroute '1'
	option vendorid '844Ei.ONT.dslforum.org'
	option reqopts '43 120 121'
	option iface6rd 'wan6'

Step 2: Edit /etc/config/network file, disable dynamic 6rd and provision a static one

[CXNK00123457] /etc/config # cat network.static6rd 

config interface 'loopback'
	option ifname 'lo'
	option proto 'static'
	option ipaddr '127.0.0.1'
	option netmask '255.0.0.0'

config globals 'globals'
	option ula_prefix 'auto'

config interface 'lan'
	option ifname 'eth0'
	option type 'bridge'
	option proto 'static'
	option ipaddr '192.168.1.1'
	option netmask '255.255.255.0'
	option ip6assign '64'

config interface 'pvtlan'
	option proto 'static'
	option ipaddr '169.254.1.1'
	option netmask '255.255.255.0'

config interface 'wan'
	option ifname 'eth1'
	option proto 'dhcp'
	option peerdns '1'
	option defaultroute '1'
	option vendorid '844Ei.ONT.dslforum.org'
	option reqopts '43 120 121'

config interface 'wan6'
	option ifname 'eth1'
	option proto '6rd'
	option peerdns '0'
	option defaultroute '1'
	list dns '2001:db8:1::a'
	list dns '2001:db8:1::b'
	option tunlink 'wan'
	option peeraddr '10.101.1.1'
	option ip6prefix '2602::'
	option ip6prefixlen '32'
	option ip4prefixlen '24'

Step 3: Run “/etc/init.d/network reload”. However, netifd failed to bring up the static 6rd tunnel wan6.

Here is the log of netifd from /var/log/messages. From the log, it seems that netifd was trying to bring up wan6 before wan (DHCPv4) went up. See “netifd: Interface ‘wan6’ is setting up now”. Does this matter?

[CXNK00123457] /etc/config # /etc/init.d/network reload 
Wed Jun  6 06:26:25 2018 daemon.notice netifd: Interface 'wan6' has lost the connection
Wed Jun  6 06:26:25 2018 daemon.warn dnsmasq[19262]: no servers found in /tmp/resolv.conf.auto, will retry
Wed Jun  6 06:26:25 2018 daemon.notice netifd: tunnel '6rd-wan6' link is down
Wed Jun  6 06:26:26 2018 daemon.notice netifd: Interface 'wan6' is now down
Wed Jun  6 06:26:26 2018 daemon.notice netifd: Interface 'wan6' is setting up now
Wed Jun  6 06:26:26 2018 daemon.notice netifd: wan (2641): Received SIGTERM
Wed Jun  6 06:26:26 2018 daemon.notice netifd: Interface 'wan' is now down
Wed Jun  6 06:26:26 2018 daemon.notice netifd: Interface 'wan' is disabled
Wed Jun  6 06:26:26 2018 daemon.notice netifd: Interface 'wan' has link connectivity loss
Wed Jun  6 06:26:26 2018 kern.info kernel: [119305.628866] 8021q: adding VLAN 0 to HW filter on device eth1
Wed Jun  6 06:26:26 2018 kern.info kernel: [119305.630319] IPv6: ADDRCONF(NETDEV_UP): eth1: link is not ready
Wed Jun  6 06:26:26 2018 daemon.notice netifd: Interface 'wan' is enabled
Wed Jun  6 06:26:27 2018 daemon.notice netifd: Interface 'wan6' is now down
Wed Jun  6 06:26:28 2018 daemon.notice netifd: Network device 'eth1' link is up
Wed Jun  6 06:26:28 2018 daemon.notice netifd: Interface 'wan' has link connectivity 
Wed Jun  6 06:26:28 2018 daemon.notice netifd: Interface 'wan' is setting up now
Wed Jun  6 06:26:28 2018 kern.info kernel: [119307.631409] e1000: eth1 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX
Wed Jun  6 06:26:28 2018 kern.info kernel: [119307.632184] IPv6: ADDRCONF(NETDEV_CHANGE): eth1: link becomes ready
Wed Jun  6 06:26:29 2018 daemon.notice netifd: wan (3351): udhcpc (v1.23.2) started
=========== interface wan disconnected ===========
Wed Jun  6 06:26:30 2018 daemon.notice netifd: wan (3351): Sending discover...
Wed Jun  6 06:26:31 2018 daemon.notice netifd: wan (3351): Sending select for 10.101.1.100...
Wed Jun  6 06:26:31 2018 daemon.notice netifd: wan (3351): Lease of 10.101.1.100 obtained, lease time 503
Wed Jun  6 06:26:31 2018 daemon.notice netifd: Interface 'wan' is now up
Wed Jun  6 06:26:31 2018 daemon.info dnsmasq[19262]: reading /tmp/resolv.conf.auto
Wed Jun  6 06:26:31 2018 daemon.info dnsmasq[19262]: using local addresses only for domain lan
Wed Jun  6 06:26:31 2018 daemon.info dnsmasq[19262]: using nameserver 10.101.0.1#53
=========== interface wan connected ===========
Wed Jun  6 06:26:31 2018 daemon.notice netifd: wan (3351): rgcommon>sys update-interface-status wan
Wed Jun  6 06:26:32 2018 user.notice firewall: Reloading firewall due to ifup of wan (eth1)

Kai Song commented on 08.06.2018 10:10

We're able to reproduce this issue every time if the test case is executed in this order.
Please spend some time to take a look at this issue. Thanks.

Kai Song commented on 30.07.2018 02:27

Hi, Hans Dedecker,

I see you've closed  FS#1687  as "Duplicate" of this one. Can you please take a look at this issue? Thanks.

Project Manager
Hans Dedecker commented on 30.07.2018 07:28

Hi

I already noticed there's some eagerness from your side to get this fixed; you have to understand most developers work on voluntary base on the project in their free time. So there're no promises when the issue will be fixed; another option is to propose a patch if the issue is really blocking you.

Kai Song commented on 30.07.2018 09:30

Hi Hans,

Thanks for your reply. I fully understand. I'll start working on this one and try to work out a solution.

Kai Song commented on 20.09.2018 09:55

I've nailed down the root cause of this issue. It is a bug of timing sequence.

Suppose we are going to provision

  • DHCPv4 wan
  • static 6rd wan6

The netifd will check the the state of wan before it brings up wan6. But in this scenario, this movement happened before wan was up.
For detail, see attachment "DHCPv4 wan + Static 6rd wan6 Sequence (1).png"

Kai Song commented on 20.09.2018 10:03

Hi Hans,

I suggest to make a change to file /lib/netifd/proto/6rd.sh.
To add 10 seconds delay in "proto_6rd_setup()" before "proto_add_host_dependency "
See "sleep 10" below. The 10 seconds is based on my test results.

Let me know your comments. Thanks.

Part of 6rd.sh.

......
proto_6rd_setup() {
        local cfg="$1"
        local iface="$2"
        local link="6rd-$cfg"

        local mtu df ttl tos ipaddr peeraddr ip6prefix ip6prefixlen ip4prefixlen tunlink zone
        json_get_vars mtu df ttl tos ipaddr peeraddr ip6prefix ip6prefixlen ip4prefixlen tunlink zone

        [ -z "$ip6prefix" -o -z "$peeraddr" ] && {
                proto_notify_error "$cfg" "MISSING_ADDRESS"
                proto_block_restart "$cfg"
                return
        }

        // FIXME to handle address race for DHCP and static 6rd
        sleep 10

        ( proto_add_host_dependency "$cfg" "$peeraddr" "$tunlink" )

        [ -z "$ipaddr" ] && {
                local wanif="$tunlink"
                if [ -z $wanif ] && ! network_find_wan wanif; then
                        proto_notify_error "$cfg" "NO_WAN_LINK"
                        echo "proto_6rd_setup(): error return 1 " >> /tmp/6rd.tmp
                        return
                fi

......

Loading...

Available keyboard shortcuts

Tasklist

Task Details

Task Editing