netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Jan Engelhardt <jengelh@medozas.de>
Cc: "Rob Sterenborg (lists)" <lists@sterenborg.info>,
	netfilter@vger.kernel.org, netfilter-devel@vger.kernel.org
Subject: Re: [ANNOUNCE] libmnl 1.0.0 release
Date: Tue, 21 Dec 2010 21:19:40 +0100	[thread overview]
Message-ID: <4D110BDC.4000709@netfilter.org> (raw)
In-Reply-To: <alpine.LNX.2.01.1012181633390.13544@obet.zrqbmnf.qr>

[-- Attachment #1: Type: text/plain, Size: 1332 bytes --]

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?

[-- Attachment #2: 2.6.18.patch --]
[-- Type: text/x-patch, Size: 1420 bytes --]

nlmsg: fix compilation with Linux kernel headers <= 2.6.24

From: Pablo Neira Ayuso <pablo@netfilter.org>

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@netfilter.org>
---
 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)

  reply	other threads:[~2010-12-21 20:19 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-17 14:20 [ANNOUNCE] libmnl 1.0.0 release Pablo Neira Ayuso
2010-12-18  5:23 ` Rob Sterenborg (lists)
2010-12-18 12:40   ` Pablo Neira Ayuso
2010-12-18 12:53     ` Pablo Neira Ayuso
2010-12-18 15:35     ` Jan Engelhardt
2010-12-21 20:19       ` Pablo Neira Ayuso [this message]
2010-12-21 20:22         ` David Miller
2010-12-21 20:31           ` Pablo Neira Ayuso
2010-12-22 19:52   ` Pablo Neira Ayuso

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4D110BDC.4000709@netfilter.org \
    --to=pablo@netfilter.org \
    --cc=jengelh@medozas.de \
    --cc=lists@sterenborg.info \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=netfilter@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).