diff --git a/sys/net/if_gif.c b/sys/net/if_gif.c --- a/sys/net/if_gif.c +++ b/sys/net/if_gif.c @@ -405,6 +405,21 @@ { uint32_t af; + /* + * Normally, when a gif(4) interface is a member of bridge(4), bridge_enqueue() + * only calls gif_transmit(), so this code path should never be reached. + * However, if the outer protocol of the gif tunnel is IPv6, certain special + * IPv6 multicast control messages, such as MLDv2, destinated for ff02::/16 + * may still reach gif_output() due to internal behavior of IPv6 stack. + * + * Therefore, the kernel should not panic because of such packets; instead, + * they should be silently dropped. + */ + if (ifp->if_bridge != NULL && dst->sa_family == AF_INET6) { + m_freem(m); + return (0); + } + KASSERT(ifp->if_bridge == NULL, ("%s: unexpectedly called with bridge attached", __func__));