[quagga-dev 1421] Re: [Zebra-pj-commit] "quagga/lib ChangeLog sockopt.c sockopt.h"

Greg Troxel gdt at ir.bbn.com
Thu Aug 19 16:23:16 BST 2004


> >    char buff [sizeof (*cmsg) + SOPT_SIZE_CMSG_PKTINFO_IPV4()];
> >
> >    msgh.msg_control = (caddr_t) buff;
> >    msgh.msg_controllen = sizeof (buff);
> >
> > The macro in sockopt.h returns the actual size, but the CMSG_SPACE 
> > padding is not done (see /usr/include/sys/socket.h on netbsd, 
> > assuming this is the same on linux but not sure).
> 
> Quite possible. My goal was simply to shift useage to a central place 
> with minimum of fuss. The above was the most common way to allocate 
> the cmsg buffer, so doing it so allowed me to remain bug compatible.

Sure, that's what I expected.

> For IPv6 it doesnt matter, cause thankfully v6 APIs are more 
> consistent. But for v4, I'd prefer code not to have anything more 
> than a vague notion of "i want to retrieve the ifindex", and we migth 
> as well extend to v6.

> This probably implies wrapping up controll message access completely.

yes, probably does.  So a function to create a cmsg structure
(chain?), and another to extract the info later, and then a free
routine.  Unfortunately these need to be dynamically allocated because
the ALIGN routines apparently can call functions.  Plus, that's more
likely MP-safe for down the road.



More information about the Quagga-dev mailing list