Skip to content

Commit e74ae15

Browse files
committed
nftables: omit reflection filter on corerouters
(if and endif are the only changes, the rest is indentation fixes.) Intermittently breaks routed IP traffic to mesh neighbours if the mesh interface is using the underlying (wifi) interface directly, instead of a bridge or VLAN. The filter is supposed to learn our own mac addresses from outgoing traffic and then reject incoming reflected packets with our own src address. If we don't filter these, logread gets cluttered with informational messages saying "received packet with our own address". However, if a mesh interface uses the underlying interface directly (instead of wrapping it in a bridge or VLAN), we somehow end up blocking our mesh neighbours. This is the case e.g. on corerouters that mesh on their own, with integrated antennas. For now let's "fix" this by not using the reflection filter on corerouters anymore.
1 parent 2422fde commit e74ae15

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

roles/cfg_openwrt/templates/common/nftables.conf.j2

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -60,20 +60,21 @@ table bridge client_isolation {
6060
{% endif %}
6161
{% endfor %}
6262

63-
{% for network in networks | selectattr('role', 'equalto', 'mesh') | selectattr('name','in', network_ifname_map|map(attribute='network')) %}
64-
{% set wifi_if = network_ifname_map | selectattr('network', 'equalto', network['name']) | map(attribute='ifname') | first %}
65-
{% set set_localrouter = 'localrouter_' + network['name'] %}
66-
{% if loop.first %}
63+
{% if role == 'corerouter' %}
64+
{% for network in networks | selectattr('role', 'equalto', 'mesh') | selectattr('name','in', network_ifname_map|map(attribute='network')) %}
65+
{% set wifi_if = network_ifname_map | selectattr('network', 'equalto', network['name']) | map(attribute='ifname') | first %}
66+
{% set set_localrouter = 'localrouter_' + network['name'] %}
67+
{% if loop.first %}
6768

68-
{# Corerouters have no bridge, therefore we need to hook in family inet.
69-
See https://wiki.nftables.org/wiki-nftables/index.php/Netfilter_hooks#Netfilter_hooks_into_Linux_networking_packet_flows #}
70-
{% set type = 'bridge' if role == 'ap' else 'inet' %}
69+
{# Corerouters have no bridge, therefore we need to hook in family inet.
70+
See https://wiki.nftables.org/wiki-nftables/index.php/Netfilter_hooks#Netfilter_hooks_into_Linux_networking_packet_flows #}
71+
{% set type = 'bridge' if role == 'ap' else 'inet' %}
7172

7273

7374
table {{ type }} prevent_mesh_reflection
7475
flush table {{ type }} prevent_mesh_reflection
7576
table {{ type }} prevent_mesh_reflection {
76-
{% endif %}
77+
{% endif %}
7778
set {{ set_localrouter }} {
7879
type ether_addr
7980
size 5
@@ -88,7 +89,8 @@ table {{ type }} prevent_mesh_reflection {
8889
iifname {{ wifi_if }} ether saddr @{{ set_localrouter }} counter drop
8990

9091
}
91-
{% if loop.last %}
92+
{% if loop.last %}
9293
}
93-
{% endif %}
94-
{% endfor %}
94+
{% endif %}
95+
{% endfor %}
96+
{% endif %}

0 commit comments

Comments
 (0)