avoid divide-by-zero when the specified bandwidth is less than 8bps.

OpenBSD PR: kernel/2150
This commit is contained in:
itojun 2001-10-26 04:59:18 +00:00
parent a414473103
commit 8008d16e68
2 changed files with 6 additions and 6 deletions

View File

@ -1,5 +1,5 @@
/* $NetBSD: altq_hfsc.c,v 1.3 2001/04/13 23:29:56 thorpej Exp $ */
/* $KAME: altq_hfsc.c,v 1.8 2000/12/14 08:12:46 thorpej Exp $ */
/* $NetBSD: altq_hfsc.c,v 1.4 2001/10/26 04:59:18 itojun Exp $ */
/* $KAME: altq_hfsc.c,v 1.9 2001/10/26 04:56:11 kjc Exp $ */
/*
* Copyright (c) 1997-1999 Carnegie Mellon University. All Rights Reserved.
@ -332,7 +332,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

View File

@ -1,5 +1,5 @@
/* $NetBSD: altq_priq.c,v 1.3 2001/04/13 23:29:56 thorpej Exp $ */
/* $KAME: altq_priq.c,v 1.1 2000/10/18 09:15:23 kjc Exp $ */
/* $NetBSD: altq_priq.c,v 1.4 2001/10/26 04:59:18 itojun Exp $ */
/* $KAME: altq_priq.c,v 1.2 2001/10/26 04:56:11 kjc Exp $ */
/*
* Copyright (C) 2000
* Sony Computer Science Laboratories Inc. All rights reserved.
@ -267,7 +267,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