Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bgpd:support of color extended community color-only types #17231

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

guoguojia2021
Copy link
Contributor

Add support of color extended community color-only types, RFC 9256.
The type only support 00 01 10.

configuration example:
!
frr version 10.3-dev-my-manual-build
frr defaults traditional
hostname router3
!
route-map color permit 1
set extcommunity color 10:100 01:200 00:300
exit
!
vrf Vrf1
exit-vrf
!
interface lo
ipv6 address 3::3/128
exit
!
router bgp 3
bgp router-id 3.3.3.3
bgp log-neighbor-changes
no bgp ebgp-requires-policy
no bgp default ipv4-unicast
bgp bestpath as-path multipath-relax
timers bgp 10 30
neighbor 100.13.13.1 remote-as 1
neighbor 100.13.13.1 advertisement-interval 0
neighbor 100.23.23.2 remote-as 2
neighbor 100.23.23.2 advertisement-interval 0
neighbor 1000:3000::1 remote-as 1
neighbor 1000:3000::1 ebgp-multihop
neighbor 1000:3000::1 update-source 1000:3000::3
neighbor 1000:3000::1 capability extended-nexthop
neighbor 2000:3000::2 remote-as 2
neighbor 2000:3000::2 ebgp-multihop
neighbor 2000:3000::2 update-source 2000:3000::3
neighbor 2000:3000::2 capability extended-nexthop
!
address-family ipv4 unicast
neighbor 100.13.13.1 activate
neighbor 100.23.23.2 activate
exit-address-family
!
address-family ipv6 unicast
redistribute connected route-map color
neighbor 1000:3000::1 activate
neighbor 2000:3000::2 activate
exit-address-family
exit
!
end

router1# show bgp ipv6 unicast 3::3
BGP routing table entry for 3::3/128, version 4
Paths: (1 available, best #1, table default)
Advertised to non peer-group peers:
1000:3000::3 1000:4000::4
3
1000:3000::3 from 1000:3000::3 (3.3.3.3)
(fe80::a8c1:abff:fea8:81f) (used)
Origin incomplete, metric 0, valid, external, best (First path received)
Extended Community: Color:00:300 Color:01:200 Color:10:100
Last update: Thu Oct 24 11:25:35 2024

Add support of color extended community color-only types, RFC 9256.
The type only support 00 01 10.

configuration example:
!
frr version 10.3-dev-my-manual-build
frr defaults traditional
hostname router3
!
route-map color permit 1
 set extcommunity color 10:100 01:200 00:300
exit
!
vrf Vrf1
exit-vrf
!
interface lo
 ipv6 address 3::3/128
exit
!
router bgp 3
 bgp router-id 3.3.3.3
 bgp log-neighbor-changes
 no bgp ebgp-requires-policy
 no bgp default ipv4-unicast
 bgp bestpath as-path multipath-relax
 timers bgp 10 30
 neighbor 100.13.13.1 remote-as 1
 neighbor 100.13.13.1 advertisement-interval 0
 neighbor 100.23.23.2 remote-as 2
 neighbor 100.23.23.2 advertisement-interval 0
 neighbor 1000:3000::1 remote-as 1
 neighbor 1000:3000::1 ebgp-multihop
 neighbor 1000:3000::1 update-source 1000:3000::3
 neighbor 1000:3000::1 capability extended-nexthop
 neighbor 2000:3000::2 remote-as 2
 neighbor 2000:3000::2 ebgp-multihop
 neighbor 2000:3000::2 update-source 2000:3000::3
 neighbor 2000:3000::2 capability extended-nexthop
 !
 address-family ipv4 unicast
  neighbor 100.13.13.1 activate
  neighbor 100.23.23.2 activate
 exit-address-family
 !
 address-family ipv6 unicast
  redistribute connected route-map color
  neighbor 1000:3000::1 activate
  neighbor 2000:3000::2 activate
 exit-address-family
exit
!
end

Signed-off-by: guozhongfeng.gzf <guozhongfeng.gzf@alibaba-inc.com>
Signed-off-by: guozhongfeng.gzf <guozhongfeng.gzf@alibaba-inc.com>
@frrbot frrbot bot added bgp tests Topotests, make check, etc labels Oct 25, 2024
@@ -347,7 +348,7 @@ static inline void encode_color(uint32_t color_id, struct ecommunity_val *eval)
memset(eval, 0, sizeof(*eval));
eval->val[0] = ECOMMUNITY_ENCODE_OPAQUE;
eval->val[1] = ECOMMUNITY_COLOR;
eval->val[2] = 0x00;
eval->val[2] = (as << 6) & 0xff;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is this NEW encoding defined? Could you point to the right RFC (section)?

Copy link
Contributor Author

@guoguojia2021 guoguojia2021 Oct 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this sectino:8.8.1. Color-Only BGP Destination Steering
This section defines an alternative steering mechanism based only on the Color Extended community.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see any paragraph saying about this encoding, or am I blind?

Copy link
Contributor Author

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, now I see. This is called CO flags.

While this is fine, I find the naming confusing. Why these flags are called as?

Copy link
Member

@ton31337 ton31337 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, please fix the frrbot and Verify Source issues.

@@ -347,7 +348,7 @@ static inline void encode_color(uint32_t color_id, struct ecommunity_val *eval)
memset(eval, 0, sizeof(*eval));
eval->val[0] = ECOMMUNITY_ENCODE_OPAQUE;
eval->val[1] = ECOMMUNITY_COLOR;
eval->val[2] = 0x00;
eval->val[2] = (as << 6) & 0xff;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, now I see. This is called CO flags.

While this is fine, I find the naming confusing. Why these flags are called as?

uint8_t color_type;
/* get the color type */
ptr++;
color_type = (*ptr) >> 6;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add the references in the comments about this and where they come from to allow people to find the information faster.

@riw777 riw777 self-requested a review October 29, 2024 14:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bgp master size/M tests Topotests, make check, etc
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants