netdev
[Top] [All Lists]

Re: NLMSG_* macros (was: Re: ULOG comments)

To: Jan Echternach <jan.echternach@xxxxxxxxxxxxxxxxxxxxxxxxx>
Subject: Re: NLMSG_* macros (was: Re: ULOG comments)
From: Andi Kleen <ak@xxxxxx>
Date: Wed, 16 Aug 2000 12:26:50 +0200
Cc: Andi Kleen <ak@xxxxxx>, netfilter@xxxxxxxxx, netdev@xxxxxxxxxxx
In-reply-to: <20000816122231.A21914@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>; from Jan Echternach on Wed, Aug 16, 2000 at 12:23:00PM +0200
References: <20000811162634.A3814@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx> <Pine.LNX.4.10.10008120119370.13569-100000@xxxxxxxxxxxxxxxxxxxxxxxxxx> <20000815175225.B26543@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx> <20000815181812.A5358@xxxxxxxxxxx> <20000815182512.D26543@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx> <20000815224633.53823@xxxxxxxxxxxx> <20000816122231.A21914@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
Sender: owner-netdev@xxxxxxxxxxx
On Wed, Aug 16, 2000 at 12:23:00PM +0200, Jan Echternach wrote:
> On Tue, Aug 15, 2000 at 10:46:34PM +0200, Andi Kleen wrote:
> > On Tue, Aug 15, 2000 at 06:25:29PM +0200, Jan Echternach wrote:
> > > On Tue, Aug 15, 2000 at 06:18:12PM +0200, Andi Kleen wrote:
> > > But there are absolutely no alignement problems with single-part
> > > messages.  Actually, there are even fewer alignment problems without
> > 
> > There is between the header and the payload.
> 
> I'm sorry that I didn't represent the issue clearly.  I understand that
> user space code should also use NLMSG_* if the kernel uses it.
> 
> Ipchains in Linux-2.2 uses a simple structure without padding on the
> NETLINK_FIREWALL socket.  But netfilter in 2.4 puts a nlmsghdr before a
> similar structure, even though it doesn't use its multipart feature.
> The new ULOG target on the new NETLINK_NFLOG type socket also uses
> NLMSG_* without ever producing multipart messages.  There seems to be a
> strong tendency among the netfilter developers to wrap everything in a
> nlmsghdr structure.

nlmsghdr has other uses than just handling multipart messages. For 
examples it gives you a sequence number so that you can try to detect
lost packets and a way to request acks.
netlink sockets require a nlmsghdr

> 
> It's not too late to change the datagram formats on NETLINK_NFLOG.  I
> think NLMSG_* only makes the data larger and the code more complex and
> less readable.  There is no inherent padding in the data here, there
> wouldn't be any alignment problems in the first place if NLMSG_* wasn't
> used.
> 
> Should NLMSG_* be used on the new NETLINK_NFLOG socket?

Definitely. 


-Andi

<Prev in Thread] Current Thread [Next in Thread>