[quagga-dev 11412] Re: quagga/dmvpn work

David Lamparter equinox at diac24.net
Tue Aug 12 17:54:30 BST 2014


On Tue, May 20, 2014 at 05:20:16PM +0300, Timo Teras wrote:
> 1. As optimization, implement API that uses SOCK_CLOEXEC and
> SOCK_NONBLOCK with socket() and accept4() where possible. This is
> mostly an optimization. sockopt_socket() or similar? And define some
> libzebra flags that map to SOCK_* ?

While nice to have, I don't think these provide huge benefits, but if
you have/want them I see no problem either.

Defining additional names for OS constants should be avoided since any
reader of the code will have to learn them again...  better to stick
with the OS ones - unless there are really weird differences between
OSes.  Haven't checked if this applies to the SOCK_* values (FD_CLOEXEC
vs. O_CLOEXEC vs.  SOCK_CLOEXEC?)

> 2. Move the netlink helpers from zebra to lib, and clean them up. I
> remember there was discussion on using some existing library instead
> (libnl, libmnl). But I'd rather not do that for the reasons that:
>   a) introduction of additional dependency

This does _not_ count IMHO.  Reimplementing things means re-maintaining
things.  And even embedded routers have enough flash these days.

>   b) duplication of socket handling code that already exists in quagga
>   c) they are bloated: even libmnl implements two variants of helpers
>      (struct nlattr and struct nlmsghdr). single set is enough.

I haven't looked at it, but if you have, and you say that the existing
libraries suck, then I'll stick with your evaluation.  Netlink wrapping
isn't particularly large, so if the existing libs aren't nice for us I'd
say write them anew...

>   d) we would need additional wrapping to integrate it to quagga
>      mainloop

... I'm still hoping that at some point we can delete the zebra mainloop
and use some library instead, but for now that's just inviting
trouble...

> So I'm asking if there's any additional thoughts to this? I'm offering
> to write the netlink code properly.

Go ahead - znl_* should be OK :)

(Please try to make them as idiot-proof as possible, e.g. misuse of the
API should produce compiler warnings where possible.  Printing netlink
packets OTOH isn't absolutely neccessary since there's nlmon in kernel
now.)


Cheers,

-David
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 230 bytes
Desc: Digital signature
URL: <http://lists.quagga.net/pipermail/quagga-dev/attachments/20140812/451d78f9/attachment-0001.sig>


More information about the Quagga-dev mailing list