diff options
author | Kenjiro Cho <kjc@cvs.openbsd.org> | 2001-10-26 07:36:47 +0000 |
---|---|---|
committer | Kenjiro Cho <kjc@cvs.openbsd.org> | 2001-10-26 07:36:47 +0000 |
commit | 40b1a802e09c29053d233b7a1c0cb02042b36bb5 (patch) | |
tree | ee82e306d05cfddeb8b27879d16c284928034dd1 /sys | |
parent | b5482e53abd80c52e0b35795d00914e6c0f70ae7 (diff) |
avoid divide-by-zero when the specified bandwidth is less than 8bps.
PR kernel/2150
Diffstat (limited to 'sys')
-rw-r--r-- | sys/altq/altq_hfsc.c | 4 | ||||
-rw-r--r-- | sys/altq/altq_priq.c | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/sys/altq/altq_hfsc.c b/sys/altq/altq_hfsc.c index 5f85820cad3..b49cd9acb81 100644 --- a/sys/altq/altq_hfsc.c +++ b/sys/altq/altq_hfsc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: altq_hfsc.c,v 1.2 2001/08/09 14:32:59 deraadt Exp $ */ +/* $OpenBSD: altq_hfsc.c,v 1.3 2001/10/26 07:36:46 kjc Exp $ */ /* $KAME: altq_hfsc.c,v 1.8 2000/12/14 08:12:46 thorpej Exp $ */ /* @@ -320,7 +320,7 @@ hfsc_class_create(hif, sc, parent, qlimit, flags) if (flags & HFCF_CLEARDSCP) red_flags |= RIOF_CLEARDSCP; #endif - if (sc->m2 == 0) + if (sc->m2 < 8) red_pkttime = 1000 * 1000 * 1000; /* 1 sec */ else red_pkttime = (int64_t)hif->hif_ifq->altq_ifp->if_mtu diff --git a/sys/altq/altq_priq.c b/sys/altq/altq_priq.c index 4b92d06bb26..3d12e71ca60 100644 --- a/sys/altq/altq_priq.c +++ b/sys/altq/altq_priq.c @@ -1,4 +1,4 @@ -/* $OpenBSD: altq_priq.c,v 1.2 2001/08/09 14:32:59 deraadt Exp $ */ +/* $OpenBSD: altq_priq.c,v 1.3 2001/10/26 07:36:46 kjc Exp $ */ /* $KAME: altq_priq.c,v 1.1 2000/10/18 09:15:23 kjc Exp $ */ /* * Copyright (C) 2000 @@ -255,7 +255,7 @@ priq_class_create(pif, pri, qlimit, flags) if (flags & PRCF_CLEARDSCP) red_flags |= RIOF_CLEARDSCP; #endif - if (pif->pif_bandwidth == 0) + if (pif->pif_bandwidth < 8) red_pkttime = 1000 * 1000 * 1000; /* 1 sec */ else red_pkttime = (int64_t)pif->pif_ifq->altq_ifp->if_mtu |