Skip to content

generic: several fixes and improvement for DSA - #2942

Closed
dengqf6 wants to merge 4 commits into
openwrt:masterfrom
dengqf6:dsa-fix
Closed

dengqf6 wants to merge 4 commits into
openwrt:masterfrom
dengqf6:dsa-fix

Conversation

@dengqf6

@dengqf6 dengqf6 commented Apr 20, 2020 •

Copy link
Copy Markdown

While testing DSA driver in #2798, some users (including myself) found some issues related to DSA, so this pull request is to address those issues.

Fixed:

  • mt7530/mv88e6xxx: traffics are blocked when enabling vlan filtering
  • mt7530: client roaming
  • mt7530: ethernet link drop issue (hopefully)

@dengqf6

dengqf6 commented Apr 20, 2020

Copy link
Copy Markdown
Author

ping @blogic @vDorst @ptpt52 @lunn

@vDorst vDorst left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure if this patch helps.

It seems that by default mt7530 EEE is disabled.

Ethtool output on my PC.

#ethtool --show-eee enp3s0
EEE Settings for enp3s0:
	EEE status: enabled - inactive
	Tx LPI: disabled
	Supported EEE link modes:  100baseT/Full 
	                           1000baseT/Full 
	Advertised EEE link modes:  100baseT/Full 
	                            1000baseT/Full 
	Link partner advertised EEE link modes:  Not reported

I have a WIP patch vDorst/linux-1@9cfb2d4 that you can enable EEE if you want with ethtool.

On the OpenWRT device.

ethtool --set-eee lan0 eee on

Ethtool output on my PC.

EEE Settings for enp3s0:
	EEE status: enabled - active
	Tx LPI: disabled
	Supported EEE link modes:  100baseT/Full 
	                           1000baseT/Full 
	Advertised EEE link modes:  100baseT/Full 
	                            1000baseT/Full 
	Link partner advertised EEE link modes:  100baseT/Full 
	                                         1000baseT/Full 

@ptpt52

ptpt52 commented Apr 21, 2020 •

Copy link
Copy Markdown
Contributor

@981213 981213 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi!
Some comments below:

@adschm adschm added the kernel pull request/issue with Linux kernel related changes label Apr 21, 2020
@vDorst

vDorst commented Apr 22, 2020

Copy link
Copy Markdown
Contributor

@vDorst
from some old code in raether.c
https://git.openwrt.org/?p=openwrt/svn-archive/archive.git;a=blob;f=target/linux/mediatek/patches/0063-arm-mediatek-add-SDK-ethernet.patch;h=7263bb21816b36733b561b749de589d4b010d718;hb=d8804dd309b0a1701c8ebe0a26d700745df24f11#l14002

for test in my case it works on connecting to 100Mbit port device( about the link down/up issue)

I am not happy about that we just disable EEE for all the devices.
If it is a hardware issue on the SOC side that I say that is fine.
But if it just a couple of devices I want reject this EEE patch.
With the old code there was no knob to enable or disable the EEE.
But with my patch vDorst/linux-1@9cfb2d4 you can disable EEE per port with ethtool.

So users with dodgy devices can turn it EEE off per port.
Adding section to the wiki about this issue and solution could help other users.

@dengqf6

dengqf6 commented Apr 25, 2020

Copy link
Copy Markdown
Author

Updated roaming patch

@981213 981213 added the blocked pull request blocked by/waiting for another change label May 1, 2020
@981213

981213 commented May 1, 2020 •

Copy link
Copy Markdown
Member

I'd like to wait for upstream response for mt7530 cpu port mac learning patch. Marked this PR as blocked for that.

@pmelange

Copy link
Copy Markdown
Contributor

I have built the freifunk firmware based on this branch (915c18dbec2bdd9de0a4ccdf93a4a59cb406131d) . At startup there is a kernel warning. But the system seems to be running fine.

[   39.687757] ------------[ cut here ]------------
[   39.696995] WARNING: CPU: 0 PID: 0 at net/bridge/br_switchdev.c:46 0x805343ec
[   39.711236] Modules linked in: iptable_nat batman_adv xt_state xt_nat xt_conntrack xt_REDIRECT xt_MASQUERADE xt_FLOWOFFLOAD xt_CT nf_nat nf_flow_table_hw nf_flow_table nf_conntrack_rtcache nf_conntrack ipt_REJECT cfg80211 xt_time xt_tcpudp xt_multiport xt_mark xt_mac xt_limit xt_comment xt_TCPMSS xt_LOG sfp nf_reject_ipv4 nf_log_ipv4 nf_defrag_ipv6 nf_defrag_ipv4 mdio_i2c libcrc32c iptable_mangle iptable_filter ip_tables hwmon compat i2c_algo_pca gpio_pca953x regmap_i2c i2c_dev ledtrig_heartbeat nf_log_ipv6 nf_log_common ip6table_mangle ip6table_filter ip6_tables ip6t_REJECT x_tables nf_reject_ipv6 ipip tunnel4 ip_tunnel leds_gpio gpio_button_hotplug crc32c_generic
[   39.828832] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.4.41 #0
[   39.840617] Stack : 00000000 807b0000 80630000 80075804 00000000 00000000 00000000 00000000
[   39.857251]         00000000 00000000 00000000 00000000 00000000 00000001 8fc0d988 815ce928
[   39.873869]         8fc0da20 00000000 00000000 00000000 00000038 805708a4 342e3520 2031342e
[   39.890489]         00000000 00000001 00000000 000ca5a0 00000000 8fc0d968 00000000 805343ec
[   39.907107]         00000009 80628394 80628bb8 00000000 00000002 803142c0 00000000 80780000
[   39.923721]         ...
[   39.928574] Call Trace:
[   39.928590] [<80075804>] 0x80075804
[   39.940358] [<805708a4>] 0x805708a4
[   39.947282] [<805343ec>] 0x805343ec
[   39.954206] [<803142c0>] 0x803142c0
[   39.961129] [<8000b0f8>] 0x8000b0f8
[   39.968054] [<8000b100>] 0x8000b100
[   39.974979] [<80557bdc>] 0x80557bdc
[   39.981902] [<80072414>] 0x80072414
[   39.988827] [<80027c54>] 0x80027c54
[   39.995752] [<805343ec>] 0x805343ec
[   40.002677] [<80027cfc>] 0x80027cfc
[   40.009632] [<805343ec>] 0x805343ec
[   40.016556] [<8006838c>] 0x8006838c
[   40.023485] [<80534b84>] 0x80534b84
[   40.030416] [<805347ec>] 0x805347ec
[   40.037339] [<803dc5c4>] 0x803dc5c4
[   40.044277] [<803dd000>] 0x803dd000
[   40.051207] [<803dd0fc>] 0x803dd0fc
[   40.058131] [<80546520>] 0x80546520
[   40.065054] [<8053000a>] 0x8053000a
[   40.071986] [<805342d0>] 0x805342d0
[   40.078915] [<80532684>] 0x80532684
[   40.085853] [<805344d8>] 0x805344d8
[   40.092779] [<800c30bc>] 0x800c30bc
[   40.099709] [<80534b84>] 0x80534b84
[   40.106632] [<800c693c>] 0x800c693c
[   40.113557] [<800c32ec>] 0x800c32ec
[   40.120489] [<805347ec>] 0x805347ec
[   40.127413] [<803dc5c4>] 0x803dc5c4
[   40.134353] [<803dd000>] 0x803dd000
[   40.141284] [<803dd0fc>] 0x803dd0fc
[   40.148217] [<80549e04>] 0x80549e04
[   40.155145] [<803dd01c>] 0x803dd01c
[   40.162078] [<803dd0fc>] 0x803dd0fc
[   40.169004] [<803de964>] 0x803de964
[   40.175930] [<80088d38>] 0x80088d38
[   40.182859] [<80390984>] 0x80390984
[   40.189783] [<8005546c>] 0x8005546c
[   40.196710] [<803de0d0>] 0x803de0d0
[   40.203637] [<80576cac>] 0x80576cac
[   40.210564] [<8002c348>] 0x8002c348
[   40.217489] [<802bd434>] 0x802bd434
[   40.224414] [<80006cc8>] 0x80006cc8
[   40.231335] 
[   40.235080] ---[ end trace cf1685885b944a7b ]---

