Skip to content

netifd: changing metric, ip4table or defaultroute flushes babeld's routes from the main table

Username: Mikma

Origin: https://bugs.openwrt.org/index.php?do=details&task_id=2464

Tested device: Virtual x86_64

Software versions:

openwrt 18.06.4

netifd 2019-01-31-a2aba5c7-2.1

Reproduce:

  • Use babeld as dynamic routing daemon.

  • Verify that the main table contains routes inserted by babeld.

  • Change one of metric, ip4table and defaultroute on a interface which have babeld’s routes in the main table.

  • Run /etc/init.d/network reload

  • The routes inserted by babeld for the above interface are now gone, which was unexpected.

It seems to be caused by the following section in interface.c:

UPDATE(metric, reload_ip); UPDATE(proto_ip.no_defaultroute, reload_ip); UPDATE(ip4table, reload_ip); UPDATE(ip6table, reload_ip); ... if (reload_ip) { bool config_ip_enabled = if_old->config_ip.enabled; bool proto_ip_enabled = if_old->proto_ip.enabled;

            interface_ip_set_enabled(&if_old->config_ip, false);
            interface_ip_set_enabled(&if_old->proto_ip, false);
            interface_ip_set_enabled(&if_old->proto_ip, proto_ip_enabled);
            interface_ip_set_enabled(&if_old->config_ip, config_ip_enabled);
    }