svn commit: r241131 - head/sys/netpfil/pf
Gleb Smirnoff
glebius at FreeBSD.org
Tue Oct 2 12:44:47 UTC 2012
Author: glebius
Date: Tue Oct 2 12:44:46 2012
New Revision: 241131
URL: http://svn.freebsd.org/changeset/base/241131
Log:
To reduce volume of pfsync traffic:
- Scan request update queue to prevent doubles.
- Do not push undersized daragram in pfsync_update_request().
Modified:
head/sys/netpfil/pf/if_pfsync.c
Modified: head/sys/netpfil/pf/if_pfsync.c
==============================================================================
--- head/sys/netpfil/pf/if_pfsync.c Tue Oct 2 12:25:30 2012 (r241130)
+++ head/sys/netpfil/pf/if_pfsync.c Tue Oct 2 12:44:46 2012 (r241131)
@@ -1832,9 +1832,15 @@ pfsync_request_update(u_int32_t creatori
PFSYNC_LOCK_ASSERT(sc);
/*
- * This code does nothing to prevent multiple update requests for the
- * same state being generated.
+ * This code does a bit to prevent multiple update requests for the
+ * same state being generated. It searches current subheader queue,
+ * but it doesn't lookup into queue of already packed datagrams.
*/
+ TAILQ_FOREACH(item, &sc->sc_upd_req_list, ur_entry)
+ if (item->ur_msg.id == id &&
+ item->ur_msg.creatorid == creatorid)
+ return;
+
item = malloc(sizeof(*item), M_PFSYNC, M_NOWAIT);
if (item == NULL)
return; /* XXX stats */
@@ -1854,8 +1860,6 @@ pfsync_request_update(u_int32_t creatori
TAILQ_INSERT_TAIL(&sc->sc_upd_req_list, item, ur_entry);
sc->sc_len += nlen;
-
- pfsync_push(sc);
}
static void
More information about the svn-src-all
mailing list