One question though. With these changes, should I be setting up the VLANs differently than how I solved it as described here https://forum.openwrt.org/t/er-x-sfp-vlans-not-working-properly-with-kernel-5-4/60002/29?u=pmelange

@dengqf6

dengqf6 commented May 15, 2020

Copy link
Copy Markdown
Author

@pmelange
Why do you create 2 bridges? One bridge with VLAN filtering on is enough.

@pmelange

Copy link
Copy Markdown
Contributor

I have 3 bridges. One bridge with all the vlans and filtering enabled. From the bridge with all the vlans (spanning eth0, eth1, and eth2) I create multiple links, one for each vlan-id (vlan5, vlan10, vlan11, vlan12, vlan...). The other two brides are connecting a particular vlan and a raw eth port, for example vlan10 and eth3. eth3 is in the case like an access port.

How would you do it?

@dengqf6

dengqf6 commented May 15, 2020

Copy link
Copy Markdown
Author

@pmelange
You have set up way too many VLANs and my head aches when I try to read your configuration 😂
How would you configure your router if it was using swconfig?

@dengqf6

dengqf6 commented May 15, 2020

Copy link
Copy Markdown
Author

@pmelange Is your setup like this?

VID eth0 eth1 eth2 eth3 eth4 eth5 br-lan(CPU)
5 t t t   u u t
10 t t t u     t
11   t t       t
12   t t       t
50 t   t       t
201 t           t
202 t           t
203 t           t
204 t           t
205 t           t
206 t           t
211   t t       t
300   t t       t
400   t t       t
500   t t       t
501   t t       t
1000   t t       t

@pmelange

Copy link
Copy Markdown
Contributor

Yes, your table is quite accurate. And eth0, eth1, and eth2 are all connected to switches.

@dengqf6

dengqf6 commented May 15, 2020 •

Copy link
Copy Markdown
Author

@pmelange
Simplified setup:
/etc/hotplug.d/iface/21-lan (remember to add it to /etc/sysupgrade.conf or it will not be saved after sysupgrade!)

#!/bin/sh
[ $INTERFACE = lan -a $ACTION = ifup ] || exit 0

# enable VLAN filtering
ip link set dev br-lan type bridge vlan_filtering 1

# clear out vlan 1
bridge v del dev eth0 vid 1
bridge v del dev eth1 vid 1
bridge v del dev eth2 vid 1
bridge v del dev eth3 vid 1
bridge v del dev eth4 vid 1
bridge v del dev eth5 vid 1
bridge v del dev br-lan self vid 1

# set vlans eth0
bridge v add dev eth0 vid 5
bridge v add dev eth0 vid 10
bridge v add dev eth0 vid 50
bridge v add dev eth0 vid 201
bridge v add dev eth0 vid 202
bridge v add dev eth0 vid 203
bridge v add dev eth0 vid 204
bridge v add dev eth0 vid 205
bridge v add dev eth0 vid 206

# set vlans eth1
bridge v add dev eth1 vid 5
bridge v add dev eth1 vid 10
bridge v add dev eth1 vid 11
bridge v add dev eth1 vid 12
bridge v add dev eth1 vid 211
bridge v add dev eth1 vid 300
bridge v add dev eth1 vid 400
bridge v add dev eth1 vid 500
bridge v add dev eth1 vid 501
bridge v add dev eth1 vid 1000

# set vlans eth2
bridge v add dev eth2 vid 5
bridge v add dev eth2 vid 10
bridge v add dev eth2 vid 11
bridge v add dev eth2 vid 12
bridge v add dev eth2 vid 50
bridge v add dev eth2 vid 211
bridge v add dev eth2 vid 300
bridge v add dev eth2 vid 400
bridge v add dev eth2 vid 500
bridge v add dev eth2 vid 501
bridge v add dev eth2 vid 1000

# set vlans eth3
bridge v add dev eth3 vid 10 pvid untagged

# set vlans eth4
bridge v add dev eth4 vid 5 pvid untagged

# set vlans eth5
bridge v add dev eth5 vid 5 pvid untagged

