FRRouting / frr

The FRRouting Protocol Suite
https://frrouting.org/
Other
3.36k stars 1.25k forks source link

Default route stopps being advertised after editing prefix-list. #8410

Closed armenhovhannisyan0607 closed 3 years ago

armenhovhannisyan0607 commented 3 years ago

Hello,

Starting from FRR 7.5 when editing prefix-list sometimes prefix stops being advertised. My FRR Version is:7.5.1 OS: Ubuntu 18.04.5 LTS Kernel: 4.15.0-109-generic

Here are the steps to reproduce the issue:

This is my bgp peer configuration:

router bgp 300
 no bgp ebgp-requires-policy
 bgp default show-hostname
 coalesce-time 1000
 bgp graceful-restart
 neighbor 10.0.100.253 remote-as 65541
 neighbor 10.0.100.253 description ID:475 ASN:65541 Name:EBGP-TEST-PREFIX
 address-family ipv4 unicast
  redistribute connected route-map redistribute
  redistribute static route-map redistribute
  neighbor 10.0.100.253 route-map peer475-in in
  neighbor 10.0.100.253 route-map peer475-out out

route-map peer475-out permit 5
 match ip address prefix-list peer475-out-pfxlist
!
route-map peer475-in permit 5
 match ip address prefix-list peer475-in-pfxlist
 set community 0:2
 set local-preference 100

ip prefix-list peer475-out-pfxlist seq 10 deny 10.254.131.0/24
ip prefix-list peer475-out-pfxlist seq 15 deny 172.16.0.0/24
ip prefix-list peer475-out-pfxlist seq 20 deny 100.64.0.0/12
ip prefix-list peer475-out-pfxlist seq 25 permit 1.94.118.0/24
ip prefix-list peer475-out-pfxlist seq 30 permit 2.147.48.0/20
ip prefix-list peer475-out-pfxlist seq 35 permit 2.95.16.0/24
ip prefix-list peer475-out-pfxlist seq 40 permit 2.95.215.0/24
ip prefix-list peer475-out-pfxlist seq 5 deny 10.254.128.0/24 le 32
ip prefix-list peer475-out-pfxlist seq 45 permit 2.138.0.0/16
ip prefix-list peer475-out-pfxlist seq 50 permit 0.0.0.0/0

With this configuration prefixes advertised to this peer are following:

Softgate-node2# show ip bgp neighbors 10.0.100.253 advertised-routes
BGP table version is 116753532, local router ID is 10.254.132.32, vrf id 0
Default local pref 100, local AS 300
Status codes:  s suppressed, d damped, h history, * valid, > best, = multipath,
               i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes:  i - IGP, e - EGP, ? - incomplete
   Network          Next Hop            Metric LocPrf Weight Path
*> 0.0.0.0/0        0.0.0.0                       150      0 i
*> 2.95.16.0/24     0.0.0.0                       150      0 65515 201986 12297 3216 ?
*> 2.95.215.0/24    0.0.0.0                       150      0 65515 201986 12297 3216 ?
*> 2.138.0.0/16     0.0.0.0                       150      0 65515 201986 6682 1299 12956 3352 i
*> 2.147.48.0/20    0.0.0.0                       150      0 65515 201986 196709 3356 5511 49666 44244 i

now we change prefix list to be as following (just adding le/32 to one of records):

ip prefix-list peer475-out-pfxlist seq 10 deny 10.254.131.0/24
ip prefix-list peer475-out-pfxlist seq 15 deny 172.16.0.0/24
ip prefix-list peer475-out-pfxlist seq 20 deny 100.64.0.0/12
ip prefix-list peer475-out-pfxlist seq 25 permit 1.94.118.0/24
ip prefix-list peer475-out-pfxlist seq 30 permit 2.147.48.0/20
ip prefix-list peer475-out-pfxlist seq 35 permit 2.95.16.0/24
ip prefix-list peer475-out-pfxlist seq 40 permit 2.95.215.0/24
ip prefix-list peer475-out-pfxlist seq 5 deny 10.254.128.0/24 le 32
ip prefix-list peer475-out-pfxlist seq 50 permit 0.0.0.0/0
ip prefix-list peer475-out-pfxlist seq 45 permit 2.138.0.0/16 le 32

as you can see frr automatically reshuffles the order (not the sequence just the order) in the config for 0.0.0.0.0/0, this reshuffling occurs in 7.2 also, however in 7.5 and 7.5.1 after this change default route stopped being advertised:

Softgate-node2# show ip bgp neighbors 10.0.100.253 advertised-routes
BGP table version is 116753829, local router ID is 10.254.132.32, vrf id 0
Default local pref 100, local AS 300
Status codes:  s suppressed, d damped, h history, * valid, > best, = multipath,
               i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes:  i - IGP, e - EGP, ? - incomplete
   Network          Next Hop            Metric LocPrf Weight Path
