git: 435e9214478c - main - pf: remove _unaligned from pf_patch_(16|32)_unaligned()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 16 Apr 2025 18:02:59 UTC
The branch main has been updated by kp:
URL: https://cgit.FreeBSD.org/src/commit/?id=435e9214478cdc120fff555e51e6b334dbc64857
commit 435e9214478cdc120fff555e51e6b334dbc64857
Author: Kristof Provost <kp@FreeBSD.org>
AuthorDate: 2025-04-16 12:21:16 +0000
Commit: Kristof Provost <kp@FreeBSD.org>
CommitDate: 2025-04-16 14:23:49 +0000
pf: remove _unaligned from pf_patch_(16|32)_unaligned()
This is the only variant of the function, appending _unaligned does not clarify
anything.
Sponsored by: Rubicon Communications, LLC ("Netgate")
---
sys/net/pfvar.h | 4 ++--
sys/netpfil/pf/pf.c | 8 ++++----
sys/netpfil/pf/pf_norm.c | 6 +++---
3 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h
index b216b888832f..c7a2bde63184 100644
--- a/sys/net/pfvar.h
+++ b/sys/net/pfvar.h
@@ -2453,8 +2453,8 @@ void pf_change_a(void *, u_int16_t *, u_int32_t, u_int8_t);
void pf_change_proto_a(struct mbuf *, void *, u_int16_t *, u_int32_t,
u_int8_t);
void pf_change_tcp_a(struct mbuf *, void *, u_int16_t *, u_int32_t);
-void pf_patch_16_unaligned(struct pf_pdesc *, void *, u_int16_t, bool);
-void pf_patch_32_unaligned(struct pf_pdesc *, void *, u_int32_t, bool);
+void pf_patch_16(struct pf_pdesc *, void *, u_int16_t, bool);
+void pf_patch_32(struct pf_pdesc *, void *, u_int32_t, bool);
void pf_send_deferred_syn(struct pf_kstate *);
int pf_match_addr(u_int8_t, const struct pf_addr *,
const struct pf_addr *, const struct pf_addr *, sa_family_t);
diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c
index 24963d010e04..5d16af6c6d4b 100644
--- a/sys/netpfil/pf/pf.c
+++ b/sys/netpfil/pf/pf.c
@@ -3234,7 +3234,7 @@ pf_patch_8(struct pf_pdesc *pd, u_int8_t *f, u_int8_t v, bool hi)
}
void
-pf_patch_16_unaligned(struct pf_pdesc *pd, void *f, u_int16_t v, bool hi)
+pf_patch_16(struct pf_pdesc *pd, void *f, u_int16_t v, bool hi)
{
u_int8_t *fb = (u_int8_t *)f;
u_int8_t *vb = (u_int8_t *)&v;
@@ -3244,7 +3244,7 @@ pf_patch_16_unaligned(struct pf_pdesc *pd, void *f, u_int16_t v, bool hi)
}
void
-pf_patch_32_unaligned(struct pf_pdesc *pd, void *f, u_int32_t v, bool hi)
+pf_patch_32(struct pf_pdesc *pd, void *f, u_int32_t v, bool hi)
{
u_int8_t *fb = (u_int8_t *)f;
u_int8_t *vb = (u_int8_t *)&v;
@@ -3950,11 +3950,11 @@ pf_modulate_sack(struct pf_pdesc *pd, struct tcphdr *th,
for (i = 2; i + TCPOLEN_SACK <= olen;
i += TCPOLEN_SACK) {
memcpy(&sack, &opt[i], sizeof(sack));
- pf_patch_32_unaligned(pd,
+ pf_patch_32(pd,
&sack.start,
htonl(ntohl(sack.start) - dst->seqdiff),
PF_ALGNMNT(startoff));
- pf_patch_32_unaligned(pd,
+ pf_patch_32(pd,
&sack.end,
htonl(ntohl(sack.end) - dst->seqdiff),
PF_ALGNMNT(startoff));
diff --git a/sys/netpfil/pf/pf_norm.c b/sys/netpfil/pf/pf_norm.c
index 10e740d33b0d..783e48627c0f 100644
--- a/sys/netpfil/pf/pf_norm.c
+++ b/sys/netpfil/pf/pf_norm.c
@@ -1633,7 +1633,7 @@ pf_normalize_tcp_stateful(struct pf_pdesc *pd,
(src->scrub->pfss_flags &
PFSS_TIMESTAMP)) {
tsval = ntohl(tsval);
- pf_patch_32_unaligned(pd,
+ pf_patch_32(pd,
&opt[2],
htonl(tsval +
src->scrub->pfss_ts_mod),
@@ -1649,7 +1649,7 @@ pf_normalize_tcp_stateful(struct pf_pdesc *pd,
PFSS_TIMESTAMP)) {
tsecr = ntohl(tsecr)
- dst->scrub->pfss_ts_mod;
- pf_patch_32_unaligned(pd,
+ pf_patch_32(pd,
&opt[6],
htonl(tsecr),
PF_ALGNMNT(startoff));
@@ -1974,7 +1974,7 @@ pf_normalize_mss(struct pf_pdesc *pd)
case TCPOPT_MAXSEG:
mss = (u_int16_t *)(optp + 2);
if ((ntohs(*mss)) > pd->act.max_mss) {
- pf_patch_16_unaligned(pd,
+ pf_patch_16(pd,
mss, htons(pd->act.max_mss),
PF_ALGNMNT(startoff));
m_copyback(pd->m, pd->off + sizeof(*th),