aboutsummaryrefslogtreecommitdiff
path: root/sys/contrib/pf
diff options
context:
space:
mode:
authorGleb Smirnoff <glebius@FreeBSD.org>2011-12-22 18:56:27 +0000
committerGleb Smirnoff <glebius@FreeBSD.org>2011-12-22 18:56:27 +0000
commite3b670692add9964eacc62e6d3d88e6315bb2a1e (patch)
tree1dc0e3cc8d9c4973ba3967e752dbd15858951cd8 /sys/contrib/pf
parentc5360c2998ea6c8fc560c363851bbfc24bc5ef30 (diff)
downloadsrc-e3b670692add9964eacc62e6d3d88e6315bb2a1e.tar.gz
src-e3b670692add9964eacc62e6d3d88e6315bb2a1e.zip
Merge couple more fixes from OpenBSD to bulk processing:
revision 1.118 date: 2009/03/23 06:19:59; author: dlg; state: Exp; lines: +8 -6 wait an appropriate amount of time before giving up on a bulk update, rather than giving up after a hardcoded 5 seconds (which is generally much too short an interval for a bulk update). pointed out by david@, eyeballed by mcbride@ revision 1.171 date: 2011/10/31 22:02:52; author: mikeb; state: Exp; lines: +2 -1 Don't forget to cancel bulk update failure timeout when destroying an interface. Problem report and fix from Erik Lax, thanks! Start a brief note of revisions merged from OpenBSD.
Notes
Notes: svn path=/head/; revision=228814
Diffstat (limited to 'sys/contrib/pf')
-rw-r--r--sys/contrib/pf/net/if_pfsync.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/sys/contrib/pf/net/if_pfsync.c b/sys/contrib/pf/net/if_pfsync.c
index a384378a6ac2..2407e71777ea 100644
--- a/sys/contrib/pf/net/if_pfsync.c
+++ b/sys/contrib/pf/net/if_pfsync.c
@@ -42,6 +42,11 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
+/*
+ * Revisions picked from OpenBSD after revision 1.110 import:
+ * 1.118, 1.124, 1.148, 1.149, 1.151, 1.171 - fixes to bulk updates
+ */
+
#ifdef __FreeBSD__
#include "opt_inet.h"
#include "opt_inet6.h"
@@ -536,6 +541,7 @@ pfsync_clone_destroy(struct ifnet *ifp)
EVENTHANDLER_DEREGISTER(ifnet_departure_event, sc->sc_detachtag);
PF_LOCK();
#endif
+ timeout_del(&sc->sc_bulkfail_tmo);
timeout_del(&sc->sc_bulk_tmo);
timeout_del(&sc->sc_tmo);
#ifdef __FreeBSD__
@@ -1604,14 +1610,16 @@ pfsync_in_bus(struct pfsync_pkt *pkt, struct mbuf *m, int offset, int count)
switch (bus->status) {
case PFSYNC_BUS_START:
#ifdef __FreeBSD__
- callout_reset(&sc->sc_bulkfail_tmo, 5 * hz, pfsync_bulk_fail,
- V_pfsyncif);
+ callout_reset(&sc->sc_bulkfail_tmo, 4 * hz +
+ pf_pool_limits[PF_LIMIT_STATES].limit /
+ ((sc->sc_sync_if->if_mtu - PFSYNC_MINPKT) /
+ sizeof(struct pfsync_state)),
+ pfsync_bulk_fail, V_pfsyncif);
#else
- timeout_add_sec(&sc->sc_bulkfail_tmo, 5); /* XXX magic */
-#endif
-#ifdef XXX
+ timeout_add(&sc->sc_bulkfail_tmo, 4 * hz +
pf_pool_limits[PF_LIMIT_STATES].limit /
- (PFSYNC_BULKPACKETS * sc->sc_maxcount));
+ ((sc->sc_if.if_mtu - PFSYNC_MINPKT) /
+ sizeof(struct pfsync_state)));
#endif
#ifdef __FreeBSD__
if (V_pf_status.debug >= PF_DEBUG_MISC)