From 889ad0384e016610ee9b60b7f36b42da35b3e346 Mon Sep 17 00:00:00 2001
From: Max Laier <mlaier@FreeBSD.org>
Date: Sun, 26 Jun 2005 21:00:52 +0000
Subject: [PATCH] Properly initialize ifq_maxlen for the defered send queue and
 make it actually work.  Also use the right semantics for IF_HANDOFF to get
 correct stats.

Reported and tested by:	Sascha Luck <sascha at c4inet dot net>
Approved by:		re (blanket)
---
 sys/contrib/pf/net/if_pfsync.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sys/contrib/pf/net/if_pfsync.c b/sys/contrib/pf/net/if_pfsync.c
index 223951386ad0..76af30581a9a 100644
--- a/sys/contrib/pf/net/if_pfsync.c
+++ b/sys/contrib/pf/net/if_pfsync.c
@@ -224,6 +224,7 @@ pfsync_clone_create(struct if_clone *ifc, int unit)
 	callout_init(&sc->sc_bulk_tmo, NET_CALLOUT_MPSAFE);
 	callout_init(&sc->sc_bulkfail_tmo, NET_CALLOUT_MPSAFE);
 	callout_init(&sc->sc_send_tmo, NET_CALLOUT_MPSAFE);
+	sc->sc_ifq.ifq_maxlen = ifqmaxlen;
 	mtx_init(&sc->sc_ifq.ifq_mtx, ifp->if_xname, "pfsync send queue",
 	    MTX_DEF);
 	if_attach(ifp);
@@ -1797,7 +1798,7 @@ pfsync_sendout(sc)
 
 		pfsyncstats.pfsyncs_opackets++;
 #ifdef __FreeBSD__
-		if (IF_HANDOFF(&sc->sc_ifq, m, NULL))
+		if (!IF_HANDOFF(&sc->sc_ifq, m, NULL))
 			pfsyncstats.pfsyncs_oerrors++;
 		callout_reset(&sc->sc_send_tmo, 1, pfsync_senddef, sc);
 #else