summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/udata.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/udata.c b/src/udata.c
index a195657..8cf4e7c 100644
--- a/src/udata.c
+++ b/src/udata.c
@@ -8,6 +8,7 @@
#include <udata.h>
#include <utils.h>
+#include <arpa/inet.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
@@ -100,7 +101,9 @@ EXPORT_SYMBOL(nftnl_udata_put_u32);
bool nftnl_udata_put_u32(struct nftnl_udata_buf *buf, uint8_t type,
uint32_t data)
{
- return nftnl_udata_put(buf, type, sizeof(data), &data);
+ uint32_t data_be = htonl(data);
+
+ return nftnl_udata_put(buf, type, sizeof(data_be), &data_be);
}
EXPORT_SYMBOL(nftnl_udata_type);
@@ -128,7 +131,7 @@ uint32_t nftnl_udata_get_u32(const struct nftnl_udata *attr)
memcpy(&data, attr->value, sizeof(data));
- return data;
+ return ntohl(data);
}
EXPORT_SYMBOL(nftnl_udata_next);