in6: don't send any IPv6 packets over a disabled interface

This commit is contained in:
ozaki-r 2023-08-03 05:45:36 +00:00
parent fc4db3454a
commit 88620389b0
1 changed files with 8 additions and 2 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: ip6_output.c,v 1.233 2023/03/20 09:15:52 ozaki-r Exp $ */
/* $NetBSD: ip6_output.c,v 1.234 2023/08/03 05:45:36 ozaki-r Exp $ */
/* $KAME: ip6_output.c,v 1.172 2001/03/25 09:55:56 itojun Exp $ */
/*
@ -62,7 +62,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ip6_output.c,v 1.233 2023/03/20 09:15:52 ozaki-r Exp $");
__KERNEL_RCSID(0, "$NetBSD: ip6_output.c,v 1.234 2023/08/03 05:45:36 ozaki-r Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@ -171,6 +171,12 @@ ip6_if_output(struct ifnet * const ifp, struct ifnet * const origifp,
}
}
/* discard the packet if IPv6 operation is disabled on the interface */
if ((ND_IFINFO(ifp)->flags & ND6_IFF_IFDISABLED)) {
m_freem(m);
return ENETDOWN; /* better error? */
}
if ((ifp->if_flags & IFF_LOOPBACK) != 0)
error = if_output_lock(ifp, origifp, m, sin6tocsa(dst), rt);
else