git: b98f2ec0d635 - stable/13 - libpfctl: Fix endianness issues

Kristof Provost kp at FreeBSD.org
Mon Aug 23 15:38:13 UTC 2021


The branch stable/13 has been updated by kp:

URL: https://cgit.FreeBSD.org/src/commit/?id=b98f2ec0d635639987dcb6c6261f9013b35c3777

commit b98f2ec0d635639987dcb6c6261f9013b35c3777
Author:     Kristof Provost <kp at FreeBSD.org>
AuthorDate: 2021-08-20 11:43:15 +0000
Commit:     Kristof Provost <kp at FreeBSD.org>
CommitDate: 2021-08-23 14:19:39 +0000

    libpfctl: Fix endianness issues
    
    Several fields are supplied in big-endian format, so we need to convert
    them before we display them.
    
    MFC after:      3 days
    Sponsored by:   Rubicon Communications, LLC ("Netgate")
    
    (cherry picked from commit 719b5397c2887bc0619bb6ffb38f67f37bbf13c6)
---
 lib/libpfctl/libpfctl.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/lib/libpfctl/libpfctl.c b/lib/libpfctl/libpfctl.c
index ced130820d7d..7f1e72513018 100644
--- a/lib/libpfctl/libpfctl.c
+++ b/lib/libpfctl/libpfctl.c
@@ -671,11 +671,11 @@ pf_state_export_to_state(struct pfctl_state *ps, const struct pf_state_export *s
 	pf_state_peer_export_to_state_peer(&ps->src, &s->src);
 	pf_state_peer_export_to_state_peer(&ps->dst, &s->dst);
 	bcopy(&s->rt_addr, &ps->rt_addr, sizeof(ps->rt_addr));
-	ps->rule = s->rule;
-	ps->anchor = s->anchor;
-	ps->nat_rule = s->nat_rule;
-	ps->creation = s->creation;
-	ps->expire = s->expire;
+	ps->rule = ntohl(s->rule);
+	ps->anchor = ntohl(s->anchor);
+	ps->nat_rule = ntohl(s->nat_rule);
+	ps->creation = ntohl(s->creation);
+	ps->expire = ntohl(s->expire);
 	ps->packets[0] = s->packets[0];
 	ps->packets[1] = s->packets[1];
 	ps->bytes[0] = s->bytes[0];


More information about the dev-commits-src-all mailing list