git: c56650fd791d - main - pf: add a pointer to the protocol checksum header field to pf_pdesc
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 12 Feb 2025 19:39:05 UTC
The branch main has been updated by kp:
URL: https://cgit.FreeBSD.org/src/commit/?id=c56650fd791dbaa4a5c677bdac6cff3d4027264a
commit c56650fd791dbaa4a5c677bdac6cff3d4027264a
Author: Kristof Provost <kp@FreeBSD.org>
AuthorDate: 2025-02-05 16:40:00 +0000
Commit: Kristof Provost <kp@FreeBSD.org>
CommitDate: 2025-02-12 19:38:38 +0000
pf: add a pointer to the protocol checksum header field to pf_pdesc
Set it up in pf_setup_pdesc(). ok ryan benno mikeb bluhm
Obtained from: OpenBSD, henning <henning@openbsd.org>, 14255d4d87
Sponsored by: Rubicon Communications, LLC ("Netgate")
---
sys/net/pfvar.h | 1 +
sys/netpfil/pf/pf.c | 3 +++
2 files changed, 4 insertions(+)
diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h
index 65be1a0ce19b..d4c3831b49f8 100644
--- a/sys/net/pfvar.h
+++ b/sys/net/pfvar.h
@@ -1614,6 +1614,7 @@ struct pf_pdesc {
struct pf_addr *src; /* src address */
struct pf_addr *dst; /* dst address */
+ u_int16_t *pcksum; /* proto cksum */
u_int16_t *sport;
u_int16_t *dport;
u_int16_t osport;
diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c
index 874fd0678f7a..3957d39edc13 100644
--- a/sys/netpfil/pf/pf.c
+++ b/sys/netpfil/pf/pf.c
@@ -10090,6 +10090,7 @@ pf_setup_pdesc(sa_family_t af, int dir, struct pf_pdesc *pd, struct mbuf **m0,
pd->p_len = pd->tot_len - pd->off - (th->th_off << 2);
pd->sport = &th->th_sport;
pd->dport = &th->th_dport;
+ pd->pcksum = &th->th_sum;
break;
}
case IPPROTO_UDP: {
@@ -10111,6 +10112,7 @@ pf_setup_pdesc(sa_family_t af, int dir, struct pf_pdesc *pd, struct mbuf **m0,
}
pd->sport = &uh->uh_sport;
pd->dport = &uh->uh_dport;
+ pd->pcksum = &uh->uh_sum;
break;
}
case IPPROTO_SCTP: {
@@ -10176,6 +10178,7 @@ pf_setup_pdesc(sa_family_t af, int dir, struct pf_pdesc *pd, struct mbuf **m0,
return (-1);
}
pd->hdrlen = icmp_hlen;
+ pd->pcksum = &pd->hdr.icmp.icmp_cksum;
break;
}
#endif