NETLINK_HEADER_LEN is sum of sizes of headers. Each of these sizes have
already been aligned, which means that the sum is also aligned.


On 16 April 2014 19:15, semihalf-dubiel-michal <notifications@github.com>wrote:

> In freebsd/vr_bsd_transport.c:
>
> > @@ -44,7 +44,11 @@ bsd_trans_alloc(unsigned int size)
> >  {
> >  	char *buf;
> >
> > -	buf = malloc(size + NETLINK_HEADER_LEN, M_VROUTER, M_NOWAIT|M_ZERO);
> > +	/* Netlink requires buffers to be aligned/padded to NLMSG_ALINGTO
> > +	 * bytes, even if it will actually use less bytes than aligned
> > +	 * buffer offers.
> > +	 */
> > +	buf = malloc(NLMSG_ALIGN(size) + NETLINK_HEADER_LEN, M_VROUTER, M_NOWAIT|M_ZERO);
>
> If as you've wrote "Netlink requires buffers to be aligned/padded to
> NLMSG_ALINGTO" shouldn't the entire buffer along with NETLINK_HEADER_LEN be
> aligned?
>
> --
> Reply to this email directly or view it on GitHub<https://github.com/Semihalf/contrail-vrouter/pull/1/files#r11695211>
> .
>