]> git.ipfire.org Git - thirdparty/libnftnl.git/commitdiff
Revert "udata: Store u32 udata values in Big Endian"
authorPhil Sutter <phil@nwl.cc>
Thu, 29 Jan 2026 13:24:49 +0000 (14:24 +0100)
committerPhil Sutter <phil@nwl.cc>
Thu, 29 Jan 2026 14:04:01 +0000 (15:04 +0100)
This reverts commit f20dfa7824860a9ac14425a3f7ca970a6c981597.

This change to payload (interpretation) is problematic with package
updates at run-time: The new version might trip over userdata in the
running ruleset, avoid this.

Signed-off-by: Phil Sutter <phil@nwl.cc>
src/udata.c

index 8cf4e7ca61e2fef76eec4f54b227169856b05b7f..a1956571ef5fd6046995c25859eb28e2ac6ab9d5 100644 (file)
@@ -8,7 +8,6 @@
 #include <udata.h>
 #include <utils.h>
 
-#include <arpa/inet.h>
 #include <stdlib.h>
 #include <stdint.h>
 #include <string.h>
@@ -101,9 +100,7 @@ EXPORT_SYMBOL(nftnl_udata_put_u32);
 bool nftnl_udata_put_u32(struct nftnl_udata_buf *buf, uint8_t type,
                         uint32_t data)
 {
-       uint32_t data_be = htonl(data);
-
-       return nftnl_udata_put(buf, type, sizeof(data_be), &data_be);
+       return nftnl_udata_put(buf, type, sizeof(data), &data);
 }
 
 EXPORT_SYMBOL(nftnl_udata_type);
@@ -131,7 +128,7 @@ uint32_t nftnl_udata_get_u32(const struct nftnl_udata *attr)
 
        memcpy(&data, attr->value, sizeof(data));
 
-       return ntohl(data);
+       return data;
 }
 
 EXPORT_SYMBOL(nftnl_udata_next);