From nobody Wed May 17 02:40:49 2023 X-Original-To: dev-commits-src-main@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 4QLcmK5P2fz4BlkN; Wed, 17 May 2023 02:40:49 +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 4QLcmK4tvQz3GQg; Wed, 17 May 2023 02:40:49 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1684291249; 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=GwgHYvLObnNWr4M8Oi85gYBeUjjb4K3ErNRAjl2tj6o=; b=SsRNzPukZuwr6u+Skr4WXXrveEWXIUYKilFj6RKfAZQMgq/9KATj//FapOfPQyUiXA8S2l 8LVYhUmXv2tijD9jTuUSyQuW6ntP1nzulJ8iGIfJWFEDEAJ+CU4qICiv9EaNo8hhFeqDUM 8XZ5xtPXhcFP/4hJj6g3VLCR45nwX8FXCwMUFQuafCj2jzhqj5Lbgj+TmomGxkngHdsfOE FEllNi3p7AyH01xQqwHISlIRZOAIRimkEyMmcVku8/faY9gvXUy5LKAMdWkPscADg1V2aE M/O1TF7iII5KFLJwab6dBWfX0exI94dzHLgyLHDnrvuRLF04wKo7iT9bJEkD6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1684291249; 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=GwgHYvLObnNWr4M8Oi85gYBeUjjb4K3ErNRAjl2tj6o=; b=r49nvCmgOp4vInG9BxqAv7pZUoZfAv7wuMJlGuI/H0J/1eCGi5XT0913o1/IR+i2h80rnV GM/ox8smAOTyIxqCmztEKUWoggXmJpuh68qpMgqHBYrGhIPGyMVXjKeKTGcOtTBgwuPH0O nPMh1XYduQV1OBnjV3x1wBB33v90JkP82c8yaV8dcMBue6xBr/D0b2SvOrbOfN7Vtqgin0 UiIRPwXMGyPCHoGfD5Jd2knFnNNu00Xbpef8mBE4KiMhkAg8x3/mTTXDZIK5hyrgFpsAGG KdXfGSwrcXR7WHJIwdcdTXWvSxpiwyVLK12yNpiwFvRcMzvkMAHNust0a1K0JA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1684291249; a=rsa-sha256; cv=none; b=Wdg1ElMxOyKLIK1ktch2hFORtVZjbfxVLIHMX4fPetVW3oY+WPZ7IBPiy4LDw9Pvmmqiha MC3PmMl29jHQJ86+Qekh8jf2p4LL6K1JhPiVFmePeBqMIFzgXac5mwyG1JaLWEnMxOgelI Jt7I9F1E5muWaFLyJpV60Y25bdpMX/X4Zjwa4+PyYfmlYoiJc0ds1ePs+DhA/SfKr+Tyul OXAFK4jM6TxQ1Vg0VC+BrlyNsjSC0ohMpdJtJSx9rSmSPLUmuQRxZBJSrFCGlSnLEfTqEp ugfjweqrPk90q8o1FvGib0H9sbjM6eMkyHKR3FabB5rSH9AXP14ccJvNvFqe5Q== 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 4QLcmK3yFYzmTS; Wed, 17 May 2023 02:40:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 34H2en1a021848; Wed, 17 May 2023 02:40:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 34H2enLQ021847; Wed, 17 May 2023 02:40:49 GMT (envelope-from git) Date: Wed, 17 May 2023 02:40:49 GMT Message-Id: <202305170240.34H2enLQ021847@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: cdc231bd4949 - main - pfsync: Remove deletion of states using the full pfsync_state struct List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@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/main X-Git-Reftype: branch X-Git-Commit: cdc231bd49498481801686913872c361dbc01f95 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=cdc231bd49498481801686913872c361dbc01f95 commit cdc231bd49498481801686913872c361dbc01f95 Author: Kajetan Staszkiewicz AuthorDate: 2023-05-15 19:43:06 +0000 Commit: Kristof Provost CommitDate: 2023-05-17 00:39:58 +0000 pfsync: Remove deletion of states using the full pfsync_state struct State deletions are sent over pfsync using struct pfsync_del_c. Remove the code for receiving state deletions using struct pfsync_state as such deletions are never sent. Rename functions and constants so that only the "compressed" versions remain. Reviewed by: kp Sponsored by: InnoGames GmbH Differential Revision: https://reviews.freebsd.org/D40004 --- sys/net/if_pfsync.h | 2 +- sys/netpfil/pf/if_pfsync.c | 44 ++++++-------------------------------------- 2 files changed, 7 insertions(+), 39 deletions(-) diff --git a/sys/net/if_pfsync.h b/sys/net/if_pfsync.h index bee247cd0a84..a13e26fd3bdf 100644 --- a/sys/net/if_pfsync.h +++ b/sys/net/if_pfsync.h @@ -274,7 +274,7 @@ struct pfsyncioc_nv { #define PFSYNC_S_IACK 0x01 #define PFSYNC_S_UPD 0x02 #define PFSYNC_S_UPD_C 0x03 -#define PFSYNC_S_DEL 0x04 +#define PFSYNC_S_DEL_C 0x04 #define PFSYNC_S_COUNT 0x05 #define PFSYNC_S_DEFER 0xfe diff --git a/sys/netpfil/pf/if_pfsync.c b/sys/netpfil/pf/if_pfsync.c index a7924d822eee..f53479283ecd 100644 --- a/sys/netpfil/pf/if_pfsync.c +++ b/sys/netpfil/pf/if_pfsync.c @@ -128,7 +128,6 @@ static int pfsync_in_iack(struct mbuf *, int, int, int); static int pfsync_in_upd(struct mbuf *, int, int, int); static int pfsync_in_upd_c(struct mbuf *, int, int, int); static int pfsync_in_ureq(struct mbuf *, int, int, int); -static int pfsync_in_del(struct mbuf *, int, int, int); static int pfsync_in_del_c(struct mbuf *, int, int, int); static int pfsync_in_bus(struct mbuf *, int, int, int); static int pfsync_in_tdb(struct mbuf *, int, int, int); @@ -142,7 +141,7 @@ static int (*pfsync_acts[])(struct mbuf *, int, int, int) = { pfsync_in_upd, /* PFSYNC_ACT_UPD */ pfsync_in_upd_c, /* PFSYNC_ACT_UPD_C */ pfsync_in_ureq, /* PFSYNC_ACT_UPD_REQ */ - pfsync_in_del, /* PFSYNC_ACT_DEL */ + pfsync_in_error, /* PFSYNC_ACT_DEL */ pfsync_in_del_c, /* PFSYNC_ACT_DEL_C */ pfsync_in_error, /* PFSYNC_ACT_INS_F */ pfsync_in_error, /* PFSYNC_ACT_DEL_F */ @@ -161,14 +160,14 @@ struct pfsync_q { static void pfsync_out_state(struct pf_kstate *, void *); static void pfsync_out_iack(struct pf_kstate *, void *); static void pfsync_out_upd_c(struct pf_kstate *, void *); -static void pfsync_out_del(struct pf_kstate *, void *); +static void pfsync_out_del_c(struct pf_kstate *, void *); static struct pfsync_q pfsync_qs[] = { { pfsync_out_state, sizeof(struct pfsync_state), PFSYNC_ACT_INS }, { pfsync_out_iack, sizeof(struct pfsync_ins_ack), PFSYNC_ACT_INS_ACK }, { pfsync_out_state, sizeof(struct pfsync_state), PFSYNC_ACT_UPD }, { pfsync_out_upd_c, sizeof(struct pfsync_upd_c), PFSYNC_ACT_UPD_C }, - { pfsync_out_del, sizeof(struct pfsync_del_c), PFSYNC_ACT_DEL_C } + { pfsync_out_del_c, sizeof(struct pfsync_del_c), PFSYNC_ACT_DEL_C } }; static void pfsync_q_ins(struct pf_kstate *, int, bool); @@ -1127,37 +1126,6 @@ pfsync_in_ureq(struct mbuf *m, int offset, int count, int flags) return (len); } -static int -pfsync_in_del(struct mbuf *m, int offset, int count, int flags) -{ - struct mbuf *mp; - struct pfsync_state *sa, *sp; - struct pf_kstate *st; - int len = count * sizeof(*sp); - int offp, i; - - mp = m_pulldown(m, offset, len, &offp); - if (mp == NULL) { - V_pfsyncstats.pfsyncs_badlen++; - return (-1); - } - sa = (struct pfsync_state *)(mp->m_data + offp); - - for (i = 0; i < count; i++) { - sp = &sa[i]; - - st = pf_find_state_byid(sp->id, sp->creatorid); - if (st == NULL) { - V_pfsyncstats.pfsyncs_badstate++; - continue; - } - st->state_flags |= PFSTATE_NOSYNC; - pf_unlink_state(st); - } - - return (len); -} - static int pfsync_in_del_c(struct mbuf *m, int offset, int count, int flags) { @@ -1526,7 +1494,7 @@ pfsync_out_upd_c(struct pf_kstate *st, void *buf) } static void -pfsync_out_del(struct pf_kstate *st, void *buf) +pfsync_out_del_c(struct pf_kstate *st, void *buf) { struct pfsync_del_c *dp = buf; @@ -2039,7 +2007,7 @@ pfsync_update_state_req(struct pf_kstate *st) case PFSYNC_S_INS: case PFSYNC_S_UPD: - case PFSYNC_S_DEL: + case PFSYNC_S_DEL_C: /* we're already handling it */ break; @@ -2089,7 +2057,7 @@ pfsync_delete_state(struct pf_kstate *st) /* FALLTHROUGH */ case PFSYNC_S_NONE: - pfsync_q_ins(st, PFSYNC_S_DEL, ref); + pfsync_q_ins(st, PFSYNC_S_DEL_C, ref); break; default: