nlmsg: fix compilation with Linux kernel headers <= 2.6.24 From: Pablo Neira Ayuso This patch adds the internal definition of NLA_F_NESTED, NLA_F_NET_BYTEORDER and NLA_TYPE_MASK which were introduced in 2.6.24. This patch is rather conservative since we internally define these constants instead of making them public in libmnl.h. I don't like the idea of polluting the libmnl.h file with declarations that may be missing in old linux/netlink.h files. Moreover, I don't want to keep copies of useful Netlink headers in libmnl to avoid the overhead of keeping them in sync with those in the Linux kernel, not until I'm convinced at least. Signed-off-by: Pablo Neira Ayuso --- src/nlmsg.c | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-) diff --git a/src/nlmsg.c b/src/nlmsg.c index b2e3853..c22e71e 100644 --- a/src/nlmsg.c +++ b/src/nlmsg.c @@ -243,6 +243,18 @@ static void mnl_nlmsg_fprintf_header(FILE *fd, const struct nlmsghdr *nlh) fprintf(fd, "----------------\t------------------\n"); } +#ifndef NLA_F_NESTED +#define NLA_F_NESTED (1 << 15) +#endif + +#ifndef NLA_F_NET_BYTEORDER +#define NLA_F_NET_BYTEORDER (1 << 14) +#endif + +#ifndef NLA_TYPE_MASK +#define NLA_TYPE_MASK ~(NLA_F_NESTED | NLA_F_NET_BYTEORDER) +#endif + static void mnl_nlmsg_fprintf_payload(FILE *fd, const struct nlmsghdr *nlh, size_t extra_header_size)