# set vlans cpu port
bridge v add dev br-lan self vid 5 pvid untagged
bridge v add dev br-lan self vid 10
bridge v add dev br-lan self vid 201
bridge v add dev br-lan self vid 202
bridge v add dev br-lan self vid 203
bridge v add dev br-lan self vid 204
bridge v add dev br-lan self vid 205
bridge v add dev br-lan self vid 206
bridge v add dev br-lan self vid 211

/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 'AA:BB:CC::/60'

config interface 'lan'
	option type 'bridge'
	option ifname 'eth0 eth1 eth2 eth3 eth4 eth5'
	option proto 'static'
	option netmask '255.255.255.0'
	option delegate '0'
	option ipaddr '192.168.5.1'

config interface 'dhcp'
	option proto 'static'
	option netmask '255.255.255.0'
	option ip6assign '64'
	option ip6hint 'f'
	option ipaddr '10.0.0.1'
	option ifname '@lan.10'
	option dns '46.182.19.48 80.67.169.40 194.150.168.168 2001:910:800::12'

config interface 'north'
	option proto 'static'
	option ifname '@lan.201'
	option ipaddr '10.0.1.2011'
	option netmask '255.255.255.252'
	option ip6assign '64'
	option ip6hint '1'

config interface 'nano_vlan_202'
	option proto 'static'
	option ifname '@lan.202'
	option ipaddr '10.0.1.202'
	option netmask '255.255.255.255'
	option ip6assign '64'
	option ip6hint '2'

config interface 'ost'
	option proto 'static'
	option ifname '@lan.203'
	option ipaddr '10.0.1.233'
	option netmask '255.255.255.252'
	option ip6assign '64'
	option ip6hint '3'

config interface 'beuth'
	option proto 'static'
	option ifname '@lan.204'
	option ipaddr '10.0.1.237'
	option netmask '255.255.255.252'
	option ip6assign '64'
	option ip6hint '4'

config interface 'nano_vlan_205'
	option proto 'static'
	option ifname '@lan.205'
	option ipaddr '10.0.1.205'
	option netmask '255.255.255.255'
	option ip6assign '64'
	option ip6hint '5'

config interface 'nano_vlan_206'
	option proto 'static'
	option ifname '@lan.206'
	option ipaddr '10.0.1.206'
	option netmask '255.255.255.255'
	option ip6assign '64'
	option ip6hint '6'

config interface 'meshlan'
	option proto 'static'
	option ifname '@lan.211'
	option ipaddr '10.0.1.211'
	option netmask '255.255.255.255'
	option ip6assign '64'
	option ip6hint 'b'

@pmelange

Copy link
Copy Markdown
Contributor

@dengqf6 I have taken your example, modified it a little bit, and it works. The changes I made was to have an unmanaged bridge interface to put all the vlans in. I named it "switch" which makes far sense to me than "lan".

Also, just so that people reading this can understand, I don't have vlans 11, 12, 50, 300, 400, 500, 501, and 1000 on the cpu port, and the switching works fine. As long as the router itself is not doing anything more than switching on a particular vlan, than the cpu port can be left off.

There was no kernel warning this time.

I see you force-pushed some changes. Can you describe what is different now? Also, how about @vDorst's comment about disabling EEE?

@pmelange

Copy link
Copy Markdown
Contributor

Small update. Now that the system has been online for a bit, I have gotten an error in /proc/interrupts. Unfortunately there is nothing in dmesg about it.

root@router:~# cat /proc/interrupts
           CPU0       CPU1       CPU2       CPU3       
  8:    1095152    1095274    1095240    1095241  MIPS GIC Local   1  timer
  9:      53742          0          0          0  MIPS GIC  63  IPI call
 10:          0      11910          0          0  MIPS GIC  64  IPI call
 11:          0          0      57371          0  MIPS GIC  65  IPI call
 12:          0          0          0      13906  MIPS GIC  66  IPI call
 13:      54392          0          0          0  MIPS GIC  67  IPI resched
 14:          0     113075          0          0  MIPS GIC  68  IPI resched
 15:          0          0      68826          0  MIPS GIC  69  IPI resched
 16:          0          0          0      68834  MIPS GIC  70  IPI resched
 17:          0          0          0          0  MIPS GIC  19  1e000600.gpio-bank0, 1e000600.gpio-bank1, 1e000600.gpio-bank2
 19:         12          0          0          0  MIPS GIC  33  ttyS0
 20:    2894418          0          0          0  MIPS GIC  10  1e100000.ethernet
 22:          0          0          0          0  1e000600.gpio  12  keys
ERR:          1
root@router:~# uptime
 12:18:31 up  1:13,  load average: 0.52, 0.58, 0.56

@dengqf6

dengqf6 commented May 16, 2020

Copy link
Copy Markdown
Author

@pmelange
Some patches were accepted upstream, so I moved them to the backport-5.4 folder.

@981213
Please consider pushing the accepted patches.

@pmelange

Copy link
Copy Markdown
Contributor

After leaving the system run for a bit longer, I am getting the following group of messages in dmesg.

[12981.612061] br-switch: port 2(eth1) entered disabled state
[12981.635626] mt7530 mdio-bus:1f eth1: Link is Down
[12984.727626] mt7530 mdio-bus:1f eth1: Link is Up - 1Gbps/Full - flow control off
[12984.727696] br-switch: port 2(eth1) entered blocking state
[12984.727710] br-switch: port 2(eth1) entered forwarding state

The above group of messages I have received 120 times, with an uptime of 20360 seconds. It is always eth1 (which makes me wonder if the HP switch attached to this port or possibly the cable are to blame).

But otherwise, everything seems to be running quite stable still.

@981213 981213 removed the blocked pull request blocked by/waiting for another change label May 17, 2020
DENG Qingfang added 3 commits May 28, 2020 15:02
Currently, setting a bridge's self PVID to other value and deleting
the default VID 1 renders untagged ports of that VLAN unable to talk to
the CPU port:

	bridge vlan add dev br0 vid 2 pvid untagged self
	bridge vlan del dev br0 vid 1 self
	bridge vlan add dev sw0p0 vid 2 pvid untagged
	bridge vlan del dev sw0p0 vid 1
	# br0 cannot send untagged frames out of sw0p0 anymore

