Project

General

Profile

Actions

Bug #13347

open

Setting BGP default-originate route map does not prepend the AS path

Added by Chris Linstruth 3 months ago. Updated 3 months ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
FRR
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Plus Target Version:
Affected Version:
Affected Plus Version:
Affected Architecture:

Description

Setting a route-map on the default-originate statement or outbound routes to a BGP peer does not properly prepend the AS path. Nothing results in a prepend if the route is generated using default-originate. It must be manually added as a BGP network as demonstrated below. Tested on CE 2.6.0 using frr 1.1.1_7 (frr7-7.5.1_3)

See Also: This FRR bug report: https://github.com/FRRouting/frr/pull/9226 (Fixed but only in FRR 8?)

For example:

This does not result in an AS PATH prepend:

router bgp 65001
 bgp log-neighbor-changes
 bgp router-id 172.25.232.1
 bgp network import-check
 neighbor 172.25.16.2 remote-as 64444
 !
 address-family ipv4 unicast
  network 172.31.31.0/24
  neighbor 172.25.16.2 activate
  neighbor 172.25.16.2 default-originate route-map DEFAULT_PREPEND  
  no neighbor 172.25.16.2 send-community
  neighbor 172.25.16.2 route-map ipv4 in
  neighbor 172.25.16.2 route-map ipv4 out
 exit-address-family
 !

route-map DEFAULT_PREPEND permit 10
 description Prepend the default originate
 set as-path prepend 65001 65001 65001

route-map PREPEND_65001 permit 10
 description Prepend outbound routes
 set as-path prepend 65001 65001 65001

route-map ipv4 permit 10
 description need a route map to send/receive routes

Note that FRR thinks it should be prepending:


Shell Output - vtysh -c "show ip bgp neighbors 172.25.16.2 advertised-routes" 

BGP table version is 9, local router ID is 172.25.232.1, vrf id 0
Default local pref 100, local AS 65001
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

Originating default network 0.0.0.0/0

   Network          Next Hop            Metric LocPrf Weight Path
*> 0.0.0.0/0        0.0.0.0                  0         32768 65001 65001 65001 ?
*> 172.31.31.0/24   0.0.0.0                  0         32768 i

Total number of prefixes 2

But it is not (Routes on the peer):

BGP table version is 30, local router ID is 172.25.228.236, vrf id 0
Default local pref 100, local AS 64444
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        172.25.16.1              0             0 65001 ?
*> 172.31.31.0/24   172.25.16.1              0             0 65001 i

Displayed  2 routes and 2 total paths

This does not work either:

router bgp 65001
 bgp log-neighbor-changes
 bgp router-id 172.25.232.1
 bgp network import-check
 neighbor 172.25.16.2 remote-as 64444
 !
 address-family ipv4 unicast
  network 172.31.31.0/24
  neighbor 172.25.16.2 activate
  neighbor 172.25.16.2 default-originate route-map DEFAULT_PREPEND  
  no neighbor 172.25.16.2 send-community
  neighbor 172.25.16.2 route-map ipv4 in
  neighbor 172.25.16.2 route-map PREPEND_65001 out
 exit-address-family
 !

route-map DEFAULT_PREPEND permit 10
 description Prepend the default originate
 set as-path prepend 65001 65001 65001

route-map PREPEND_65001 permit 10
 description Prepend outbound routes
 set as-path prepend 65001 65001 65001

route-map ipv4 permit 10
 description need a route map to send/receive routes

Thinks it should be prepending (Both route-maps should prepend here):


Shell Output - vtysh -c "show ip bgp neighbors 172.25.16.2 advertised-routes" 

BGP table version is 9, local router ID is 172.25.232.1, vrf id 0
Default local pref 100, local AS 65001
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

Originating default network 0.0.0.0/0

   Network          Next Hop            Metric LocPrf Weight Path
*> 0.0.0.0/0        0.0.0.0                  0         32768 65001 65001 65001 ?
*> 172.31.31.0/24   0.0.0.0                  0         32768 65001 65001 65001 i

Total number of prefixes 2

But it's not (Routes on peer):

BGP table version is 32, local router ID is 172.25.228.236, vrf id 0
Default local pref 100, local AS 64444
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        172.25.16.1              0             0 65001 ?
*> 172.31.31.0/24   172.25.16.1              0             0 65001 65001 65001 65001 i

Displayed  2 routes and 2 total paths

Same behavior with no route map defined on default-originate leaving a route-map on the peer (not demonstrated).

This is a workaround:

router bgp 65001
 bgp log-neighbor-changes
 bgp router-id 172.25.232.1
 bgp network import-check
 neighbor 172.25.16.2 remote-as 64444
 !
 address-family ipv4 unicast
  network 172.31.31.0/24
  neighbor 172.25.16.2 activate
  !!!! note no default-originate statement
  no neighbor 172.25.16.2 send-community
  neighbor 172.25.16.2 route-map ipv4 in
  neighbor 172.25.16.2 route-map MY_ROUTES_OUT out
 exit-address-family
 !

ip prefix-list MY_ROUTES seq 10 permit 172.31.31.0/24 
ip prefix-list MY_ROUTES description My announced routes

ip prefix-list default-originate seq 10 permit 0.0.0.0/0 
ip prefix-list default-originate description Default Originate

route-map MY_ROUTES_OUT permit 10
 description default-originate prepend workaround
 match ip address prefix-list default-originate
 set as-path prepend 65001 65001 65001
route-map MY_ROUTES_OUT permit 20
 description My announced prefixes
 match ip address prefix-list MY_ROUTES

Deliberately only prepending 0.0.0.0/0. As seen on peer:

BGP table version is 42, local router ID is 172.25.228.236, vrf id 0
Default local pref 100, local AS 64444
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        172.25.16.1              0             0 65001 65001 65001 65001 i
*> 172.31.31.0/24   172.25.16.1              0             0 65001 i

Displayed  2 routes and 2 total paths

Actions #1

Updated by Chris Linstruth 3 months ago

Side note I quickly tested setting a community using a route map on the default-originate statement and it worked. Seems limited to (at least) as prepend.

Actions

Also available in: Atom PDF