sonic-net / sonic-buildimage

Scripts which perform an installable binary image build for SONiC
Other
734 stars 1.41k forks source link

[FRR]: bgp-isolate works for ipv4 only #3070

Closed jipanyang closed 5 years ago

jipanyang commented 5 years ago

Steps to reproduce the issue: 1.

root@vlab-01:/home/admin# docker exec -it bgp /bin/bash
root@vlab-01:/# bgp-isolate 

Hello, this is FRRouting (version 7.0.1-sonic).
Copyright 1996-2005 Kunihiro Ishiguro, et al.

vlab-01# 
vlab-01# configure terminal
vlab-01(config)#   router bgp 65100
vlab-01(config-router)#     neighbor 10.0.0.57 route-map ISOLATE out
vlab-01(config-router)#     neighbor 10.0.0.59 route-map ISOLATE out
vlab-01(config-router)#     neighbor 10.0.0.61 route-map ISOLATE out
vlab-01(config-router)#     neighbor 10.0.0.63 route-map ISOLATE out
vlab-01(config-router)#     neighbor fc00::7a route-map ISOLATE out
vlab-01(config-router)#     neighbor fc00::7e route-map ISOLATE out
vlab-01(config-router)#     neighbor fc00::72 route-map ISOLATE out
vlab-01(config-router)#     neighbor fc00::76 route-map ISOLATE out
vlab-01(config-router)#   exit
vlab-01(config)# exit
vlab-01# 
vlab-01# clear ip bgp 10.0.0.57 soft out
vlab-01# clear ip bgp 10.0.0.59 soft out
vlab-01# clear ip bgp 10.0.0.61 soft out
vlab-01# clear ip bgp 10.0.0.63 soft out
vlab-01# clear ip bgp fc00::7a soft out
%BGP: Enable IPv4 Unicast address family for the neighbor fc00::7a
vlab-01# clear ip bgp fc00::7e soft out
%BGP: Enable IPv4 Unicast address family for the neighbor fc00::7e
vlab-01# clear ip bgp fc00::72 soft out
%BGP: Enable IPv4 Unicast address family for the neighbor fc00::72
vlab-01# clear ip bgp fc00::76 soft out
%BGP: Enable IPv4 Unicast address family for the neighbor fc00::76
vlab-01# 
vlab-01# 

2.

"neighbor fc00::72 route-map ISOLATE out" went into "address-family ipv4 unicast"

root@vlab-01:/# vtysh

Hello, this is FRRouting (version 7.0.1-sonic).
Copyright 1996-2005 Kunihiro Ishiguro, et al.

vlab-01# configure t
vlab-01(config)# router bgp 65100
vlab-01(config-router)# do sho run
Building configuration...

Current configuration:
!
frr version 7.0.1-sonic
frr defaults traditional
hostname vlab-01
log syslog informational
log facility local4
agentx
no service integrated-vtysh-config
!
password zebra
enable password zebra
!
ip route 0.0.0.0/0 10.250.0.1 200
!
router bgp 65100
 bgp router-id 10.1.0.32
 bgp log-neighbor-changes
 no bgp default ipv4-unicast
 bgp graceful-restart restart-time 240
 bgp graceful-restart
 bgp graceful-restart preserve-fw-state
 bgp bestpath as-path multipath-relax
 neighbor BGPSLBPassive peer-group
 neighbor BGPSLBPassive remote-as 65432
 neighbor BGPSLBPassive passive
 neighbor BGPSLBPassive ebgp-multihop 255
 neighbor BGPVac peer-group
 neighbor BGPVac remote-as 65432
 neighbor BGPVac passive
 neighbor BGPVac ebgp-multihop 255
 neighbor 10.0.0.57 remote-as 64600
 neighbor 10.0.0.57 description ARISTA01T1
 neighbor 10.0.0.57 timers 3 10
 neighbor 10.0.0.59 remote-as 64600
 neighbor 10.0.0.59 description ARISTA02T1
 neighbor 10.0.0.59 timers 3 10
 neighbor 10.0.0.61 remote-as 64600
 neighbor 10.0.0.61 description ARISTA03T1
 neighbor 10.0.0.61 timers 3 10
 neighbor 10.0.0.63 remote-as 64600
 neighbor 10.0.0.63 description ARISTA04T1
 neighbor 10.0.0.63 timers 3 10
 neighbor fc00::72 remote-as 64600
 neighbor fc00::72 description ARISTA01T1
 neighbor fc00::72 timers 3 10
 neighbor fc00::76 remote-as 64600
 neighbor fc00::76 description ARISTA02T1
 neighbor fc00::76 timers 3 10
 neighbor fc00::7a remote-as 64600
 neighbor fc00::7a description ARISTA03T1
 neighbor fc00::7a timers 3 10
 neighbor fc00::7e remote-as 64600
 neighbor fc00::7e description ARISTA04T1
 neighbor fc00::7e timers 3 10
 bgp listen range 10.255.0.0/25 peer-group BGPSLBPassive
 bgp listen range 192.168.0.0/21 peer-group BGPVac
 !
 address-family ipv4 unicast
  network 10.1.0.32/32
  network 192.168.0.0/21
  neighbor BGPSLBPassive activate
  neighbor BGPSLBPassive soft-reconfiguration inbound
  neighbor BGPSLBPassive route-map FROM_BGP_SPEAKER_V4 in
  neighbor BGPSLBPassive route-map TO_BGP_SPEAKER_V4 out
  neighbor BGPVac activate
  neighbor BGPVac soft-reconfiguration inbound
  neighbor BGPVac route-map FROM_BGP_SPEAKER_V4 in
  neighbor BGPVac route-map TO_BGP_SPEAKER_V4 out
  neighbor 10.0.0.57 activate
  neighbor 10.0.0.57 soft-reconfiguration inbound
  neighbor 10.0.0.57 allowas-in 1
  neighbor 10.0.0.57 route-map ISOLATE out
  neighbor 10.0.0.59 activate
  neighbor 10.0.0.59 soft-reconfiguration inbound
  neighbor 10.0.0.59 allowas-in 1
  neighbor 10.0.0.59 route-map ISOLATE out
  neighbor 10.0.0.61 activate
  neighbor 10.0.0.61 soft-reconfiguration inbound
  neighbor 10.0.0.61 allowas-in 1
  neighbor 10.0.0.61 route-map ISOLATE out
  neighbor 10.0.0.63 activate
  neighbor 10.0.0.63 soft-reconfiguration inbound
  neighbor 10.0.0.63 allowas-in 1
  neighbor 10.0.0.63 route-map ISOLATE out
  neighbor fc00::72 route-map ISOLATE out
  neighbor fc00::76 route-map ISOLATE out
  neighbor fc00::7a route-map ISOLATE out
  neighbor fc00::7e route-map ISOLATE out
  maximum-paths 64
 exit-address-family
 !
 address-family ipv6 unicast
  network fc00:1::/64
  neighbor BGPSLBPassive activate
  neighbor BGPVac activate
  neighbor fc00::72 activate
  neighbor fc00::72 soft-reconfiguration inbound
  neighbor fc00::72 allowas-in 1
  neighbor fc00::72 route-map set-next-hop-global-v6 in
  neighbor fc00::76 activate
  neighbor fc00::76 soft-reconfiguration inbound
  neighbor fc00::76 allowas-in 1
  neighbor fc00::76 route-map set-next-hop-global-v6 in
  neighbor fc00::7a activate
  neighbor fc00::7a soft-reconfiguration inbound
  neighbor fc00::7a allowas-in 1
  neighbor fc00::7a route-map set-next-hop-global-v6 in
  neighbor fc00::7e activate
  neighbor fc00::7e soft-reconfiguration inbound
  neighbor fc00::7e allowas-in 1
  neighbor fc00::7e route-map set-next-hop-global-v6 in
  maximum-paths 64
 exit-address-family
