[PATCH 3/4] BGP: Add support for specifying interface names to allow peerings using link-local addresses

Martin Mares mj at ucw.cz
Sat Dec 31 14:13:48 CET 2011


Hello!

> the limit to 15 characters for interface names is used all over bird
> (look at 'struct iface' in nest/iface.h), as this is the limit imposed
> by most Unix APIs, so I didn't see a reason not to use this limit.

Actually, it is not all over bird, but only in nest/iface.h (try grepping
for '\[16]').

Using a hard-coded number (not even a named constant) for size of anything
global is a mistake -- indeed, my own mistake somewhere in the distant past :)
-- and I think we should get rid of it, not follow it in new code.

> Now that you mention bgp_reconfigure(), I see though that in my current
> patch the comparision can behave strangely when a user has more than
> one interface line in his BGP config, as the unused bytes of the interface string
> are compared as well.
> 
> I guess this isn't a big problem as such a config doesn't make sense, and the
> comparison is still deterministic as the same bytes will be set in the interface
> field for the same config. Still, it would be cleaner to zero out bgp_config.interface
> before setting it. Comments?

I think that storing a pointer to the string gets rid of this problem nicely :)

				Have a nice fortnight
-- 
Martin `MJ' Mares                          <mj at ucw.cz>   http://mj.ucw.cz/
Faculty of Math and Physics, Charles University, Prague, Czech Rep., Earth
"Object orientation is in the mind, not in the compiler." -- Alan Cox



More information about the Bird-users mailing list