That is because the CPU port is set to security mode and its PVID is
still 1, and untagged frames are dropped due to VLAN member violation.

Set the CPU port to fallback mode so untagged frames can pass through.

Signed-off-by: DENG Qingfang <[email protected]>
Currently enabling VLAN filtering blocks all traffic in the bridge
immediately. That is because DSA ignores all VLAN setup when VLAN
filtering is disabled, and when it is enabled, there is no VLAN entry
in the VLAN table, causing all traffic to be blocked.

Add patches to allow VLAN setup even if VLAN filtering is disabled.

Signed-off-by: DENG Qingfang <[email protected]>
When a client moves from a DSA user port to a software port in a bridge,
it cannot reach any other clients that connected to the DSA user ports.
That is because SA learning on the CPU port is disabled, so the switch
ignores the client's frames from the CPU port and still thinks it is at
the user port.

Fix it by enabling SA learning on the CPU port.

To prevent the switch from learning from flooding frames from the CPU
port, set skb->offload_fwd_mark to 1 for unicast and broadcast frames,
and let the switch flood them instead of trapping to the CPU port.
Multicast frames still need to be trapped to the CPU port for snooping,
so set the SA_DIS bit of the MTK tag to 1 when transmitting those frames
to disable SA learning.

Signed-off-by: DENG Qingfang <[email protected]>
@dengqf6
dengqf6 force-pushed the dsa-fix branch 2 times, most recently from f5a997d to f32e14b Compare May 28, 2020 07:13
Add support for adjusting EEE with ethtool

Signed-off-by: DENG Qingfang <[email protected]>
@SirToffski

Copy link
Copy Markdown

@dengqf6 @pmelange

I'm struggling to transition my setup from swconfig to DSA. Will appreciate any pointers and help.

The layout when configured with swconfig looks like this:
image

VLAN ID CPU (eth0) LAN 1 LAN 2 LAN 3 LAN 4 WAN
1 t   u u    
2 t         u
19 t       u  
50 t u        
  • VLAN 1 is LAN bridge eth0.1 192.168.1.1 - gives out DHCP in 192.168.1.0/24
  • VLAN 19 is also a bridge eth0.19 - gives out DHCP in 192.168.19.0/24

The setup itself is not complicated. What I've relied on before is assigning each vlan interface a different MAC address. This way eth0.2 can grab a public IPv4 via DHCP and eth0.50 will show up in the IPS gateway ARP table as a separate host. Both eth0.2 and eth0.50 have their own firewall zone to separate upstream LAN traffic from WAN traffic.

I've tried doing the same with DSA without any VLAN tagging, for example making eth0 a DHCP client and adding to WAN FW zone. Making eth1 a static IP 192.168.2.2/24 interface and assigning a different firewall zone to it. Something like this:

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

config interface 'lan'
	option type 'bridge'
	option ifname 'eth2 eth3 eth4'
	option proto 'static'
	option ipaddr '192.168.1.1'
	option netmask '255.255.255.0'
	option ip6assign '60'
	option delegate '0'

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

config interface 'mgmt'
	option proto 'static'
	option ifname 'eth1'
	option ipaddr '192.168.2.2'
	option netmask '255.255.255.0'
	option gateway '192.168.2.1'

What was happening is eth0 and eth1 wouldn't stay up at the same time. Whenever eth1 (static IP) was up - eth0 was down and not show up in the ARP table of the upstream gateway.

I tried to disable "bring up on boot" option in eth1 and removing 192.168.2.1 as it's gateway address because it seemed like all interfaces assumed this to be the default route. Doing it this way I was able to get a public address on eth0 after a reboot, then I could manually bring eth1 up. However eth1 would not then forward traffic to/from 192.168.2.0/24 - so it defeated the purpose.

Finally, I've tried something similar to what @dengqf6 suggested earlier - and it didnt work either.

/etc/hotplug.d/iface/21-lan

#!/bin/sh
[ "$INTERFACE" = lan ] && [ "$ACTION" = ifup ] || exit 0

# enable VLAN filtering
ip link set dev br-lan type bridge vlan_filtering 1

# clear out vlan 1
bridge v del dev eth0 vid 1
bridge v del dev eth1 vid 1
bridge v del dev eth2 vid 1
bridge v del dev eth3 vid 1
bridge v del dev eth4 vid 1
bridge v del dev br-lan self vid 1

# set vlans eth0
bridge v add dev eth0 vid 200 pvid untagged

# set vlans eth1
bridge v add dev eth1 vid 50 pvid untagged

# set vlans cpu port
bridge v add dev br-lan self vid 50 pvid untagged
bridge v add dev br-lan self vid 200 pvid untagged

/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 interface 'lan'
	option type 'bridge'
	option ifname 'eth0 eth1 eth2 eth3 eth4'
	option proto 'static'
	option ipaddr '192.168.1.1'
	option netmask '255.255.255.0'
	option ip6assign '60'
	option delegate '0'
        option macaddr 'XX:XX:XX:XX:XX:XA'

config interface 'wan'
	option ifname '@lan.200'
	option proto 'dhcp'
        option macaddr 'XX:XX:XX:XX:XX:XB'

config interface 'mgmt'
	option proto 'static'
	option ifname '@lan.50'
	option ipaddr '192.168.2.2'
	option netmask '255.255.255.0'
	option gateway '192.168.2.1'
	option macaddr 'XX:XX:XX:XX:XX:XD'

The fact that I'm pretty much a noob in ip-utils doesn't help because I don't have a good picture of how to do this without UCI.

Appreciate any and all feedback. My main question is - in DSA every eth port should be a separate broadcast domain, shouldn't it? I couldn't comprehend why eth0 and eth1 wouldn't stay up at the same time - with one getting a DHCP lease, another one being a static address. A bug in the upstream ISP gateway maybe? It worked fine with swconfig though.

@pmelange

pmelange commented Jun 2, 2020

Copy link
Copy Markdown
Contributor

hello @SirToffski ,

The first thing that comes to mind is that there can only be one default route with a metric of 0 in the main table. When a second interface declares a default route in the main table with metric 0, it will overwrite the first one.

But it also looks like there is no reason to have a default gateway for the mgmt interface. It should only be static routes.

