summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordlg <dlg@openbsd.org>2016-03-16 12:08:09 +0000
committerdlg <dlg@openbsd.org>2016-03-16 12:08:09 +0000
commitd0b51642ac65fc549021b57e7692e1b0513937af (patch)
tree56fc393a69c8b663424c1eddd52df7020190eb9a
parentmacros for the null, min, and max vlan ids. (diff)
downloadwireguard-openbsd-d0b51642ac65fc549021b57e7692e1b0513937af.tar.xz
wireguard-openbsd-d0b51642ac65fc549021b57e7692e1b0513937af.zip
if ticks diverge from ifq_congestion too far the diff will go negative
detect this and bump ifq_congestion forward rather than claim the system is congested for a long period of time. ok mpi@ henning@ jmatthew@
-rw-r--r--sys/net/if.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/sys/net/if.c b/sys/net/if.c
index 776f9abea14..fbe239d38a0 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if.c,v 1.428 2016/03/07 18:44:00 naddy Exp $ */
+/* $OpenBSD: if.c,v 1.429 2016/03/16 12:08:09 dlg Exp $ */
/* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */
/*
@@ -1130,8 +1130,15 @@ int
if_congested(void)
{
extern int ticks;
+ int diff;
- return (ticks - ifq_congestion <= (hz / 100));
+ diff = ticks - ifq_congestion;
+ if (diff < 0) {
+ ifq_congestion = ticks - hz;
+ return (0);
+ }
+
+ return (diff <= (hz / 100));
}
#define equal(a1, a2) \