summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sys/netinet6/ip6_output.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/sys/netinet6/ip6_output.c b/sys/netinet6/ip6_output.c
index 5e0105c..b955f40 100644
--- a/sys/netinet6/ip6_output.c
+++ b/sys/netinet6/ip6_output.c
@@ -1044,6 +1044,7 @@ skip_ipsec2:;
u_char nextproto;
struct ip6ctlparam ip6cp;
u_int32_t mtu32;
+ int qslots = ifp->if_snd.ifq_maxlen - ifp->if_snd.ifq_len;
/*
* Too large for the destination or interface;
@@ -1068,6 +1069,17 @@ skip_ipsec2:;
goto bad;
}
+ /*
+ * Verify that we have any chance at all of being able to queue
+ * the packet or packet fragments
+ */
+ if (qslots <= 0 || ((u_int)qslots * (mtu - hlen)
+ < tlen /* - hlen */)) {
+ error = ENOBUFS;
+ ip6stat.ip6s_odropped++;
+ goto bad;
+ }
+
mnext = &m->m_nextpkt;
/*
OpenPOWER on IntegriCloud