You also have the option of creating a separate routing table and using ip rules to tell which table to use to do routing lookups. In this case, there wouldn't be any conflicts because of the metric. Instead you will have to use option ip4table 'name' and option ip6table 'name' and create your table name in /etc/iproute2/rt_tables

Since nothing it tagged on any of the ports, you don't need the hotplug script or to use the "bridge" utility.

One last thing that comes to mind is that setting the macaddr in the interface section has long been deprecated. Instead you should have a config device 'XYZ' to set the macaddr.

I hope I'm not confusing you too much. And next time, it would be helpful to have the working config which used swconfig to base any assumptions off of.

Good luck,

@lunn

lunn commented Jun 2, 2020 via email

Copy link
Copy Markdown

@SirToffski

Copy link
Copy Markdown

@pmelange I will totally provide the working swconfig config - I wrote the original post during lunch break at work and didnt have access to the backups. 😳

@lunn The master interface from what I could tell from ip a and ip link is called dsa, then the rest are named eth0@dsa; eth1@dsa, etc. Now that you mention it - I do remember noticing eth0@dsa and dsa had the same mac addresses, whether relevant or now. I'll post my running config as well after work.

Appreciate the answers, will supply more info shortly.

@lunn

lunn commented Jun 2, 2020 via email

Copy link
Copy Markdown

@pmelange

pmelange commented Jun 2, 2020

Copy link
Copy Markdown
Contributor

@dengqf6 Just an update. The build I made 17 days ago is still running (uptime 16d 23h) , no kernel errors, no errors in /proc/interrupts. Device rb750gr3.

@SirToffski

SirToffski commented Jun 2, 2020 •

Copy link
Copy Markdown

@pmelange
My working swconfig configuration below. It's fairly uncomplicated. As seen in my previous examples, I tried duplicating it using the simplest DSA scenario I could think of.

edit: creating separate routing tables sounds like a very clean solution, I will try it definitely. And thanks for letting me know macaddr is deprecated, makes sense why it didn't work as I intended it to,

  • interface ros is eth0.50, physical port eth1 - used for upstream 192.168.2.0/24 management traffic

/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 interface 'lan'
	option type 'bridge'
	option ifname 'eth0.1'
	option proto 'static'
	option ipaddr '192.168.1.1'
	option netmask '255.255.255.0'
	option ip6assign '60'
	option delegate '0'
	list dns '10.210.210.12'

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

config device 'lan_dev'
	option name 'eth0.1'
	option macaddr 'FF:FF:FF:FF:FF:7A'

config device 'wan_dev'
	option name 'eth0.2'
	option macaddr 'FF:FF:FF:FF:FF:7B'

## This is the port for upstream LAN management traffic 
config interface 'ros'
	option proto 'static'
	option ifname 'eth0.50'
	option ipaddr '192.168.2.2'
	option netmask '255.255.255.0'
	option gateway '192.168.2.1'
	option macaddr 'FF:FF:FF:FF:FF:7D'
	list dns '10.210.210.12'

config interface 'iso'
	option ifname 'eth0.19'
	option proto 'static'
	list dns '8.8.8.8'
	list dns '1.1.1.1'
	list ipaddr '192.168.19.1/24'
	option macaddr 'FF:FF:FF:FF:FF:19'
	option delegate '0'
	option type 'bridge'

config interface 'wg0'
	option proto 'wireguard'
	option private_key '***'
	option listen_port '***'
	list addresses '10.210.210.1'

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

config switch_vlan
	option device 'switch0'
	option vlan '1'
	option vid '1'
	option ports '2 3 6t'

config switch_vlan
	option device 'switch0'
	option vlan '2'
	option vid '2'
	option ports '0 6t'

config switch_vlan
	option device 'switch0'
	option vlan '3'
	option vid '50'
	option ports '1 6t'

config switch_vlan
	option device 'switch0'
	option vlan '4'
	option vid '19'
	option ports '4 6t'

/etc/config/firewall


config defaults
	option syn_flood '1'
	option output 'ACCEPT'
	option drop_invalid '1'
	option input 'DROP'
	option forward 'DROP'
	option flow_offloading '1'

config zone
	option name 'lan'
	option input 'ACCEPT'
	option output 'ACCEPT'
	option forward 'ACCEPT'
	option log '1'
	option network 'lan'

config zone
	option name 'wan'
	option output 'ACCEPT'
	option masq '1'
	option mtu_fix '1'
	option log '1'
	option input 'DROP'
	option forward 'DROP'
	option network 'wan wan6'

config zone
	option name 'wg'
	option output 'ACCEPT'
	option forward 'ACCEPT'
	option input 'ACCEPT'
	option family 'ipv4'
	option log '1'
	list subnet '10.210.210.0/24'
	option network 'wg0'

# Upstream LAN management port 'ros'
config zone
	option name 'ROS'
	option input 'DROP'
	option forward 'DROP'
	option output 'ACCEPT'
	option network 'ros'
	option family 'ipv4'
	list subnet '192.168.2.0/24'
	option log '1'

# isolated LAN
config zone
    option name 'iso'
	option network 'iso'
	option log '1'
	option input 'ACCEPT'
	option forward 'ACCEPT'
	option output 'ACCEPT'

config forwarding
	option dest 'wan'
	option src 'lan'

config forwarding
	option dest 'wan'
	option src 'wg'

config forwarding
	option dest 'wan'
	option src 'iso'


config rule
    option name 'ros_to_wg'
	option dest_port '80'
	list proto 'tcp'
	list src_ip '192.168.2.0/24'
	list dest_ip '10.210.210.12'
	option target 'ACCEPT'
	option dest 'wg'
	option src 'ROS'

config rule
	option name 'block-egress-martians'
	option src '*'
	list src_ip '0.0.0.0/0'
	option dest 'wan'
	option proto 'all'
	option target 'DROP'
	list dest_ip '0.0.0.0/8'
	list dest_ip '10.0.0.0/8'
	list dest_ip '127.0.0.0/8'
	list dest_ip '169.254.0.0/16'
	list dest_ip '172.16.0.0/12'
	list dest_ip '192.0.0.0/24'
	list dest_ip '192.0.2.0/24'
	list dest_ip '224.0.0.0/3'
	list dest_ip '192.168.0.0/16'
	list dest_ip '198.18.0.0/15'
	list dest_ip '198.51.100.0/24'
	list dest_ip '203.0.113.0/24'

