git: 9414b8dbf1e4 - main - pf: unify some IPv4/IPv6 code in pf_setup_pdesc()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 10 Oct 2024 12:37:25 UTC
The branch main has been updated by kp:
URL: https://cgit.FreeBSD.org/src/commit/?id=9414b8dbf1e44491a29bf3f64d88d094b71215dd
commit 9414b8dbf1e44491a29bf3f64d88d094b71215dd
Author: Kristof Provost <kp@FreeBSD.org>
AuthorDate: 2024-10-02 13:22:57 +0000
Commit: Kristof Provost <kp@FreeBSD.org>
CommitDate: 2024-10-10 12:10:41 +0000
pf: unify some IPv4/IPv6 code in pf_setup_pdesc()
Obtained from: OpenBSD, bluhm <bluhm@openbsd.org>, 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);