git: a2c918232cc8 - main - net/relayd: fix build on big-endian architectures

From: Piotr Kubaj <pkubaj_at_FreeBSD.org>
Date: Wed, 03 Sep 2025 09:21:23 UTC
The branch main has been updated by pkubaj:

URL: https://cgit.FreeBSD.org/ports/commit/?id=a2c918232cc82cc100a718cdb49edcb351a2b056

commit a2c918232cc82cc100a718cdb49edcb351a2b056
Author:     Piotr Kubaj <pkubaj@FreeBSD.org>
AuthorDate: 2025-09-02 12:09:31 +0000
Commit:     Piotr Kubaj <pkubaj@FreeBSD.org>
CommitDate: 2025-09-03 09:21:17 +0000

    net/relayd: fix build on big-endian architectures
    
    siphash.c:67:7: error: incompatible pointer to integer conversion passing 'const u_int64_t *' (aka 'const unsigned long *') to parameter of type 'unsigned long' [-Wint-conversion]
       67 |         k0 = le64toh(&key->k0);
          |              ^~~~~~~~~~~~~~~~~
    /usr/include/sys/_endian.h:130:30: note: expanded from macro 'le64toh'
      130 | #define le64toh(x)      __bswap64((x))
          |                         ~~~~~~~~~~^~~~
    /usr/include/sys/_endian.h:85:40: note: expanded from macro '__bswap64'
       85 | #define __bswap64(x)    __builtin_bswap64(x)
          |                                           ^
    siphash.c:68:7: error: incompatible pointer to integer conversion passing 'const u_int64_t *' (aka 'const unsigned long *') to parameter of type 'unsigned long' [-Wint-conversion]
       68 |         k1 = le64toh(&key->k1);
          |              ^~~~~~~~~~~~~~~~~
    /usr/include/sys/_endian.h:130:30: note: expanded from macro 'le64toh'
      130 | #define le64toh(x)      __bswap64((x))
          |                         ~~~~~~~~~~^~~~
    /usr/include/sys/_endian.h:85:40: note: expanded from macro '__bswap64'
       85 | #define __bswap64(x)    __builtin_bswap64(x)
          |                                           ^
    siphash.c:194:16: error: incompatible pointer to integer conversion passing 'u_int64_t *' (aka 'unsigned long *') to parameter of type 'unsigned long'; dereference with * [-Wint-conversion]
      194 |         u_int64_t m = le64toh((u_int64_t *)ctx->buf);
          |                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /usr/include/sys/_endian.h:130:30: note: expanded from macro 'le64toh'
      130 | #define le64toh(x)      __bswap64((x))
          |                         ~~~~~~~~~~^~~~
    /usr/include/sys/_endian.h:85:40: note: expanded from macro '__bswap64'
       85 | #define __bswap64(x)    __builtin_bswap64(x)
          |                                           ^
    3 errors generated.
---
 net/relayd/files/patch-usr.sbin_relayd_siphash.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/net/relayd/files/patch-usr.sbin_relayd_siphash.c b/net/relayd/files/patch-usr.sbin_relayd_siphash.c
new file mode 100644
index 000000000000..16575bdd6c1f
--- /dev/null
+++ b/net/relayd/files/patch-usr.sbin_relayd_siphash.c
@@ -0,0 +1,22 @@
+--- usr.sbin/relayd/siphash.c.orig	2025-09-02 11:44:37 UTC
++++ usr.sbin/relayd/siphash.c
+@@ -64,8 +64,8 @@ SipHash_Init(SIPHASH_CTX *ctx, const SIPHASH_KEY *key)
+ 	uint64_t k0, k1;
+ 
+ #ifdef __FreeBSD__
+-	k0 = le64toh(&key->k0);
+-	k1 = le64toh(&key->k1);
++	k0 = le64toh(key->k0);
++	k1 = le64toh(key->k1);
+ #else
+ 	k0 = lemtoh64(&key->k0);
+ 	k1 = lemtoh64(&key->k1);
+@@ -191,7 +191,7 @@ SipHash_CRounds(SIPHASH_CTX *ctx, int rounds)
+ SipHash_CRounds(SIPHASH_CTX *ctx, int rounds)
+ {
+ #ifdef __FreeBSD__
+-	u_int64_t m = le64toh((u_int64_t *)ctx->buf);
++	u_int64_t m = le64toh((u_int64_t)ctx->buf);
+ #else
+ 	u_int64_t m = lemtoh64((u_int64_t *)ctx->buf);
+ #endif