Okay, I'll fix that. What about the neighbor.bound_iface field I introduced in my patch series? Should I just allocate the interface name from the same slab the neighbor node itself is allocated from, and free it before the neighbor is freed? Matthias Schiffer On 12/31/2011 02:13 PM, Martin Mares wrote:
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