#ifndef NETLINK_UTILS_PRIV_H_
#define NETLINK_UTILS_PRIV_H_
+#include <byteswap.h>
+#if __BYTE_ORDER == __BIG_ENDIAN
+#define ntohll(x) (x)
+#elif __BYTE_ORDER == __LITTLE_ENDIAN
+#define ntohll(x) bswap_64((x))
+#endif
+#define htonll(x) ntohll(x)
+
extern const char * nl_strerror_l(int err);
#endif
#include <netlink/attr.h>
#include <netlink/netfilter/nfnl.h>
#include <netlink/netfilter/ct.h>
+#include <netlink-private/utils.h>
static struct nl_cache_ops nfnl_ct_ops;
-#if __BYTE_ORDER == __BIG_ENDIAN
-static uint64_t ntohll(uint64_t x)
-{
- return x;
-}
-#elif __BYTE_ORDER == __LITTLE_ENDIAN
-static uint64_t ntohll(uint64_t x)
-{
- return bswap_64(x);
-}
-#endif
static struct nla_policy ct_policy[CTA_MAX+1] = {
[CTA_TUPLE_ORIG] = { .type = NLA_NESTED },
#include <netlink/attr.h>
#include <netlink/netfilter/nfnl.h>
#include <netlink/netfilter/log_msg.h>
-#include <byteswap.h>
-
-#if __BYTE_ORDER == __BIG_ENDIAN
-static uint64_t ntohll(uint64_t x)
-{
- return x;
-}
-#elif __BYTE_ORDER == __LITTLE_ENDIAN
-static uint64_t ntohll(uint64_t x)
-{
- return bswap_64(x);
-}
-#endif
+#include <netlink-private/utils.h>
static struct nla_policy log_msg_policy[NFULA_MAX+1] = {
[NFULA_PACKET_HDR] = {
#include <netlink/attr.h>
#include <netlink/netfilter/nfnl.h>
#include <netlink/netfilter/queue_msg.h>
-#include <byteswap.h>
+#include <netlink-private/utils.h>
static struct nl_cache_ops nfnl_queue_msg_ops;
-#if __BYTE_ORDER == __BIG_ENDIAN
-static uint64_t ntohll(uint64_t x)
-{
- return x;
-}
-#elif __BYTE_ORDER == __LITTLE_ENDIAN
-static uint64_t ntohll(uint64_t x)
-{
- return bswap_64(x);
-}
-#endif
-
static struct nla_policy queue_policy[NFQA_MAX+1] = {
[NFQA_PACKET_HDR] = {
.minlen = sizeof(struct nfqnl_msg_packet_hdr),
#include <netlink/object.h>
#include <netlink/route/rtnl.h>
#include <netlink-private/route/link/api.h>
+#include <netlink-private/utils.h>
#include <linux/if_macsec.h>
-#include <byteswap.h>
-
-#if __BYTE_ORDER == __BIG_ENDIAN
-static uint64_t ntohll(uint64_t x)
-{
- return x;
-}
-#elif __BYTE_ORDER == __LITTLE_ENDIAN
-static uint64_t ntohll(uint64_t x)
-{
- return bswap_64(x);
-}
-#endif
-#define htonll(x) ntohll(x)
-
#define MACSEC_ATTR_SCI (1 << 0)
#define MACSEC_ATTR_ICV_LEN (1 << 1)
#define MACSEC_ATTR_CIPHER_SUITE (1 << 2)