openwrt / openwrt/netifd

Interface routing table setting seems to override static route's table setting

Open
#44 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
37
Forks
62
PR merge metrics
No merged PRs in 30d

Description

I encountered this seemingly unintended behavior since at least 23.05.

For this /etc/config/network:

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

config globals 'globals'
        option ula_prefix 'fdaf:6aa0:d0fa::/48'
        option packet_steering '2'
        option steering_flows '128'

config device
        option name 'br-lan'
        option type 'bridge'
        list ports 'eth0'

config interface 'lan'
        option device 'br-lan.10'
        option proto 'static'
        option ipaddr '192.168.127.1'
        option netmask '255.255.255.0'
        option ip6assign '60'

config bridge-vlan
        option device 'br-lan'
        option vlan '1'
        list ports 'eth0:t'

config bridge-vlan
        option device 'br-lan'
        option vlan '10'
        list ports 'eth0:u*'

config interface 'wan'
        option proto 'dhcp'
        option device 'br-lan.1'
        option delegate '0'

config interface 'wan6'
        option proto 'dhcpv6'
        option device 'br-lan.1'
        option reqaddress 'try'
        option reqprefix 'auto'
        option peerdns '0'
        option delegate '0'

config interface 'wg_tyo1'
        option proto 'wireguard'
        option private_key 'redacted'
        option delegate '0'
        option fwmark '0x7'
        option metric '75'
        list addresses '10.0.0.2/24'
        option nohostroute '1'
        option ip4table 'wg_tyo1'
        option ip6table 'wg_tyo1'

If I add:

config route
        option interface 'wan'
        option target '10.1.0.0/24'
        option table 'wg_tyo1'

ip monitor route would show 10.1.0.0/24 dev br-lan.1 table wg_tyo1 proto static scope link, which is intended.

But if I add:

config route
        option interface 'wg_tyo1'
        option target '10.1.0.0/24'
        option table 'main'

ip monitor route would show 10.1.0.0/24 dev wg_tyo1 table wg_tyo1 proto static scope link metric 75, which is unintended.

As you can see, the second route's table setting is ignored. It seems to be overridden by option ip4table 'wg_tyo1'.

According to https://openwrt.org/docs/guide-user/network/routing/routes_configuration, the table option should take effect independently. Potential bug?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the two route configurations from the issue and compare the results with ip monitor route. Investigate how netifd handles an interface's ip4table alongside a route's explicit table setting. Done means the explicit route table is honored independently, with regression coverage added if the repository's existing tests support it.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.