config rule
	option name 'block-ingress-martians'
	option src 'wan'
	option dest_ip '0.0.0.0/0'
	option dest '*'
	option proto 'all'
	option target 'DROP'
	list src_ip '0.0.0.0/8'
	list src_ip '10.0.0.0/8'
	list src_ip '127.0.0.0/8'
	list src_ip '169.254.0.0/16'
	list src_ip '172.16.0.0/12'
	list src_ip '192.0.0.0/24'
	list src_ip '192.0.2.0/24'
	list src_ip '224.0.0.0/3'
	list src_ip '192.168.0.0/16'
	list src_ip '198.18.0.0/15'
	list src_ip '198.51.100.0/24'
	list src_ip '203.0.113.0/24'

config rule
	option name 'Allow-DHCP-Renew'
	option src 'wan'
	option proto 'udp'
	option dest_port '68'
	option target 'ACCEPT'
	option family 'ipv4'

config rule
	option name 'Allow-Ping'
	option src 'wan'
	option proto 'icmp'
	option icmp_type 'echo-request'
	option family 'ipv4'
	option target 'ACCEPT'

config rule
	option name 'Allow-IGMP'
	option src 'wan'
	option proto 'igmp'
	option family 'ipv4'
	option target 'ACCEPT'

config rule
	option name 'Block-Outbound-TFTP'
	option src 'lan'
	option dest 'wan'
	option dest_port '69'
	option proto 'udp'
	option family 'any'
	option target 'DROP'

config rule
	option name 'Block-Outbound-SNMP'
	option src 'lan'
	option dest 'wan'
	option dest_port '161 162'
	option proto 'udp'
	option family 'any'
	option target 'DROP'

config rule
	option name 'Block-Outbound-SMB'
	option src 'lan'
	option dest_port '135 137 138 139 445'
	option dest 'wan'
	option proto 'tcp udp'
	option target 'DROP'

config rule
    option name 'allow-wan-to-wg'
	option target 'ACCEPT'
	option src 'wan'
	option dest_port '****'
	option family 'ipv4'
	option proto 'udp'

config rule
    option name 'block-wg-to-ros'
	option target 'DROP'
	option src 'wg'
	option dest 'ROS'
	option proto 'tcp udp'
	list dest_ip '192.168.2.0/24'
	list src_ip '10.210.210.0/24'

config rule
    option name 'allow-ros-to-lan'
	list proto 'all'
	option src 'ROS'
	option dest 'lan'
	list src_ip '192.168.2.0/24'
	list dest_ip '192.168.1.110'
	option target 'ACCEPT'
	option family 'ipv4'

config rule
    option name 'allow-ssh-from-ros'
	option target 'ACCEPT'
	option src 'ROS'
	list src_ip '192.168.2.0/24'
	list dest_ip '192.168.1.1'
	list proto 'tcp'
	option dest_port '22'

config include 'bcp38'
	option type 'script'
	option path '/usr/lib/bcp38/run.sh'
	option family 'IPv4'
	option reload '1'

config include
	option path '/etc/firewall.user'

@SirToffski

SirToffski commented Jun 2, 2020 •

Copy link
Copy Markdown

@lunn This is how the interfaces look. Presuming dsa is the master interface and eth*@dsa are "physical" interfaces on the Edgerouter aka ports eth0-eth4.

br-iso corresponds with eth0@dsa - just an isolated LAN for work stuff. The only reason for making the interface into a bridge - this was the easiest way to configure DHCP on that interface via UCI. The interface works as I expect it to.

Right now with DSA upstream LAN management for 192.168.2.0/24 network and WAN traffic are both passing via eth3@dsa. I created a second interface for eth3 and assigned it a 192.168.2.3/24 address. Having a static route like To 192.168.1.0/24 via 192.168.2.3 on the upstream ISP gateway worked to get communication between 192.168.1.0/24<>192.168.2.0/24; though isolating lan staff to a separate physical interface would be my preferred solution.

# ip -br link
lo               UNKNOWN        00:00:00:00:00:00 <LOOPBACK,UP,LOWER_UP> 
dsa              UP             ff:ff:ff:ff:ff:7a <BROADCAST,MULTICAST,UP,LOWER_UP> 
eth0@dsa         UP             ff:ff:ff:ff:ff:7a <BROADCAST,MULTICAST,UP,LOWER_UP> 
eth1@dsa         LOWERLAYERDOWN ff:ff:ff:ff:ff:7b <NO-CARRIER,BROADCAST,MULTICAST,UP> 
eth2@dsa         UP             ff:ff:ff:ff:ff:7c <BROADCAST,MULTICAST,UP,LOWER_UP> 
eth3@dsa         UP             ff:ff:ff:ff:ff:7d <BROADCAST,MULTICAST,UP,LOWER_UP> 
eth4@dsa         DOWN           ff:ff:ff:ff:ff:7e <BROADCAST,MULTICAST> 
br-iso           UP             ff:ff:ff:ff:ff:19 <BROADCAST,MULTICAST,UP,LOWER_UP> 
br-lan           UP             ff:ff:ff:ff:ff:7b <BROADCAST,MULTICAST,UP,LOWER_UP> 
config interface 'wan'
	option proto 'dhcp'
	option ifname 'eth3'
	option force_link '1'
	option delegate '0'

config interface 'ros2'
	option proto 'static'
	option ifname 'eth3'
	option ipaddr '192.168.2.3'
	option netmask '255.255.255.0'

config interface 'lan'
	option type 'bridge'
	option proto 'static'
	option ipaddr '192.168.1.1'
	option netmask '255.255.255.0'
	list dns '10.210.210.12'
	option ifname 'eth1 eth2'
	option delegate '0'
	option stp '1'

config interface 'iso'
	option proto 'static'
	option ipaddr '192.168.19.1'
	option netmask '255.255.255.0'
	list dns '1.1.1.2'
	list dns '1.0.0.2'
	option delegate '0'
	option type 'bridge'
	option ifname 'eth0'

@pmelange

