Aleksey Berezin
2014-03-20 10:14:47 UTC
Hi there!
Firstly, sorry for my French ;)
Recently I tried to test BFD implementation in 1.4.0 BIRD release.
Case is "OSPF ECMP with less-second failover". On one side - Extreme
Networks switches, other side - several boxes with Debian and BIRD, of
course.
So, I find out several annoying things.
First thing: BIRD BFD implementation uses non-RFC5881 source UDP port for
outgoing packets. Here some tcpdump:
=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
20:34:21.355747 <BIRD_BOX_MAC> > <EXTREME_SW_MAC>, ethertype 802.1Q
(0x8100), length 70: vlan <vlan>, p 0, ethertype IPv4, (tos 0xc0, ttl 255,
id 20806, offset 0, flags [none], proto UDP (17), length 52)
<BIRD_BOX_IP>.39156 > <EXTREME_SW_IP>.3784: BFDv1, length: 24
Control, State Init, Flags: [none], Diagnostic: No Diagnostic (0x00)
Detection Timer Multiplier: 5 (5000 ms Detection time), BFD Length: 24
My Discriminator: 0x8a82eb8a, Your Discriminator: 0x00000002
Desired min Tx Interval: 1000 ms
Required min Rx Interval: 10 ms
Required min Echo Interval: 0 ms
=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
BFD session between BIRD and Extreme Networks switch can't be established.
So, src port for outgoing BFD-packet from BIRD is 39156, when RFC5881
contains:
=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
4. Encapsulation
BFD Control packets MUST be transmitted in UDP packets with
destination port 3784, within an IPv4 or IPv6 packet. The source
port MUST be in the range 49152 through 65535.
=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Ok, fixing (only for test purposes):
=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
***@debian-1:~# sysctl net.ipv4.ip_local_port_range
net.ipv4.ip_local_port_range = 32768 61000
***@debian-1:~# sysctl -w net.ipv4.ip_local_port_range="49152 65535"
net.ipv4.ip_local_port_range = 49152 65535
***@debian-1:~# sysctl net.ipv4.ip_local_port_range
net.ipv4.ip_local_port_range = 49152 65535
=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
After this BFD session was estabilished.
Of course, net.ipv4.ip_local_port_range tuning seems to be not usable in
production environment, and need to be fixed in BIRD, I think. Just because
some network hardware vendors interprets RFC's exactly as written ;)
But now - second thing: 'protocol bfd' block in bird.conf useless. Here
part of config:
=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
protocol bfd FOR_OSPF {
interface <BIRD_BOX_IP>/32 {
interval 50 ms;
min rx interval 50 ms; # presence of this string by the docs does not
matter
min tx interval 50 ms; # presence of this string by the docs does not
matter
multiplier 3;
};
neighbor <EXTREME_SW_IP> dev "<BIRD_BOX_IP>" local <BIRD_BOX_IP>; #
presence of this string by the docs does not matter
};
protocol ospf OSPF1 {
...
area 0.0.0.0 {
interface <BIRD_BOX_IP>/32 {
...
bfd;
};
};
...
};
=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
And what I see with tcpdump:
=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
13:09:05.433336 <BIRD_BOX_MAC> > <EXTREME_SW_MAC>, ethertype 802.1Q
(0x8100), length 70: vlan <vlan>, p 0, ethertype IPv4, (tos 0xc0, ttl 255,
id 6662, offset 0, flags [none], proto UDP (17), length 52)
<BIRD_BOX_IP>.62698 > <EXTREME_SW_IP>.3784: BFDv1, length: 24
Control, State Up, Flags: [none], Diagnostic: No Diagnostic (0x00)
Detection Timer Multiplier: 5 (500 ms Detection time), BFD Length: 24
My Discriminator: 0x35e75227, Your Discriminator: 0x00000007
Desired min Tx Interval: 100 ms
Required min Rx Interval: 10 ms
Required min Echo Interval: 0 ms
=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
There is no any configured intervals and multiplier. Just default values. I
think this is not correct.
Maybe I misconfigure BIRD? Please advise.
Thanks for attention.
Firstly, sorry for my French ;)
Recently I tried to test BFD implementation in 1.4.0 BIRD release.
Case is "OSPF ECMP with less-second failover". On one side - Extreme
Networks switches, other side - several boxes with Debian and BIRD, of
course.
So, I find out several annoying things.
First thing: BIRD BFD implementation uses non-RFC5881 source UDP port for
outgoing packets. Here some tcpdump:
=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
20:34:21.355747 <BIRD_BOX_MAC> > <EXTREME_SW_MAC>, ethertype 802.1Q
(0x8100), length 70: vlan <vlan>, p 0, ethertype IPv4, (tos 0xc0, ttl 255,
id 20806, offset 0, flags [none], proto UDP (17), length 52)
<BIRD_BOX_IP>.39156 > <EXTREME_SW_IP>.3784: BFDv1, length: 24
Control, State Init, Flags: [none], Diagnostic: No Diagnostic (0x00)
Detection Timer Multiplier: 5 (5000 ms Detection time), BFD Length: 24
My Discriminator: 0x8a82eb8a, Your Discriminator: 0x00000002
Desired min Tx Interval: 1000 ms
Required min Rx Interval: 10 ms
Required min Echo Interval: 0 ms
=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
<Warn:BFD.RxPktInv> Received BFD an invalid packet on VLAN <vlan>
Error:Invalid UDP src port NumberBFD session between BIRD and Extreme Networks switch can't be established.
So, src port for outgoing BFD-packet from BIRD is 39156, when RFC5881
contains:
=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
4. Encapsulation
BFD Control packets MUST be transmitted in UDP packets with
destination port 3784, within an IPv4 or IPv6 packet. The source
port MUST be in the range 49152 through 65535.
=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Ok, fixing (only for test purposes):
=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
***@debian-1:~# sysctl net.ipv4.ip_local_port_range
net.ipv4.ip_local_port_range = 32768 61000
***@debian-1:~# sysctl -w net.ipv4.ip_local_port_range="49152 65535"
net.ipv4.ip_local_port_range = 49152 65535
***@debian-1:~# sysctl net.ipv4.ip_local_port_range
net.ipv4.ip_local_port_range = 49152 65535
=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
After this BFD session was estabilished.
Of course, net.ipv4.ip_local_port_range tuning seems to be not usable in
production environment, and need to be fixed in BIRD, I think. Just because
some network hardware vendors interprets RFC's exactly as written ;)
But now - second thing: 'protocol bfd' block in bird.conf useless. Here
part of config:
=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
protocol bfd FOR_OSPF {
interface <BIRD_BOX_IP>/32 {
interval 50 ms;
min rx interval 50 ms; # presence of this string by the docs does not
matter
min tx interval 50 ms; # presence of this string by the docs does not
matter
multiplier 3;
};
neighbor <EXTREME_SW_IP> dev "<BIRD_BOX_IP>" local <BIRD_BOX_IP>; #
presence of this string by the docs does not matter
};
protocol ospf OSPF1 {
...
area 0.0.0.0 {
interface <BIRD_BOX_IP>/32 {
...
bfd;
};
};
...
};
=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
And what I see with tcpdump:
=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
13:09:05.433336 <BIRD_BOX_MAC> > <EXTREME_SW_MAC>, ethertype 802.1Q
(0x8100), length 70: vlan <vlan>, p 0, ethertype IPv4, (tos 0xc0, ttl 255,
id 6662, offset 0, flags [none], proto UDP (17), length 52)
<BIRD_BOX_IP>.62698 > <EXTREME_SW_IP>.3784: BFDv1, length: 24
Control, State Up, Flags: [none], Diagnostic: No Diagnostic (0x00)
Detection Timer Multiplier: 5 (500 ms Detection time), BFD Length: 24
My Discriminator: 0x35e75227, Your Discriminator: 0x00000007
Desired min Tx Interval: 100 ms
Required min Rx Interval: 10 ms
Required min Echo Interval: 0 ms
=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
There is no any configured intervals and multiplier. Just default values. I
think this is not correct.
Maybe I misconfigure BIRD? Please advise.
Thanks for attention.