Skip to contentSkip to conversation

net: br_netfiler_hooks: Drops IPv6 packets if IPv6 module is not loaded

PATCH Applied Leonardo Bras 3 participants 3 messages Aug 31, 2019 – Sep 2, 2019

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH v5 1/1 net: br_netfiler_hooks: Drops IPv6 packets if IPv6 module is not loaded

A kernel panic can happen if a host has disabled IPv6 on boot and have to process guest packets (coming from a bridge) using it's ip6tables.

IPv6 packets need to be dropped if the IPv6 module is not loaded, and the host ip6tables will be used.

---
Changes from v4:
- Check if the host ip6tables is going to be used before testing ipv6 module presence
- Adds a warning about ipv6 module disabled.

 net/bridge/br_netfilter_hooks.c | 4 ++++
 1 file changed, 4 insertions(+)
net/bridge/br_netfilter_hooks.c +4 -0
index d3f9592f4ff8..af7800103e51 100644
@@ -496,6 +496,10 @@ static unsigned int br_nf_pre_routing(void *priv,
 		if (!brnet->call_ip6tables &&
 		    !br_opt_get(br, BROPT_NF_CALL_IP6TABLES))
 			return NF_ACCEPT;
+		if (!ipv6_mod_enabled()) {
+			pr_warn_once("Module ipv6 is disabled, so call_ip6tables is not supported.");
+			return NF_DROP;
+		}
 
 		nf_bridge_pull_encap_header_rcsum(skb);
 		return br_nf_pre_routing_ipv6(priv, skb, state);
Signature · 1 line
2.20.1
maintainer Acked-by on v5 1/1
#1 lore raw
Quoted 22 lines · Leonardo Bras

A kernel panic can happen if a host has disabled IPv6 on boot and have to process guest packets (coming from a bridge) using it's ip6tables.

IPv6 packets need to be dropped if the IPv6 module is not loaded, and the host ip6tables will be used.

---
Changes from v4:
- Check if the host ip6tables is going to be used before testing ipv6 module presence
- Adds a warning about ipv6 module disabled.

 net/bridge/br_netfilter_hooks.c | 4 ++++
 1 file changed, 4 insertions(+)
net/bridge/br_netfilter_hooks.c +0 -0
index d3f9592f4ff8..af7800103e51 100644

net/bridge/br_netfilter_hooks.c static unsigned int br_nf_pre_routing(void *priv, · line 502

Quoted 7 lines
net/bridge/br_netfilter_hooks.c +4 -0
@@ -496,6 +496,10 @@ static unsigned int br_nf_pre_routing(void *priv,
 		if (!brnet->call_ip6tables &&
 		    !br_opt_get(br, BROPT_NF_CALL_IP6TABLES))
 			return NF_ACCEPT;
+		if (!ipv6_mod_enabled()) {
+			pr_warn_once("Module ipv6 is disabled, so call_ip6tables is not supported.");
+			return NF_DROP;
+		}

pr_warn_once needs a '\n'. Pablo, can you mangle this locally when applying?

Patch looks good to me, so:

maintainer Applied
#2 lore raw
In reply to Leonardo Bras
Quoted 5 lines · Leonardo Bras

A kernel panic can happen if a host has disabled IPv6 on boot and have to process guest packets (coming from a bridge) using it's ip6tables.

IPv6 packets need to be dropped if the IPv6 module is not loaded, and the host ip6tables will be used.

Applied, thanks.