pmelange commented Jun 3, 2020

Copy link
Copy Markdown
Contributor

I believe that with your old setup, the default gateway set up for interface "ros" is being overwritten by the default gateway provided by dhcp when wan goes us. But since you have set up some ip-rules, it doesn't hinder sending traffic to the correct place.

Do you have the ability to flash an older firmware to confirm this?

Additionally, I don't see any static routes in your old /etc/config/network. That would be a clean way designate which networks are reachable via "ros". But doing it all with rules is totally fine.

But back to the main topic. Setting up bridges with the ethX devices should be fine in your situation. There is no need to use the hotplug script or to set any kind of vid on any of the ports since everything is untagged.

@nbd168

nbd168 commented Jun 4, 2020

Copy link
Copy Markdown
Member

Merged (with renumbered patches to avoid conflicts), thanks.
I was running into the roaming issues in my setup at home and these patches resolved them nicely.

@dchard

dchard commented Jun 7, 2020

Copy link
Copy Markdown
Contributor

@dengqf6

One of my friend still has the link up / link down issue on a MIR 3G, and I want to try your patch to disable flow control completely. With your patch this is possible via ethtool I assume?

[418198.123306] mt7530 mdio-bus:1f wan: Link is Down
[418198.351366] mt7530 mdio-bus:1f wan: configuring for phy/gmii link mode
[418198.387672] 8021q: adding VLAN 0 to HW filter on device wan
[418238.418927] mt7530 mdio-bus:1f wan: Link is Up - 1Gbps/Full - flow control rx/tx
[418238.426445] IPv6: ADDRCONF(NETDEV_CHANGE): wan: link becomes ready

@SirToffski

SirToffski commented Jun 8, 2020 •

Copy link
Copy Markdown

@pmelange

I've finally managed to duplicate my old setup with DSA. It's a bit messy but gets the job done. This is what it looks like:


# cat /etc/rc.local

# Put your custom commands here that should be executed once
# the system init finished. By default this file does nothing.

ip link set dev br-wan type bridge vlan_filtering 1
bridge v del dev eth3 vid 1
bridge v del dev eth4 vid 1
bridge v del dev br-wan self vid 1
bridge v add dev eth3 vid 20 pvid untagged
bridge v add dev eth4 vid 50 pvid untagged
bridge v add dev br-wan self vid 50
bridge v add dev br-wan self vid 20
ip link set dev br-wan.50 address ff:ff:ff:ff:ff:67

exit 0

# cat /etc/config/network

config interface 'lan'
	option type 'bridge'
	option proto 'static'
	option ipaddr '192.168.1.1'
	option netmask '255.255.255.0'
	option ifname 'eth1 eth2'
	option delegate '0'
	option stp '1'

config interface 'wan'
	option ifname 'eth3 eth4'
	option type 'bridge'
	option proto 'none'

config interface 'data'
	option proto 'dhcp'
	option ifname 'br-wan.20'

config interface 'ros'
	option proto 'static'
	option ipaddr '192.168.2.20'
	option netmask '255.255.255.0'
	option ifname 'br-wan.50'

config interface 'wg0'
	option proto 'wireguard'
        option private_key '**'
        option listen_port '**'
        list addresses '10.10.10.1'

# cat /etc/config/firewall

config defaults
	option syn_flood '1'
	option output 'ACCEPT'
	option drop_invalid '1'
	option input 'DROP'
	option forward 'DROP'

config zone
	option name 'lan'
	option input 'ACCEPT'
	option output 'ACCEPT'
	option forward 'ACCEPT'
	option log '1'
	option network 'lan'
	list device 'br-lan'

config zone
	option name 'wan'
	option output 'ACCEPT'
	option masq '1'
	option mtu_fix '1'
	option log '1'
	option input 'DROP'
	option forward 'DROP'
	option network 'wan data'
        list device 'br-wan.20'

config zone
	option name 'wg'
	option output 'ACCEPT'
	option forward 'ACCEPT'
	option input 'ACCEPT'
	option family 'ipv4'
	option log '1'
	list subnet '10.10.10.0/24'
	option network 'wg0'

config zone
	option name 'ROS'
	option input 'DROP'
	option forward 'DROP'
	option output 'ACCEPT'
	option family 'ipv4'
	list subnet '192.168.2.0/24'
	option log '1'
	option network 'ros'
	list device 'br-wan.50'

config forwarding
	option dest 'wan'
	option src 'lan'

config forwarding
	option dest 'wan'
	option src 'wg'

config rule
	option name 'allow-ros-to-mgmt'
	option dest_port '22'
	list proto 'tcp'
        option src 'ROS'
	list src_ip '192.168.2.0/24'
	list dest_ip '192.168.1.1'
	option target 'ACCEPT'
	option family 'ipv4'

config rule
	option name 'allow-ros-to-wg-tcp'
	option dest_port '80'
	list proto 'tcp'
	list src_ip '192.168.2.0/24'
	list dest_ip '10.10.10.100'
	option target 'ACCEPT'
	option dest 'wg'
	option src 'ROS'

config rule
	option name 'Allow-DHCP-Renew'
	option src 'wan'
	option proto 'udp'
	option dest_port '68'
	option target 'ACCEPT'
	option family 'ipv4'

config rule
	option name 'block-egress-martians'
	option src '*'
	list src_ip '0.0.0.0/0'
	option dest 'wan'
	option proto 'all'
	option target 'DROP'
	list dest_ip '0.0.0.0/8'
	list dest_ip '10.0.0.0/8'
	list dest_ip '127.0.0.0/8'
	list dest_ip '169.254.0.0/16'
	list dest_ip '172.16.0.0/12'
        list dest_ip '192.168.0.0/16'
	list dest_ip '192.0.0.0/24'
	list dest_ip '192.0.2.0/24'
	list dest_ip '224.0.0.0/3'
	list dest_ip '198.18.0.0/15'
	list dest_ip '198.51.100.0/24'
	list dest_ip '203.0.113.0/24'

