From nobody Mon Apr 01 07:34:38 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4V7N7f5bW3z5Fqpd; Mon, 1 Apr 2024 07:34:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4V7N7f44fLz4kPf; Mon, 1 Apr 2024 07:34:38 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1711956878; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=XiiJ6KkCKWoyrNANwywbwhzpWXUwx6zyEW4YlL4zNBg=; b=fW+cCjABCWgu7afhUMRZiaCnMKqoisHVJBezz4mMYW77nO8i6kVfV9mK0UED6PuDHNe0gq eyDkls4BCBMDmpBBuaVNObGpw6jLw8bTpdU8bvirtoA6bmspeO/KpeV58KomRAwhbSc1b2 HctYYcSqC373HlPF3AVV3GysfJ3DSAk6PxY1OdNl8RsChh2tEtvukVxxo3bn8n6CaoE70I 5hMGTrlfSVexDyXsxw/T3hZWbMrMS/4b/AEyXYQNwG/GiC1eNgJ5Mx/+WUUNz2RItLyEI8 FjvyZPk3fUsLGjD33S9pRm2auum9WnX94agjyCzNSPb9G5Gc5kgQ77RZhnQZ5w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1711956878; a=rsa-sha256; cv=none; b=yp6hK2dHWTg+Oy0s1fUj5XFFMtMHQreTdepdOs5vfj51C6MLMz6Z3/VzpgeZRTPdqbkqc+ 4h39IP9+tjO95wyi0kNlUPNLYhcWsO6ZbulBbKl+TMwXKQU1/2o9zBbCMFNh4TLSwBxFZD osrsp4S7E6atEoLxRVheCQpVqV3NkRr8qv8Tc7Ocn68ihgomiRhpP7XC3BY++qO8Z6Ngio dbM9rZ/e50Zc0EXJ+A9HA6YxmTNIrGyQawIjCLNj7S+RajT6iNG1bcmrG9Y2GcOhBXAfA+ 1agYyz3DJCpS1ApfEYZHxLSo9qho65DdFR6MoIBjO7GOxxwcgTleCzmjjTmcwQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1711956878; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=XiiJ6KkCKWoyrNANwywbwhzpWXUwx6zyEW4YlL4zNBg=; b=RUxWTcaVD6t7SouMP7rhz60Qxs/Cx6uriSG2LhwZQTTz7DFiwVJy4h7L/c4cZC9DjlU2RP yPVc5SWD2R+fk8SxQKTNqari/lePYTNqcHGVD24B+eWI9HS5yvrytuSRzSRS+v+aCYChd7 /IFyWKae7kF0RZCF0/dOpMnaXIaGdlGb3OJEQFBjNhyQcJoH71I4vWBa8h8jwDbTHc5hvr 83VCNzKrvLHgRdXREDHFToYby3H08rsAkaSedqBrWd1+Ej/oDvTy+hxPZxaOhDX5lcuKkz zNA+cugpt90LnTTls7ovp0IpTxT6NEV2z24uNdvYwkAX+w9OtK89ApjUg7+5wA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4V7N7f3hxcz1C44; Mon, 1 Apr 2024 07:34:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 4317Ycve037880; Mon, 1 Apr 2024 07:34:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 4317YcMv037877; Mon, 1 Apr 2024 07:34:38 GMT (envelope-from git) Date: Mon, 1 Apr 2024 07:34:38 GMT Message-Id: <202404010734.4317YcMv037877@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: ab872ab0bf19 - stable/14 - pfsync: cope with multiple pending plus messages List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: ab872ab0bf195e872ed8d955aab3b2a537a230cd Auto-Submitted: auto-generated The branch stable/14 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=ab872ab0bf195e872ed8d955aab3b2a537a230cd commit ab872ab0bf195e872ed8d955aab3b2a537a230cd Author: Kristof Provost AuthorDate: 2024-03-24 15:08:52 +0000 Commit: Kristof Provost CommitDate: 2024-04-01 07:33:32 +0000 pfsync: cope with multiple pending plus messages It's possible for pfsync to add a plus message when one is already queued. Append both, rather than overwriting the already pending one. MFC after: 1 week (cherry picked from commit caccf6d3c008d3c778986734c2705cdae849a877) --- sys/netpfil/pf/if_pfsync.c | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/sys/netpfil/pf/if_pfsync.c b/sys/netpfil/pf/if_pfsync.c index 5df5824c93b8..def06cd0c113 100644 --- a/sys/netpfil/pf/if_pfsync.c +++ b/sys/netpfil/pf/if_pfsync.c @@ -239,7 +239,7 @@ struct pfsync_bucket TAILQ_HEAD(, pfsync_upd_req_item) b_upd_req_list; TAILQ_HEAD(, pfsync_deferral) b_deferrals; u_int b_deferred; - void *b_plus; + uint8_t *b_plus; size_t b_pluslen; struct ifaltq b_snd; @@ -476,6 +476,7 @@ pfsync_clone_destroy(struct ifnet *ifp) free(b->b_plus, M_PFSYNC); b->b_plus = NULL; + b->b_pluslen = 0; callout_drain(&b->b_tmo); } @@ -1771,6 +1772,7 @@ pfsync_drop(struct pfsync_softc *sc) b->b_len = PFSYNC_MINPKT; free(b->b_plus, M_PFSYNC); b->b_plus = NULL; + b->b_pluslen = 0; } } @@ -1912,6 +1914,7 @@ pfsync_sendout(int schedswi, int c) free(b->b_plus, M_PFSYNC); b->b_plus = NULL; + b->b_pluslen = 0; } subh = (struct pfsync_subheader *)(m->m_data + offset); @@ -2565,20 +2568,28 @@ pfsync_send_plus(void *plus, size_t pluslen) { struct pfsync_softc *sc = V_pfsyncif; struct pfsync_bucket *b = &sc->sc_buckets[0]; + uint8_t *newplus; PFSYNC_BUCKET_LOCK(b); - MPASS(b->b_plus == NULL); - if (b->b_len + pluslen > sc->sc_ifp->if_mtu) pfsync_sendout(1, b->b_id); - b->b_plus = malloc(pluslen, M_PFSYNC, M_NOWAIT); - if (b->b_plus == NULL) + newplus = malloc(pluslen + b->b_pluslen, M_PFSYNC, M_NOWAIT); + if (newplus == NULL) goto out; - memcpy(b->b_plus, plus, pluslen); - b->b_len += (b->b_pluslen = pluslen); + if (b->b_plus != NULL) { + memcpy(newplus, b->b_plus, b->b_pluslen); + free(b->b_plus, M_PFSYNC); + } else { + MPASS(b->b_pluslen == 0); + } + memcpy(newplus + b->b_pluslen, plus, pluslen); + + b->b_plus = newplus; + b->b_pluslen += pluslen; + b->b_len += pluslen; pfsync_sendout(1, b->b_id);