summaryrefslogtreecommitdiffstats
path: root/sys/netpfil
diff options
context:
space:
mode:
authorglebius <glebius@FreeBSD.org>2012-10-02 12:44:46 +0000
committerglebius <glebius@FreeBSD.org>2012-10-02 12:44:46 +0000
commit7cce4fce1beff71378f312aeb9cb5475f5405b3a (patch)
tree078e999e1a63c41fd8c4140c6f012fe19904e866 /sys/netpfil
parentaa29abaca0ee9a5160d0b057e8c2fc51e2085707 (diff)
downloadFreeBSD-src-7cce4fce1beff71378f312aeb9cb5475f5405b3a.zip
FreeBSD-src-7cce4fce1beff71378f312aeb9cb5475f5405b3a.tar.gz
To reduce volume of pfsync traffic:
- Scan request update queue to prevent doubles. - Do not push undersized daragram in pfsync_update_request().
Diffstat (limited to 'sys/netpfil')
-rw-r--r--sys/netpfil/pf/if_pfsync.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/sys/netpfil/pf/if_pfsync.c b/sys/netpfil/pf/if_pfsync.c
index fabc1ab..505d9a7 100644
--- a/sys/netpfil/pf/if_pfsync.c
+++ b/sys/netpfil/pf/if_pfsync.c
@@ -1832,9 +1832,15 @@ pfsync_request_update(u_int32_t creatorid, u_int64_t id)
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 creatorid, u_int64_t id)
TAILQ_INSERT_TAIL(&sc->sc_upd_req_list, item, ur_entry);
sc->sc_len += nlen;
-
- pfsync_push(sc);
}
static void
OpenPOWER on IntegriCloud