summaryrefslogtreecommitdiffstats
path: root/sys/contrib
diff options
context:
space:
mode:
authorglebius <glebius@FreeBSD.org>2011-10-23 15:08:18 +0000
committerglebius <glebius@FreeBSD.org>2011-10-23 15:08:18 +0000
commit7df2cbe8bc5c4b639ec45a8b2a3b18b7fe9dd6a1 (patch)
tree843d705d44a301b1ad545954362eddee856c2894 /sys/contrib
parentaaf1597b1d9ef18f687ca892c430b613a9b69c3a (diff)
downloadFreeBSD-src-7df2cbe8bc5c4b639ec45a8b2a3b18b7fe9dd6a1.zip
FreeBSD-src-7df2cbe8bc5c4b639ec45a8b2a3b18b7fe9dd6a1.tar.gz
- Fix a bad typo (FreeBSD specific) in pfsync_bulk_update(). Instead
of scheduling next run pfsync_bulk_update(), pfsync_bulk_fail() was scheduled. This lead to instant 100% state leak after first bulk update request. - After above fix, it appeared that pfsync_bulk_update() lacks locking. To fix this, sc_bulk_tmo callout was converted to an mtx one. Eventually, all pf/pfsync callouts should be converted to mtx version, since it isn't possible to stop or drain a non-mtx callout without risk of race. - Add comment that callout_stop() in pfsync_clone_destroy() lacks locking. Since pfsync0 can't be destroyed (yet), let it be here.
Diffstat (limited to 'sys/contrib')
-rw-r--r--sys/contrib/pf/net/if_pfsync.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/contrib/pf/net/if_pfsync.c b/sys/contrib/pf/net/if_pfsync.c
index 2a7c434..54d470e 100644
--- a/sys/contrib/pf/net/if_pfsync.c
+++ b/sys/contrib/pf/net/if_pfsync.c
@@ -493,7 +493,7 @@ pfsync_clone_create(struct if_clone *ifc, int unit)
ifp->if_mtu = 1500; /* XXX */
#ifdef __FreeBSD__
callout_init(&sc->sc_tmo, CALLOUT_MPSAFE);
- callout_init(&sc->sc_bulk_tmo, CALLOUT_MPSAFE);
+ callout_init_mtx(&sc->sc_bulk_tmo, &pf_task_mtx, 0);
callout_init(&sc->sc_bulkfail_tmo, CALLOUT_MPSAFE);
#else
ifp->if_hardmtu = MCLBYTES; /* XXX */
@@ -540,7 +540,7 @@ pfsync_clone_destroy(struct ifnet *ifp)
#ifdef __FreeBSD__
EVENTHANDLER_DEREGISTER(ifnet_departure_event, sc->sc_detachtag);
#endif
- timeout_del(&sc->sc_bulk_tmo);
+ timeout_del(&sc->sc_bulk_tmo); /* XXX: need PF_LOCK() before */
timeout_del(&sc->sc_tmo);
#if NCARP > 0
#ifdef notyet
@@ -3061,7 +3061,7 @@ pfsync_bulk_update(void *arg)
sc->sc_bulk_next = st;
#ifdef __FreeBSD__
callout_reset(&sc->sc_bulk_tmo, 1,
- pfsync_bulk_fail, sc);
+ pfsync_bulk_update, sc);
#else
timeout_add(&sc->sc_bulk_tmo, 1);
#endif
OpenPOWER on IntegriCloud