*> 2.95.16.0/24     0.0.0.0                       150      0 65515 201986 12297 3216 ?
*> 2.95.215.0/24    0.0.0.0                       150      0 65515 201986 12297 3216 ?
*> 2.138.0.0/16     0.0.0.0                       150      0 65515 201986 6682 1299 12956 3352 i
*> 2.147.48.0/20    0.0.0.0                       150      0 65515 201986 196709 3356 5511 49666 44244 i

just removing this config and putting it back resolves the issue and default route is still being advertised:

no ip prefix-list peer475-out-pfxlist seq 50 permit 0.0.0.0/0
ip prefix-list peer475-out-pfxlist seq 50 permit 0.0.0.0/0

Appreciate your help and suggestions on this. Many thanks in advance.

taspelund commented 3 years ago

I see the same behavior on master branch using this config. I'll dig into it

taspelund commented 3 years ago

Looks like this can be reproduced with a very simple config:

router bgp 300
 neighbor 192.168.122.51 remote-as 65541
 address-family ipv4 unicast
! my default route is learned via dhcp, so I'm just redistributing the kernel route
  redistribute kernel
  neighbor 192.168.122.51 route-map peer475-out out
 exit-address-family
!
route-map peer475-out permit 5
 match ip address prefix-list peer475-out-pfxlist
!
ip prefix-list peer475-out-pfxlist seq 45 permit 2.138.0.0/16
ip prefix-list peer475-out-pfxlist seq 50 permit 0.0.0.0/0

e.g.

ub20# conf t                   
ub20(config)# router bgp 300
ub20(config-router)#  neighbor 192.168.122.51 remote-as 65541                                                                                                            
ub20(config-router)#  address-family ipv4 unicast                                                                                                                        
ub20(config-router-af)#   redistribute kernel
ub20(config-router-af)#   neighbor 192.168.122.51 route-map peer475-out out
The route-map 'peer475-out' does not exist.                                                                                                                              
ub20(config-router-af)#  exit-address-family
ub20(config-router)# !
ub20(config-router)# route-map peer475-out permit 5
ub20(config-route-map)#  match ip address prefix-list peer475-out-pfxlist
ub20(config-route-map)# !
ub20(config-route-map)# ip prefix-list peer475-out-pfxlist seq 45 permit 2.138.0.0/16
ub20(config)# ip prefix-list peer475-out-pfxlist seq 50 permit 0.0.0.0/0
ub20(config)# 
ub20(config)# do show ip bgp                                                                                                                                             
BGP table version is 1, local router ID is 100.64.0.222, vrf id 0                                                                                                        
Default local pref 100, local AS 300                                                                                                                                     
Status codes:  s suppressed, d damped, h history, * valid, > best, = multipath,                                                                                          
               i internal, r RIB-failure, S Stale, R Removed                                                                                                             
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self                                                                                                                 
Origin codes:  i - IGP, e - EGP, ? - incomplete                                                                                                                          

   Network          Next Hop            Metric LocPrf Weight Path                                                                                                        
*> 0.0.0.0/0        192.168.122.1            0         32768 ?                                                                                                           

Displayed  1 routes and 1 total paths                                                                                                                                    
ub20(config)# do show ip bgp sum                                                                                                                                         

IPv4 Unicast Summary:
BGP router identifier 100.64.0.222, local AS number 300 vrf-id 0
BGP table version 1
RIB entries 1, using 184 bytes of memory
Peers 1, using 27 KiB of memory

Neighbor        V         AS   MsgRcvd   MsgSent   TblVer  InQ OutQ  Up/Down State/PfxRcd   PfxSnt Desc
192.168.122.51  4      65541         4         4        0    0    0 00:00:07     (Policy)        1 N/A     <<<<<<<<<  PfxSnt is 1 for just the default

Total number of neighbors 1
ub20(config)# ip prefix-list peer475-out-pfxlist seq 45 permit 2.138.0.0/16 le 32    
# relatively short delay here
ub20(config)# do show ip bgp sum

IPv4 Unicast Summary:
BGP router identifier 100.64.0.222, local AS number 300 vrf-id 0
BGP table version 1
RIB entries 1, using 184 bytes of memory
Peers 1, using 27 KiB of memory

Neighbor        V         AS   MsgRcvd   MsgSent   TblVer  InQ OutQ  Up/Down State/PfxRcd   PfxSnt Desc
192.168.122.51  4      65541         5         5        0    0    0 00:00:16     (Policy)        0 N/A     <<<<<<<<<  PfxSnt drops to 0

Total number of neighbors 1
taspelund commented 3 years ago

Just submitted #8718 to address this