Skip to content

Commit c911112

Browse files
abdosimssonicbld
authored andcommitted
[chassis/multi-asic] Make sure iBGP session established as directly connected (#16777)
What I did: Make Sure for internal iBGP we are one-hop away (directly connected) by using Generic TTL security mechanism. Why I did: Without this change it's possible on packet chassis i-BGP can be established even if there no direct connection. Below is the example - Let's say we have 3 LC's LC1/LC2/LC3 each having i-BGP session session with each other over Loopback4096 - Each LC's have static route towards other LC's Loopback4096 to establish i-BGP session - LC1 learn default route 0.0.0.0/0 from it's e-BGP peers and send it over to LC2 and LC3 over i-BGP - Now for some reason on LC2 static route towards LC3 is removed/not-present/some-issue we expect i-BGP session should go down between LC2 and LC3 - However i-BGP between LC2 and LC3 does not go down because of feature ip nht-resolve-via-default where LC2 will use default route to reach Loopback4096 of LC3. As it's using default route BGP packets from LC2 towards LC3 will first route to LC1 and then go to LC3 from there. Above scenario can result in packet mis-forwarding on data plane How I fixed it:- To make sure BGP packets between i-BGP peers are not going with extra routing hop enable using GTSM feature neighbor PEER ttl-security hops NUMBER This command enforces Generalized TTL Security Mechanism (GTSM), as specified in RFC 5082. With this command, only neighbors that are the specified number of hops away will be allowed to become neighbors. This command is mutually exclusive with ebgp-multihop. We set hop count as 1 which makes FRR to reject BGP connection if we receive BGP packets if it's TTL < 255. Also setting this attribute make sure i-BGP frames are originated with IP TTL of 255. How I verify: Manual Verification of above scenario. See blow BGP packets receive with IP TTL 254 (additional routing hop) we are seeing FIN TCP flags as BGP is rejecting the connection Signed-off-by: Abhishek Dosi <[email protected]>
1 parent 39e67f0 commit c911112

File tree

7 files changed

+14
-0
lines changed

7 files changed

+14
-0
lines changed

dockers/docker-fpm-frr/frr/bgpd/templates/internal/peer-group.conf.j2

+2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
neighbor INTERNAL_PEER_V4 route-map FROM_BGP_INTERNAL_PEER_V4 in
1616
neighbor INTERNAL_PEER_V4 route-map TO_BGP_INTERNAL_PEER_V4 out
1717
neighbor INTERNAL_PEER_V4 send-community
18+
neighbor INTERNAL_PEER_V4 ttl-security hops 1
1819
exit-address-family
1920
{% if CONFIG_DB__DEVICE_METADATA['localhost']['switch_type'] == 'chassis-packet' %}
2021
neighbor INTERNAL_PEER_V6 update-source Loopback4096
@@ -28,6 +29,7 @@
2829
neighbor INTERNAL_PEER_V6 route-map FROM_BGP_INTERNAL_PEER_V6 in
2930
neighbor INTERNAL_PEER_V6 route-map TO_BGP_INTERNAL_PEER_V6 out
3031
neighbor INTERNAL_PEER_V6 send-community
32+
neighbor INTERNAL_PEER_V6 ttl-security hops 1
3133
exit-address-family
3234
!
3335
! end of template: bgpd/templates/internal/peer-group.conf.j2

dockers/docker-fpm-frr/frr/bgpd/templates/voq_chassis/peer-group.conf.j2

+2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
neighbor VOQ_CHASSIS_V4_PEER route-map FROM_VOQ_CHASSIS_V4_PEER in
1414
neighbor VOQ_CHASSIS_V4_PEER route-map TO_VOQ_CHASSIS_V4_PEER out
1515
neighbor VOQ_CHASSIS_V4_PEER send-community
16+
neighbor VOQ_CHASSIS_V4_PEER ttl-security hops 1
1617
exit-address-family
1718
address-family ipv6
1819
{% if CONFIG_DB__DEVICE_METADATA['localhost']['type'] == 'ToRRouter' %}
@@ -24,6 +25,7 @@
2425
neighbor VOQ_CHASSIS_V6_PEER route-map FROM_VOQ_CHASSIS_V6_PEER in
2526
neighbor VOQ_CHASSIS_V6_PEER route-map TO_VOQ_CHASSIS_V6_PEER out
2627
neighbor VOQ_CHASSIS_V6_PEER send-community
28+
neighbor VOQ_CHASSIS_V6_PEER ttl-security hops 1
2729
exit-address-family
2830
!
2931
! end of template: bgpd/templates/voq_chassis/peer-group.conf.j2

src/sonic-bgpcfgd/tests/data/internal/peer-group.conf/result_back.conf

+2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
neighbor INTERNAL_PEER_V4 route-map FROM_BGP_INTERNAL_PEER_V4 in
1111
neighbor INTERNAL_PEER_V4 route-map TO_BGP_INTERNAL_PEER_V4 out
1212
neighbor INTERNAL_PEER_V4 send-community
13+
neighbor INTERNAL_PEER_V4 ttl-security hops 1
1314
exit-address-family
1415
address-family ipv6
1516
neighbor INTERNAL_PEER_V6 route-reflector-client
@@ -18,6 +19,7 @@
1819
neighbor INTERNAL_PEER_V6 route-map FROM_BGP_INTERNAL_PEER_V6 in
1920
neighbor INTERNAL_PEER_V6 route-map TO_BGP_INTERNAL_PEER_V6 out
2021
neighbor INTERNAL_PEER_V6 send-community
22+
neighbor INTERNAL_PEER_V6 ttl-security hops 1
2123
exit-address-family
2224
!
2325
! end of template: bgpd/templates/internal/peer-group.conf.j2

src/sonic-bgpcfgd/tests/data/internal/peer-group.conf/result_chasiss_packet.conf

+2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
neighbor INTERNAL_PEER_V4 route-map FROM_BGP_INTERNAL_PEER_V4 in
1111
neighbor INTERNAL_PEER_V4 route-map TO_BGP_INTERNAL_PEER_V4 out
1212
neighbor INTERNAL_PEER_V4 send-community
13+
neighbor INTERNAL_PEER_V4 ttl-security hops 1
1314
exit-address-family
1415
neighbor INTERNAL_PEER_V6 update-source Loopback4096
1516
address-family ipv6
@@ -18,6 +19,7 @@
1819
neighbor INTERNAL_PEER_V6 route-map FROM_BGP_INTERNAL_PEER_V6 in
1920
neighbor INTERNAL_PEER_V6 route-map TO_BGP_INTERNAL_PEER_V6 out
2021
neighbor INTERNAL_PEER_V6 send-community
22+
neighbor INTERNAL_PEER_V6 ttl-security hops 1
2123
exit-address-family
2224
!
2325
! end of template: bgpd/templates/internal/peer-group.conf.j2

src/sonic-bgpcfgd/tests/data/internal/peer-group.conf/result_front.conf

+2
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,15 @@
99
neighbor INTERNAL_PEER_V4 route-map FROM_BGP_INTERNAL_PEER_V4 in
1010
neighbor INTERNAL_PEER_V4 route-map TO_BGP_INTERNAL_PEER_V4 out
1111
neighbor INTERNAL_PEER_V4 send-community
12+
neighbor INTERNAL_PEER_V4 ttl-security hops 1
1213
exit-address-family
1314
address-family ipv6
1415
neighbor INTERNAL_PEER_V6 soft-reconfiguration inbound
1516
neighbor INTERNAL_PEER_V6 allowas-in 1
1617
neighbor INTERNAL_PEER_V6 route-map FROM_BGP_INTERNAL_PEER_V6 in
1718
neighbor INTERNAL_PEER_V6 route-map TO_BGP_INTERNAL_PEER_V6 out
1819
neighbor INTERNAL_PEER_V6 send-community
20+
neighbor INTERNAL_PEER_V6 ttl-security hops 1
1921
exit-address-family
2022
!
2123
! end of template: bgpd/templates/internal/peer-group.conf.j2

src/sonic-bgpcfgd/tests/data/voq_chassis/peer-group.conf/result_all.conf

+2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
neighbor VOQ_CHASSIS_V4_PEER route-map FROM_VOQ_CHASSIS_V4_PEER in
1212
neighbor VOQ_CHASSIS_V4_PEER route-map TO_VOQ_CHASSIS_V4_PEER out
1313
neighbor VOQ_CHASSIS_V4_PEER send-community
14+
neighbor VOQ_CHASSIS_V4_PEER ttl-security hops 1
1415
exit-address-family
1516
address-family ipv6
1617
neighbor VOQ_CHASSIS_V6_PEER allowas-in 1
@@ -20,6 +21,7 @@
2021
neighbor VOQ_CHASSIS_V6_PEER route-map FROM_VOQ_CHASSIS_V6_PEER in
2122
neighbor VOQ_CHASSIS_V6_PEER route-map TO_VOQ_CHASSIS_V6_PEER out
2223
neighbor VOQ_CHASSIS_V6_PEER send-community
24+
neighbor VOQ_CHASSIS_V6_PEER ttl-security hops 1
2325
exit-address-family
2426
!
2527
! end of template: bgpd/templates/voq_chassis/peer-group.conf.j2

src/sonic-bgpcfgd/tests/data/voq_chassis/peer-group.conf/result_base.conf

+2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
neighbor VOQ_CHASSIS_V4_PEER route-map FROM_VOQ_CHASSIS_V4_PEER in
1111
neighbor VOQ_CHASSIS_V4_PEER route-map TO_VOQ_CHASSIS_V4_PEER out
1212
neighbor VOQ_CHASSIS_V4_PEER send-community
13+
neighbor VOQ_CHASSIS_V4_PEER ttl-security hops 1
1314
exit-address-family
1415
address-family ipv6
1516
neighbor VOQ_CHASSIS_V6_PEER activate
@@ -18,6 +19,7 @@
1819
neighbor VOQ_CHASSIS_V6_PEER route-map FROM_VOQ_CHASSIS_V6_PEER in
1920
neighbor VOQ_CHASSIS_V6_PEER route-map TO_VOQ_CHASSIS_V6_PEER out
2021
neighbor VOQ_CHASSIS_V6_PEER send-community
22+
neighbor VOQ_CHASSIS_V6_PEER ttl-security hops 1
2123
exit-address-family
2224
!
2325
! end of template: bgpd/templates/voq_chassis/peer-group.conf.j2

0 commit comments

Comments
 (0)