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

Matthias Schiffer mschiffer at universe-factory.net
Sat Dec 31 14:01:27 CET 2011


Hi,
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.

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?

Thanks for looking at my patches,
Matthias Schiffer


On 12/31/2011 11:38 AM, Martin Mares wrote:
> Hello!
> 
>> diff --git a/proto/bgp/bgp.h b/proto/bgp/bgp.h
>> index 0c50583..76f0400 100644
>> --- a/proto/bgp/bgp.h
>> +++ b/proto/bgp/bgp.h
>> @@ -50,6 +50,7 @@ struct bgp_config {
>>    unsigned error_delay_time_min;	/* Time to wait after an error is detected */
>>    unsigned error_delay_time_max;
>>    unsigned disable_after_error;		/* Disable the protocol when error is detected */
>> +  char interface[16];			/* Interface to use */
> 
> Please do not place arbitrary limits on interface names.
> 
> Instead of copying the interface name, you can store a pointer to the string
> -- it is allocated from the configuration mempool, which is kept until
> reconfiguration.
> 
> However, you have to extend bgp_reconfigure() to compare the old and new
> interface name.
> 
> 				Have a nice fortnight


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 262 bytes
Desc: OpenPGP digital signature
URL: <http://trubka.network.cz/pipermail/bird-users/attachments/20111231/0c85aa22/attachment-0001.asc>


More information about the Bird-users mailing list