Return-Path: Message-ID: <2ba876f9ad6597e640df68f09659dce3c4b5ce03.camel@linux.ibm.com> From: Leonardo Bras Date: Sat, 31 Aug 2019 01:42:29 -0300 In-Reply-To: <20190830205541.GR20113@breakpoint.cc> References: <20190830181354.26279-1-leonardo@linux.ibm.com> <20190830181354.26279-3-leonardo@linux.ibm.com> <20190830205541.GR20113@breakpoint.cc> Content-Type: multipart/signed; micalg="pgp-sha256"; protocol="application/pgp-signature"; boundary="=-NmceabA7waNjtZ157fkz" MIME-Version: 1.0 Subject: Re: [Bridge] [PATCH v4 2/2] net: br_netfiler_hooks: Drops IPv6 packets if IPv6 module is not loaded List-Id: Linux Ethernet Bridging List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Florian Westphal Cc: Nikolay Aleksandrov , netdev@vger.kernel.org, Roopa Prabhu , bridge@lists.linux-foundation.org, linux-kernel@vger.kernel.org, Jozsef Kadlecsik , coreteam@netfilter.org, netfilter-devel@vger.kernel.org, "David S. Miller" , Pablo Neira Ayuso --=-NmceabA7waNjtZ157fkz Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, 2019-08-30 at 22:55 +0200, Florian Westphal wrote: > Leonardo Bras wrote: > > 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. > >=20 > > IPv6 packets need to be dropped if the IPv6 module is not loaded. > >=20 > > Signed-off-by: Leonardo Bras > > --- > > net/bridge/br_netfilter_hooks.c | 2 ++ > > 1 file changed, 2 insertions(+) > >=20 > > diff --git a/net/bridge/br_netfilter_hooks.c b/net/bridge/br_netfilter_= hooks.c > > index d3f9592f4ff8..5e8693730df1 100644 > > --- a/net/bridge/br_netfilter_hooks.c > > +++ b/net/bridge/br_netfilter_hooks.c > > @@ -493,6 +493,8 @@ static unsigned int br_nf_pre_routing(void *priv, > > brnet =3D net_generic(state->net, brnf_net_id); > > if (IS_IPV6(skb) || is_vlan_ipv6(skb, state->net) || > > is_pppoe_ipv6(skb, state->net)) { > > + if (!ipv6_mod_enabled()) > > + return NF_DROP; > > if (!brnet->call_ip6tables && > > !br_opt_get(br, BROPT_NF_CALL_IP6TABLES)) > > return NF_ACCEPT; >=20 > No, thats too aggressive and turns the bridge into an ipv6 blackhole. >=20 > There are two solutions: > 1. The above patch, but use NF_ACCEPT instead > 2. keep the DROP, but move it below the call_ip6tables test, > so that users can tweak call-ip6tables to accept packets. Q: Does 2 mean that it will only be dropped if bridge intents to use host's ip6tables? Else, it will be accepted by previous if? > Perhaps it would be good to also add a pr_warn_once() that > tells that ipv6 was disabled on command line and > call-ip6tables isn't supported in this configuration. >=20 Good idea, added. > I would go with option two. I think it's better than 1 too. I sent a v5 with these changes: https://lkml.org/lkml/2019/8/31/4 Thanks! Leonardo Bras --=-NmceabA7waNjtZ157fkz Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEMdeUgIzgjf6YmUyOlQYWtz9SttQFAl1p+rUACgkQlQYWtz9S ttSbUxAAr5vWLsGmro0HQCOExyLhf5zWEHkHJXUbjLocdlp1f3FOsgmu5Wz8noQs gbPstMKc4dGJDZ5kFiTlYT4rxDP4zms84JzRohrjWvM/W/quuAS063wMCqjbFq6r F8HUhED6VGd3ViAeEASkwHMjgCdla9y5M9/V84GxBlQ+ZVt0hFqon8Q3Us0OLMoA 91TfahVL8FyhW2w6h5F/oCYG2oD+2KqGScCjoZ0tVyppJP9GUI63E7pEwodXsDHH MW153XedTgyNnHl5CK9LBLX2lHXZi4O8cauVqXWnbDyvJl/VaRzCUAnNLSdjTM3X SmXy+5iLTuxnpIAr9esXdXdFXaIV7FnMwXHvBIkXdT1KOVZcmJg5NnZaswjP4LAD fJbNAKky0A56keHQ8bi7CqQ2+GmVK4wMyANAXaow2OynLvZbw/vhQzoqi5wjuP4p Z+nHh2n2BTTjY1ZcJJLjMRi12DIZFLDYnqpu4vXEvmhp3PtlO5BCg0C+A1HWtSdq 0oVzl+MXOKhtZF5H7wwIV5wjC5Ij88TaDEatC1iYZE8AhADlDZ2foHCVoFZm2OGr +ggS9vYmGiqw5zSHFQSqY6PVKdSPxg25Zoe+um2J0KCbVhldmEjBIJ1lXgeICPEx AK8YyIJB14V5H3Ef4EveO77t3tYQon28WfOix1tSQ9+//XVUlVU= =lpBD -----END PGP SIGNATURE----- --=-NmceabA7waNjtZ157fkz--