!
route-map RM_SET_SRC6 permit 10
 set src fc00:1::32
!
route-map RM_SET_SRC permit 10
 set src 10.1.0.32
!
route-map set-next-hop-global-v6 permit 10
 set ipv6 next-hop prefer-global 
!
route-map ISOLATE permit 10
 set as-path prepend 65100
!
route-map TO_BGP_SPEAKER_V4 deny 10
!
route-map FROM_BGP_SPEAKER_V4 permit 10
!
ip protocol bgp route-map RM_SET_SRC
!
ipv6 protocol bgp route-map RM_SET_SRC6
!
line vty
!
end
vlab-01(config-router)# 

3. AS 65100 prepended for ipv4 route only on neighbor:

ARISTA01T1#show ip bgp neighbors  10.0.0.56 received-routes
BGP routing table information for VRF default
Router identifier 100.1.0.29, local AS number 64600
Route status codes: s - suppressed, * - valid, > - active, # - not installed, E - ECMP head, e - ECMP
                    S - Stale, c - Contributing to ECMP, b - backup, L - labeled-unicast
Origin codes: i - IGP, e - EGP, ? - incomplete
AS Path Attributes: Or-ID - Originator ID, C-LST - Cluster List, LL Nexthop - Link Local Nexthop

        Network                Next Hop              Metric  LocPref Weight  Path
 * >     10.1.0.32/32           10.0.0.56             0       -       -       65100 65100 i
 * >     192.168.0.0/21         10.0.0.56             0       -       -       65100 65100 i
ARISTA01T1#show ipv6 bgp neighbors fc00::71 received-routes
BGP routing table information for VRF default
Router identifier 100.1.0.29, local AS number 64600
Route status codes: s - suppressed, * - valid, > - active, # - not installed, E - ECMP head, e - ECMP
                    S - Stale, c - Contributing to ECMP, b - backup, L - labeled-unicast
Origin codes: i - IGP, e - EGP, ? - incomplete
AS Path Attributes: Or-ID - Originator ID, C-LST - Cluster List, LL Nexthop - Link Local Nexthop

         Network                Next Hop              Metric  LocPref Weight Path
 * >     fc00:1::/64            fc00::71              0       -       -      65100 i  
ARISTA01T1#

Describe the results you received:

Describe the results you expected:

ARISTA01T1#show ipv6 bgp neighbors fc00::71 received-routes
BGP routing table information for VRF default
Router identifier 100.1.0.29, local AS number 64600
Route status codes: s - suppressed, * - valid, > - active, # - not installed, E - ECMP head, e - ECMP
                    S - Stale, c - Contributing to ECMP, b - backup, L - labeled-unicast
Origin codes: i - IGP, e - EGP, ? - incomplete
AS Path Attributes: Or-ID - Originator ID, C-LST - Cluster List, LL Nexthop - Link Local Nexthop

         Network                Next Hop              Metric  LocPref Weight Path
 * >     fc00:1::/64            fc00::71              0       -       -      65100 65100 i  

Additional information you deem important (e.g. issue happens only occasionally):

pavel-shirshov commented 5 years ago

Fixed https://github.com/Azure/sonic-buildimage/pull/3183