To reduce volume of pfsync traffic:

- Scan request update queue to prevent doubles.
- Do not push undersized daragram in pfsync_update_request().
This commit is contained in:
Gleb Smirnoff 2012-10-02 12:44:46 +00:00
parent b3aa419331
commit aa955cb5b8
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=241131

View File

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