Commit 541eb49
committed
Fixes in this commit:
1. RFC violation on session reset.
2. RFC violation on checking of cp->len.
3. RFC violation on the timing of updating remote discriminator.
For 1, the previous logic in `bfd_recv_cb` incorrectly discarded all
packets with `Your Discriminator` set to 0 if the local session state was
`UP` or `INIT`. This violated RFC 5880 Section 6.8.6, which requires
accepting such packets (specifically when State is DOWN) to handle remote
peer restarts. This discrepancy may cause "zombie sessions" where the local
side remained UP ignoring the peer's reset signal.
The original check was introduced with the intention to prevent session aliasing,
which caused session state flapping. However, the check was too broad.
This patch replaces the state-based check with a more strict address-based check:
- Removed the conditions of `bfd->ses_state !=` which would block legitimate resets.
- Added `match_ip_address` to verify that if a zero-discriminator packet arrives for
an UP session. its destination address matches the session's bound local address.
- Added the check required by the RFC 5880 that if a zero remote discriminator packet
arrives with a state that is not DOWN or ADMIN_DOWN, the packet should be dropped.
This allows legitimate peer resets (correct destination) to proceed while dropping
aliased packets that causes vibration.
For 2, this is a relatively minor one and potentially nitpicking. But RFC 5880 requires
that the parser should check `cp->len < 26` if A bit is set, so I include it.
For 3, the patch delays the update of remote discriminator to after `bfd_check_auth` returns
success. This is required by the RFC. Updating remote discriminator before auth check
would incorrectly update local state even when authentication fails, which can be harmful.
This patch also modifies `bfd.h` to add a new pair of marco that get and set A bit. It also
changes the implementation of `BFD_SETCBIT` to align with other marco's way of implementation.
Signed-off-by: spademomo <[email protected]>1 parent 0a7b0ef commit 541eb49
File tree
523 files changed
+33332
-11883
lines changed- .github
- PULL_REQUEST_TEMPLATE
- workflows
- alpine
- bfdd
- bgpd
- rfapi
- docker
- centos-8
- ubuntu-ci
- doc
- developer
- northbound
- user
- eigrpd
- gdb
- isisd
- lib
- mgmtd
- ospf6d
- ospfd
- pimd
- ripd
- ripngd
- staticd
- tests
- bgpd
- isisd
- lib
- northbound
- topotests
- all_protocol_startup
- r1
- bfd_jitter_verification
- r1
- r2
- bgp_batch_clearing
- r1
- r2
- bgp_evpn_ead_evi_routes
- spine
- tor1
- tor2
- bgp_evpn_gr
- PE1
- PE2
- host1
- host2
- bgp_evpn_mh_v4_v6_num
- ipv6
- hostd11
- hostd12
- hostd21
- hostd22
- leaf1
- leaf2
- spine1
- spine2
- torm11
- torm12
- torm21
- torm22
- bgp_evpn_three_tier_clos_topo1
- bgp_gr_multihop
- r1
- r2
- r3
- bgp_gr_restart_retain_routes
- r3
- bgp_ibgp_software_version_fqdn_capabilities
- r1
- r2
- bgp_local_asn_dot
- bgp_local_asn
- bgp_localpref_add_substract
- r1
- r2
- bgp_remove_private_as
- bgp_route_server_client
- r1
- r2
- r3
- r4
- bgp_srv6_sid_explicit
- c31
- c32
- r1
- r3
- bgp_tcpv4_af6_nexthop_check
- r1
- r2
- bgp_vpnv4_gre
- bgp_vrf_route_leak_basic
- r1
- fpm_testing_topo1
- lib
- mgmt_config
- r1
- mgmt_oper
- oper-results
- multicast_gmp_access_list_topo1
- r1
- multicast_pim_route_map_topo1
- r1
- r2
- r3
- munet
- mutest
- testing
- ospf_nssa_same_prefix_flush
- r1
- r2
- ospfv3_route_map_forwarding
- r1
- r2
- pim_no_path_to_rp
- r1
- r2
- rp
- pim_prune
- host11
- host_rp
- rp
- spine1
- spine2
- torc11
- torc21
- pim_slow_convergence
- host11
- rp
- spine1
- spine2
- torc11
- torc21
- pim_timers
- r1
- rip_del_instance
- rip_distance
- r1
- r2
- r3
- r4
- rip_no_neighbor
- r1
- r2
- rip_split_horizon
- r1
- r2
- r3
- rip_topo1
- ripng_flush_time
- r1
- r2
- ripng_topo1
- srv6_sid_manager
- dst2
- rt1
- rt5
- zebra_inactive_vrf_and_ip_import_table
- r1
- zebra_ipv6_import_table
- r1
- zebra_rnh_testing
- r1
- tools
- etc/frr
- vtysh
- yang
- zebra
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
523 files changed
+33332
-11883
lines changedFile renamed without changes.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
| |||
32 | 33 | | |
33 | 34 | | |
34 | 35 | | |
35 | | - | |
| 36 | + | |
36 | 37 | | |
37 | 38 | | |
38 | 39 | | |
| |||
86 | 87 | | |
87 | 88 | | |
88 | 89 | | |
89 | | - | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
90 | 93 | | |
91 | 94 | | |
92 | 95 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| |||
153 | 154 | | |
154 | 155 | | |
155 | 156 | | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
156 | 160 | | |
157 | 161 | | |
158 | 162 | | |
| |||
232 | 236 | | |
233 | 237 | | |
234 | 238 | | |
235 | | - | |
236 | | - | |
237 | | - | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
238 | 247 | | |
| 248 | + | |
239 | 249 | | |
240 | 250 | | |
241 | 251 | | |
| |||
327 | 337 | | |
328 | 338 | | |
329 | 339 | | |
| 340 | + | |
330 | 341 | | |
331 | 342 | | |
332 | 343 | | |
| |||
341 | 352 | | |
342 | 353 | | |
343 | 354 | | |
| 355 | + | |
344 | 356 | | |
345 | 357 | | |
346 | 358 | | |
| |||
415 | 427 | | |
416 | 428 | | |
417 | 429 | | |
| 430 | + | |
| 431 | + | |
418 | 432 | | |
419 | 433 | | |
420 | 434 | | |
| |||
430 | 444 | | |
431 | 445 | | |
432 | 446 | | |
| 447 | + | |
| 448 | + | |
433 | 449 | | |
434 | 450 | | |
435 | 451 | | |
| |||
562 | 578 | | |
563 | 579 | | |
564 | 580 | | |
| 581 | + | |
| 582 | + | |
565 | 583 | | |
566 | 584 | | |
567 | 585 | | |
| |||
570 | 588 | | |
571 | 589 | | |
572 | 590 | | |
| 591 | + | |
573 | 592 | | |
574 | 593 | | |
575 | 594 | | |
| |||
589 | 608 | | |
590 | 609 | | |
591 | 610 | | |
| 611 | + | |
| 612 | + | |
592 | 613 | | |
593 | 614 | | |
594 | 615 | | |
| |||
638 | 659 | | |
639 | 660 | | |
640 | 661 | | |
| 662 | + | |
| 663 | + | |
641 | 664 | | |
642 | 665 | | |
643 | 666 | | |
| |||
1005 | 1028 | | |
1006 | 1029 | | |
1007 | 1030 | | |
| 1031 | + | |
| 1032 | + | |
1008 | 1033 | | |
1009 | 1034 | | |
1010 | 1035 | | |
| |||
1116 | 1141 | | |
1117 | 1142 | | |
1118 | 1143 | | |
| 1144 | + | |
| 1145 | + | |
1119 | 1146 | | |
1120 | 1147 | | |
1121 | 1148 | | |
| |||
1133 | 1160 | | |
1134 | 1161 | | |
1135 | 1162 | | |
| 1163 | + | |
1136 | 1164 | | |
1137 | 1165 | | |
1138 | 1166 | | |
| |||
1157 | 1185 | | |
1158 | 1186 | | |
1159 | 1187 | | |
| 1188 | + | |
| 1189 | + | |
| 1190 | + | |
1160 | 1191 | | |
1161 | 1192 | | |
1162 | 1193 | | |
| |||
1482 | 1513 | | |
1483 | 1514 | | |
1484 | 1515 | | |
1485 | | - | |
| 1516 | + | |
| 1517 | + | |
| 1518 | + | |
| 1519 | + | |
| 1520 | + | |
| 1521 | + | |
| 1522 | + | |
1486 | 1523 | | |
1487 | | - | |
1488 | | - | |
| 1524 | + | |
| 1525 | + | |
| 1526 | + | |
| 1527 | + | |
| 1528 | + | |
| 1529 | + | |
| 1530 | + | |
1489 | 1531 | | |
1490 | 1532 | | |
1491 | 1533 | | |
| 1534 | + | |
| 1535 | + | |
| 1536 | + | |
1492 | 1537 | | |
1493 | 1538 | | |
1494 | 1539 | | |
| |||
2442 | 2487 | | |
2443 | 2488 | | |
2444 | 2489 | | |
| 2490 | + | |
| 2491 | + | |
2445 | 2492 | | |
2446 | 2493 | | |
2447 | 2494 | | |
| |||
2463 | 2510 | | |
2464 | 2511 | | |
2465 | 2512 | | |
| 2513 | + | |
| 2514 | + | |
2466 | 2515 | | |
2467 | 2516 | | |
2468 | 2517 | | |
| |||
2475 | 2524 | | |
2476 | 2525 | | |
2477 | 2526 | | |
| 2527 | + | |
| 2528 | + | |
2478 | 2529 | | |
2479 | 2530 | | |
2480 | 2531 | | |
| |||
2536 | 2587 | | |
2537 | 2588 | | |
2538 | 2589 | | |
| 2590 | + | |
| 2591 | + | |
2539 | 2592 | | |
2540 | 2593 | | |
2541 | 2594 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
168 | 168 | | |
169 | 169 | | |
170 | 170 | | |
| 171 | + | |
171 | 172 | | |
172 | 173 | | |
173 | 174 | | |
| |||
191 | 192 | | |
192 | 193 | | |
193 | 194 | | |
194 | | - | |
195 | | - | |
196 | | - | |
197 | | - | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
198 | 199 | | |
199 | 200 | | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
200 | 207 | | |
201 | 208 | | |
202 | 209 | | |
| |||
357 | 364 | | |
358 | 365 | | |
359 | 366 | | |
| 367 | + | |
360 | 368 | | |
| 369 | + | |
361 | 370 | | |
362 | 371 | | |
363 | 372 | | |
| |||
0 commit comments