Bird BFD is not compliant to RFC5881

Christian Bruns bird-c at sernet.de
Wed Mar 2 11:14:27 CET 2022


Hi,

as of my understanding ports for BFD session are not ephemeral; the port 
is chosen statically when the daemon spawns (and even survives lost BFD 
sessions).

Further, there is no RFC known to me that requests limitations on usable 
port ranges for arbitrary outgoing connections in general-- linux just 
likes to use 'its' port range and and the world is fine with this.
On the other hand, RFC5581 requests specifically the narrow range of 
49152-65535 for originating BFD sessions, so bird should comply with this.

Thus the somewhat silly workaround would just seem the thing to be done 
to fix this issue.

Kind regards
Christian

On 2/17/22 15:43, Ondrej Zajicek wrote:
> On Thu, Feb 17, 2022 at 01:09:33PM +0100, Christian Bruns wrote:
>> Hi all,
>>
>> we experienced issues with non-functional BFD Sessions. Debugging yielded
>> that bird does not use RFC compliant BFD Port ranges.
>> RFC 5881 states: "" The source port MUST be in the range 49152 through
>> 65535. ""; however, the port range is not restricted within bird and thus
>> using arbitrary high ports.
>> Some tier 1 transit providers like "Deutsche Telekom" apply strict filter
>> for BFD and only allow RFC5881 compliant ports, hence the issue.
>>
>> There is a workaround to limit the port range globally at system level
>> (/proc/sys/net/ipv4/ip_local_port_range); this seems to work, but we have
>> the strong feeling that restriction of port range for BFD sessions should
>> happen within bird itself.
> Hi
>
> Unfortunately, this AFAIK does not have a good solution without some additional
> Linux kernel API.
>
> First, restriction for port ranges 49152-65535 is not a speciality of
> BFD, it is an ephemeral port range designated for outgoing connections or
> datagrams without defined port number, but Linux by default use range
> starting with 32768. So setting ip_local_port_range just fixes Linux bad
> default values.
>
> Second, there is no API in Linux to allocate 'any free socket within
> range'. BSD has IP_PORTRANGE socket option, but there is (AFAIK) no such
> thing in Linux. One could either require explicit port number, or any
> free port from the range. And doing systematic enumeration of port
> numbers from ephemeral port range and trying them one after another
> seems like silly workaround.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://trubka.network.cz/pipermail/bird-users/attachments/20220302/e64d9247/attachment.htm>


More information about the Bird-users mailing list