config rule
	option name 'block-ingress-martians'
	option src 'wan'
	option dest '*'
	option proto 'all'
	list src_ip '0.0.0.0/8'
	list src_ip '10.0.0.0/8'
	list src_ip '127.0.0.0/8'
	list src_ip '169.254.0.0/16'
	list src_ip '172.16.0.0/12'
	list src_ip '192.0.0.0/24'
	list src_ip '192.0.2.0/24'
	list src_ip '224.0.0.0/3'
	list src_ip '192.168.0.0/16'
	list src_ip '198.18.0.0/15'
	list src_ip '198.51.100.0/24'
	list src_ip '203.0.113.0/24'
	option target 'DROP'
	list dest_ip '0.0.0.0/0'

config rule
	option name 'deny-wg-to-ros'
	option src 'wg'
	option dest 'ROS'
	list src_ip '10.10.10.0/24'
	list dest_ip '192.168.2.0/24'
	option target 'DROP'
	option proto 'tcp udp'

config rule
	option name 'allow-lan-to-wg'
	option src 'lan'
	option dest 'wg'
	list src_ip '192.168.1.0/24'
	list dest_ip '10.10.10.100'
	option dest_port '80'
	list proto 'tcp'
	option target 'ACCEPT'

config include
	option path '/etc/firewall.user'

config include 'bcp38'
	option type 'script'
	option path '/usr/lib/bcp38/run.sh'
	option family 'IPv4'
	option reload '1'

@pmelange

pmelange commented Jun 8, 2020

Copy link
Copy Markdown
Contributor

Seems like a good start. I would highly recommend doing the hotplug script variation. Then, if /etc/init.d/network restart is called, then everything gets set up again. Having it in rc.local means that it will only ever get run once.

@Shine-

Shine- commented Jun 10, 2020

Copy link
Copy Markdown
Contributor

Sorry for posting into a closed PR...

Adding the ip link and bridge commands to /etc/rc.local shouldn't work, because the bridge isn't created yet at rc.local execution time - in my case at least (tested on two different MT7621 units). Might be a race condition and therefore work on other devices? I'd also recommend using a hotplug script instead.

Which brings us to one more issue I noticed - a pretty major one at that:

I have a similar setup as pmelange, just with more than only one untagged VLAN. Creating the bridge in /etc/config/network like in the above examples causes the bridge to come up with all ports set to VLAN 1 untagged. This causes leakage between all untagged VLANs during boot time. After the hotplug script runs and VLAN 1 is removed from all ports, everything is fine again - but the damage is already done, e.g. clients being unreachable because they received DHCP IP addresses from the wrong VLAN.

I do understand that using the ip link and bridge commands in a hotplug script is only a dirty workaround until DSA switches are fully supported for configuration by UCI.

Does anybody have an idea how to prevent the leakage between VLANs in the meantime? Thanks!

@SirToffski

Copy link
Copy Markdown

@Shine- Interesting observation - it did work with /etc/rc.local on EdgeRouter X for me. Though I later implement it as a hotplug script like @pmelange suggested.

Should be create a forum topic for this instead of using a closed PR?

@dengqf6

dengqf6 commented Jun 16, 2020

Copy link
Copy Markdown
Author

@SirToffski
It looks like you are using VLAN filtering only to separate traffic, but DSA already did that automatically. So you don't need to enable it.
Use eth3 instead of br-wan.20, and eth4 instead of br-wan.50, remove the wan bridge, and that's all.

@SirToffski

Copy link
Copy Markdown

@SirToffski
It looks like you are using VLAN filtering only to separate traffic, but DSA already did that automatically. So you don't need to enable it.
Use eth3 instead of br-wan.20, and eth4 instead of br-wan.50, remove the wan bridge, and that's all.

In theory it should be as simple as that, but in practice it doesn't work :( It's not that the traffic separation is my main issue.
Here's the issue, eth3 and eth4 are both connected to the ISP-provided gateway. On the ISP gateway there's an option to add a host to "Advanced DMZ" for which a MAC address of the host is needed. So I add the mac of eth3 to the "Advanced DMZ" and eth3 grabs a DHCP'd public address from my ISP instead of getting NAT'd by the upstream ISP gateway. eth4 is used for management traffic between WLAN/LAN devices on the ISP's gateway (192.168.2.0/24) and has a static IP assigned 192.168.2.2/24.

Here's the problem - without using VLANs and simply using eth3 and eth4 - eth3 does not grab a DHCP lease from the upstream ISP gateway. I can force it to grab a DHCP lease if I disable "bring interface up on boot time" on eth4. After rebooting eth3 grabs a public DHCP as expected. I then bring eth4 up, and it looks like everything now works...except for management traffic for 192.168.2.0/24 subnet does not want to enter via eth4, only via WAN eth3. This defeats the purpose of separating WAN/LAN traffic to two physical interface.

This could be bug on the ISP's gateway for all I know.. doesn't matter much what exactly is causing the problem as long as I've got a solution to it..

If you're interested I can provide some more info later today; could revert to using plain eth3/eth4 and get some info like ip a, ip route. Then revert back to my current setup and do the same. Let me know!

@dengqf6

dengqf6 commented Jun 17, 2020

Copy link
Copy Markdown
Author

@SirToffski
So you can just reuse eth3 to access 192.168.2.0/24

@dengqf6

dengqf6 commented Jun 23, 2020

Copy link
Copy Markdown
Author

@SirToffski
And ff:ff:ff:ff:ff:67 is not a valid unicast MAC

@SirToffski

SirToffski commented Jun 23, 2020 •

Copy link
Copy Markdown

@dengqf6 I'm not actually using ff:ff:ff:ff:ff:67, 'ff' are just place-holders for an example.
I'll paraphrase it with:

01:02:03:AB:CD:67

The reason I do not want to use eth3 only is because I would like to deny all incoming traffic on the WAN interface. Futhermore, I am trying to prevent ingress and egress martian addresses on the WAN interface. If I use 'eth3' only and would need 192.168.2.0/24 to reach 192.168.1.0/24 - I would need to have a rule similar to this:

config rule
	option name 'allow-upstream-lan'
	option src 'wan'
	option dest 'lan'
	option proto 'all'
        list src_ip '192.168.2.0/24'
	list dest_ip '192.168.1.150'

^ I could only allow specific destination ports to very specific destination addresses, however like as I've said I would like to keep WAN "martian-free"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kernel pull request/issue with Linux kernel related changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.