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)
This commit is contained in:
Max Laier 2005-06-26 21:00:52 +00:00
parent d446f3569c
commit 889ad0384e

View File

@ -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