From nobody Thu Oct 10 12:37:25 2024 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 4XPTmP6kFDz5Yyr4; Thu, 10 Oct 2024 12:37:25 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4XPTmP4fpMz4H9Z; Thu, 10 Oct 2024 12:37:25 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1728563845; 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=XC4D2AvWhqSY5ujq8Uji5QOFkdBotKdIazOpOeDzT3s=; b=Z7EeG2TVcIZ2kZcZP/w5hAjFXO7y74WHlNJh3YWbg9nI08dtpYB4O15yO75ysr4P/ITcCn 9MiyHWZjPjMbRIzv9g1nhqGJq3EntJ5JVBKPa/69JzEKa9QoJNkdobFuY+hbd+zJ/2CRuv O2OuA5G0gMFXqSPqxZiTVO4FYtfTVane261WllZvygcyc4Det4b1PHwp6BYxnEhA6LRP1K vb8rTREBEl/gby6D+GqgBh5oc/+0eQqyHddnO784E/P7NytVvV8z9pbjIi0qu5GXBL7Fye FPv8kXW0d5o6+CTIXvu16LOTfcYf9at9R3ASgZq78Rgk9RlcP16i6R+9TFxVbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1728563845; 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=XC4D2AvWhqSY5ujq8Uji5QOFkdBotKdIazOpOeDzT3s=; b=oPoEBj35nOANdI6Twxzi4RCCuAXZ0cp4hSoC2gH8i1htjsd3j5WCWl+AyBxWzWEcyOZ53v kFKey2jJkC3gmEohABWJr8GeDeTZwRkA8K4qxSLdGM9OmCTioHFVtT9+v4+E3fWK+GxFtb pdURxGaGETpvTBzdDEZdzw+IrLJGBn0iAGmG6vx8fatIMlmoFzPRYkD+0Z4x+i/HPmD/UO VONvTfJfy8LM7pRT5tzEqGOGS2lYw018j5C3YFsQiURjCbKxnw6aVfmCqa2I8QSi+PPRYI kr0D9ZaMugWlFnKJ6OSBoNvl54YbVCsUgvgNVhFaZJKEuihj3PC5nbXEACWrGA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1728563845; a=rsa-sha256; cv=none; b=KYcOX6F3Hx5e+F3no97WBtQVfls5FeE3R4mG67gR7DR9ed18NWg59C+i1uXoCpCoNe9+qC zK8xkUBAJa+M3oDnye348fFc1Xm8kZt8hXi9h72BHr+MvxNvpaR1t/mbNS7QYqFsU9OrMs f/Wvo02SQqD/XxVyaDOcUfJBdGTP0VqyUiZbd8DSldjsFqV6W9btaPcEADWm8Iy2CPNySe mFspiRFGOqSvrJ1S6EBKo3a9UmTjhhePWViCeir7pqLsMi1HADsT56r5TnavT/dH7Vnl0Y D5SSSe2jvXq/Y3JYCxAdyr1px3C32BV+Q2N/GFwh0yF7RB5JVF1BkZzGjNpVSg== 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 4XPTmP4GvVzxrh; Thu, 10 Oct 2024 12:37:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 49ACbPGi006600; Thu, 10 Oct 2024 12:37:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 49ACbPss006597; Thu, 10 Oct 2024 12:37:25 GMT (envelope-from git) Date: Thu, 10 Oct 2024 12:37:25 GMT Message-Id: <202410101237.49ACbPss006597@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: 9414b8dbf1e4 - main - pf: unify some IPv4/IPv6 code in pf_setup_pdesc() 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: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-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: 9414b8dbf1e44491a29bf3f64d88d094b71215dd Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=9414b8dbf1e44491a29bf3f64d88d094b71215dd commit 9414b8dbf1e44491a29bf3f64d88d094b71215dd Author: Kristof Provost AuthorDate: 2024-10-02 13:22:57 +0000 Commit: Kristof Provost CommitDate: 2024-10-10 12:10:41 +0000 pf: unify some IPv4/IPv6 code in pf_setup_pdesc() Obtained from: OpenBSD, bluhm , c62e803e5c Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D46936 --- sys/netpfil/pf/pf.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index 26820f233cdb..669539e9e997 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -8640,6 +8640,10 @@ pf_setup_pdesc(sa_family_t af, int dir, struct pf_pdesc *pd, struct mbuf **m0, pd->af = af; pd->dir = dir; + pd->sidx = (dir == PF_IN) ? 0 : 1; + pd->didx = (dir == PF_IN) ? 1 : 0; + *off = 0; + *hdrlen = 0; TAILQ_INIT(&pd->sctp_multihome_jobs); if (default_actions != NULL) @@ -8680,13 +8684,9 @@ pf_setup_pdesc(sa_family_t af, int dir, struct pf_pdesc *pd, struct mbuf **m0, } pd->src = (struct pf_addr *)&h->ip_src; pd->dst = (struct pf_addr *)&h->ip_dst; - pd->sport = pd->dport = NULL; pd->ip_sum = &h->ip_sum; pd->proto_sum = NULL; pd->virtual_proto = pd->proto = h->ip_p; - pd->dir = dir; - pd->sidx = (dir == PF_IN) ? 0 : 1; - pd->didx = (dir == PF_IN) ? 1 : 0; pd->tos = h->ip_tos; pd->ttl = h->ip_ttl; pd->tot_len = ntohs(h->ip_len); @@ -8729,12 +8729,8 @@ pf_setup_pdesc(sa_family_t af, int dir, struct pf_pdesc *pd, struct mbuf **m0, h = mtod(m, struct ip6_hdr *); pd->src = (struct pf_addr *)&h->ip6_src; pd->dst = (struct pf_addr *)&h->ip6_dst; - pd->sport = pd->dport = NULL; pd->ip_sum = NULL; pd->proto_sum = NULL; - pd->dir = dir; - pd->sidx = (dir == PF_IN) ? 0 : 1; - pd->didx = (dir == PF_IN) ? 1 : 0; pd->tos = IPV6_DSCP(h); pd->ttl = h->ip6_hlim; pd->tot_len = ntohs(h->ip6_plen) + sizeof(struct ip6_hdr);