Re: [ANNOUNCE] libmnl 1.0.0 release

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 18/12/10 16:35, Jan Engelhardt wrote:
> 
> On Saturday 2010-12-18 13:40, Pablo Neira Ayuso wrote:
>> On 18/12/10 06:23, Rob Sterenborg (lists) wrote:
>>> On Fri, 2010-12-17 at 15:20 +0100, Pablo Neira Ayuso wrote:
>>>> Hi!
>>>>
>>>> The Netfilter project presents libmnl-1.0.0
>>>
>>> Hi,
>>>
>>> I have a CentOS 5.5 base with a 2.6.36.2 kernel installed. When
>>> compiling libmnl I got these errors:
>>>
>>> nlmsg.c: In function 'mnl_nlmsg_fprintf_payload':
>>> nlmsg.c:274: error: 'NLA_TYPE_MASK' undeclared (first use in this
>>> function)
>>> nlmsg.c:274: error: (Each undeclared identifier is reported only once
>>> nlmsg.c:274: error: for each function it appears in.)
>>> nlmsg.c:290: error: 'NLA_F_NESTED' undeclared (first use in this
>>> function)
>>> nlmsg.c:292: error: 'NLA_F_NET_BYTEORDER' undeclared (first use in this
>>> function)
>>> make: *** [nlmsg.lo] Error 1
>>>
>>> NLA_TYPE_MASK is used in nlmsg.c and attr.c. Searching I found that it
>>> should be defined in linux/netlink.h but it's not there.
>>
>> I'd appreciate if you can guess what version of the kernel header files
>> you're using (CentOS uses a mutant Linux kernel 2.6.18, right?).
> 
> NLA_F_NESTED et al are available starting with 2.6.24.

I think that this approach (see patch) is safe to fix this problem.

Rob, would you give it a test?
nlmsg: fix compilation with Linux kernel headers <= 2.6.24

From: Pablo Neira Ayuso <pablo@xxxxxxxxxxxxx>

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 <pablo@xxxxxxxxxxxxx>
---
 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)

[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux