On Thu, 2006-06-08 at 17:15 +1000, Herbert Xu wrote: > Andy Gay <andy@xxxxxxxxxxx> wrote: > > > > The policy print errors can be fixed by this patch (this is against > > iproute2-2.6.16-060323): > > # diff -u --show-c-function xfrm_policy.c~ xfrm_policy.c > > --- xfrm_policy.c~ 2005-11-07 13:39:30.000000000 -0500 > > +++ xfrm_policy.c 2006-06-07 18:29:13.000000000 -0400 > > @@ -362,7 +362,7 @@ int xfrm_policy_print(const struct socka > > } else { > > xpexp = NULL; > > xpinfo = NLMSG_DATA(n); > > - len -= NLMSG_LENGTH(sizeof(*xpinfo)); > > + len -= NLMSG_LENGTH(NLMSG_ALIGN(sizeof(*xpinfo))); > > } > > > > if (len < 0) { > > A shorter way to write this is > > len -= NLMSG_SPACE(sizeof(*xpinfo); > Yes, that works as well (I tried it!). Interesting... My patch was using a construction of the form NLMSG_LENGTH(NLMSG_ALIGN(len)) while the first level expansion of NLMSG_SPACE(len) is NLMSG_ALIGN(NLMSG_LENGTH(len)) Since it works both ways, it appears NLMSG_ALIGN and NLMSG_LENGTH can be used in either order. Is that guaranteed, I wonder? > Cheers, - : send the line "unsubscribe linux-net" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html