]> git.proxmox.com Git - mirror_frr.git/log
mirror_frr.git
3 years agoMerge pull request #7352 from mjstapp/fix_rt_netlink_indent
Donald Sharp [Wed, 28 Oct 2020 00:07:15 +0000 (20:07 -0400)]
Merge pull request #7352 from mjstapp/fix_rt_netlink_indent

zebra: fix strange indentation

3 years agoMerge pull request #7395 from donaldsharp/isis_rv_leak
Mark Stapp [Tue, 27 Oct 2020 20:26:09 +0000 (16:26 -0400)]
Merge pull request #7395 from donaldsharp/isis_rv_leak

isisd: Fix memory leak in copy_tlv_router_cap

3 years agoisisd: Fix memory leak in copy_tlv_router_cap
Donald Sharp [Tue, 27 Oct 2020 16:40:46 +0000 (12:40 -0400)]
isisd: Fix memory leak in copy_tlv_router_cap

There exists a code path where we would allocate memory
then test a variable and then immediately return NULL.
Prevent memory from leaking in this situation.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
3 years agoMerge pull request #7158 from AnuradhaKaruppiah/mh-df-election
Patrick Ruddy [Tue, 27 Oct 2020 16:09:45 +0000 (16:09 +0000)]
Merge pull request #7158 from AnuradhaKaruppiah/mh-df-election

evpn-mh: support for DF election

3 years agozebra: fix strange indentation
Mark Stapp [Tue, 20 Oct 2020 18:04:48 +0000 (14:04 -0400)]
zebra: fix strange indentation

Fix some odd indentation in rt_netlink.c - merge damage, maybe?

Signed-off-by: Mark Stapp <mjs@voltanet.io>
3 years agoMerge pull request #7381 from sworleys/NHG-Show-Proto-Filter
Mark Stapp [Tue, 27 Oct 2020 15:33:00 +0000 (11:33 -0400)]
Merge pull request #7381 from sworleys/NHG-Show-Proto-Filter

zebra: add type specifier to show nexthop-group

3 years agoMerge pull request #7390 from donaldsharp/evpn_uptime
Russ White [Tue, 27 Oct 2020 15:32:17 +0000 (11:32 -0400)]
Merge pull request #7390 from donaldsharp/evpn_uptime

Evpn uptime

3 years agoMerge pull request #7370 from eololab/add-missing-daemon-in-watchfrr-conf-file
Donald Sharp [Tue, 27 Oct 2020 15:29:26 +0000 (11:29 -0400)]
Merge pull request #7370 from eololab/add-missing-daemon-in-watchfrr-conf-file

tools: add staticd line in daemon config file

3 years agoMerge pull request #7329 from idryzhov/fix-ip-route-table
Stephen Worley [Tue, 27 Oct 2020 15:27:39 +0000 (11:27 -0400)]
Merge pull request #7329 from idryzhov/fix-ip-route-table

staticd: fix checks for table param in "ip route" commands

3 years agoMerge pull request #7189 from maduri111/bgpd-conditional-adv
Rafael Zalamena [Tue, 27 Oct 2020 15:24:24 +0000 (12:24 -0300)]
Merge pull request #7189 from maduri111/bgpd-conditional-adv

bgpd: conditional advertisement

3 years agoMerge pull request #7173 from ckishimo/force
Donald Sharp [Tue, 27 Oct 2020 15:22:23 +0000 (11:22 -0400)]
Merge pull request #7173 from ckishimo/force

ospfd: fix lsa type-7 continuously refreshed

3 years agoMerge pull request #7026 from chiragshah6/yang_nb5
Donald Sharp [Tue, 27 Oct 2020 15:18:43 +0000 (11:18 -0400)]
Merge pull request #7026 from chiragshah6/yang_nb5

*: Convert bgp afi-safis configurations to transactional clis

3 years agoMerge pull request #7341 from kssoman/nssa_fix
Olivier Dugeon [Tue, 27 Oct 2020 14:30:31 +0000 (15:30 +0100)]
Merge pull request #7341 from kssoman/nssa_fix

ospfd: External LSA not flushed when area is configured as NSSA

3 years agobgpd: conditional advertisement - copyright
Madhuri Kuruganti [Tue, 27 Oct 2020 10:43:42 +0000 (16:13 +0530)]
bgpd: conditional advertisement - copyright

Signed-off-by: Madhuri Kuruganti <k.madhuri@samsung.com>
3 years agobgpd: conditional advertisement - topotests-2
Madhuri Kuruganti [Fri, 23 Oct 2020 16:09:12 +0000 (21:39 +0530)]
bgpd: conditional advertisement - topotests-2

Signed-off-by: Madhuri Kuruganti <k.madhuri@samsung.com>
3 years agobgpd: conditional advertisement - topotests
Madhuri Kuruganti [Tue, 13 Oct 2020 20:14:27 +0000 (01:44 +0530)]
bgpd: conditional advertisement - topotests

Router2# show ip bgp neighbors 10.10.20.3 json

!--- Output suppressed.

    "addressFamilyInfo":{
      "ipv4Unicast":{
        "updateGroupId":2,
        "subGroupId":2,
        "packetQueueLength":0,
        "inboundSoftConfigPermit":true,
        "commAttriSentToNbr":"extendedAndStandard",
        "advertiseMap":{
          "condition":"NON_EXIST",
          "conditionMap":"EXIST-MAP",
          "advertiseMap":"ADV-MAP",
          "advertiseStatus":"Withdraw"
        },
        "acceptedPrefixCounter":0,
        "sentPrefixCounter":2
      },
      "ipv6Unicast":{
        "inboundSoftConfigPermit":true,
        "commAttriSentToNbr":"extendedAndStandard",
        "advertiseMap":{
          "condition":"EXIST",
          "conditionMap":"ALLOW_ALL",
          "advertiseMap":"ALLOW_ALL",
          "advertiseStatus":"Advertise"
        },
        "acceptedPrefixCounter":0
      }
    },

!--- Output suppressed.

router@router:~/frr/tests/topotests/bgp_conditional_advertisement$ sudo pytest -s test_bgp_conditional_advertisement.py
[sudo] password for router:
mkdir: cannot create directory ‘/tmp/topotests’: File exists
2020-10-14 17:00:46,649 INFO: Running environment diagnostics
=========================================================================================== test session starts ============================================================================================
platform linux2 -- Python 2.7.17, pytest-4.6.11, py-1.9.0, pluggy-0.13.1
rootdir: /home/router/frr/tests/topotests, inifile: pytest.ini
collected 2 items

test_bgp_conditional_advertisement.py 2020-10-14 17:00:47,137 INFO: Testsuite start time: Wed Oct 14 17:00:47 2020
2020-10-14 17:00:47,137 INFO: ========================================
2020-10-14 17:00:47,138 INFO: Running setup_module to create topology
2020-10-14 17:00:48,711 INFO: loading topology: bgp_conditional_advertisement.test_bgp_conditional_advertisement
2020-10-14 17:00:48,712 INFO: starting topology: bgp_conditional_advertisement.test_bgp_conditional_advertisement
2020-10-14 17:00:49,042 INFO: r1: running version: 7.6-dev-MyOwnFRRVersion-gd77fe2dd0
2020-10-14 17:00:51,284 INFO: r2: running version: 7.6-dev-MyOwnFRRVersion-gd77fe2dd0
2020-10-14 17:00:53,582 INFO: r3: running version: 7.6-dev-MyOwnFRRVersion-gd77fe2dd0
2020-10-14 17:00:55,826 INFO: Running setup_module() done
2020-10-14 17:00:57,747 INFO: '_all_routes_advertised' polling started (interval 1 secs, maximum wait 130 secs)
2020-10-14 17:00:58,262 INFO: '_all_routes_advertised' succeeded after 0.52 seconds
2020-10-14 17:00:58,262 INFO: TC11: "router3" BGP convergence - PASSED!!!
2020-10-14 17:00:58,863 INFO: '_exist_map_routes_present' polling started (interval 1 secs, maximum wait 90 secs)
2020-10-14 17:00:59,419 INFO: '_exist_map_routes_present' succeeded after 0.56 seconds
2020-10-14 17:00:59,419 INFO: TC21: exist-map routes present in "router2" BGP table - PASSED!!!
2020-10-14 17:01:00,017 INFO: '_exist_map_routes_not_present' polling started (interval 1 secs, maximum wait 90 secs)
2020-10-14 17:02:00,192 INFO: '_exist_map_routes_not_present' succeeded after 60.18 seconds
2020-10-14 17:02:00,192 INFO: TC22: exist-map routes not present in "router2" BGP table - PASSED!!!
2020-10-14 17:02:00,736 INFO: '_non_exist_map_routes_not_present' polling started (interval 1 secs, maximum wait 90 secs)
2020-10-14 17:02:59,215 INFO: '_non_exist_map_routes_not_present' succeeded after 58.48 seconds
2020-10-14 17:02:59,215 INFO: TC31: non-exist-map routes not present in "router2" BGP table - PASSED!!!
2020-10-14 17:02:59,968 INFO: '_non_exist_map_routes_present' polling started (interval 1 secs, maximum wait 90 secs)
2020-10-14 17:03:59,300 INFO: '_non_exist_map_routes_present' succeeded after 59.33 seconds
2020-10-14 17:03:59,300 INFO: TC32: non-exist-map routes present in "router2" BGP table - PASSED!!!
2020-10-14 17:03:59,919 INFO: '_non_exist_map_no_condition_route_map' polling started (interval 1 secs, maximum wait 90 secs)
2020-10-14 17:05:00,306 INFO: '_non_exist_map_no_condition_route_map' succeeded after 60.39 seconds
2020-10-14 17:05:00,306 INFO: TC41: non-exist-map route-map removed in "router2" - PASSED!!!
2020-10-14 17:05:01,024 INFO: '_exist_map_no_condition_route_map' polling started (interval 1 secs, maximum wait 90 secs)
2020-10-14 17:05:59,405 INFO: '_exist_map_no_condition_route_map' succeeded after 58.38 seconds
2020-10-14 17:05:59,406 INFO: TC42: exist-map route-map removed in "router2" - PASSED!!!
2020-10-14 17:05:59,941 INFO: '_exist_map_routes_present_rmap_filter' polling started (interval 1 secs, maximum wait 90 secs)
2020-10-14 17:06:59,622 INFO: '_exist_map_routes_present_rmap_filter' succeeded after 59.68 seconds
2020-10-14 17:06:59,622 INFO: TC51: exist-map routes present with route-map filter - PASSED!!!
2020-10-14 17:07:00,150 INFO: '_exist_map_routes_present_no_rmap_filter' polling started (interval 1 secs, maximum wait 90 secs)
2020-10-14 17:07:00,688 INFO: '_exist_map_routes_present_no_rmap_filter' succeeded after 0.54 seconds
2020-10-14 17:07:00,688 INFO: TC52: exist-map routes present, no route-map filter - PASSED!!!
2020-10-14 17:07:01,229 INFO: '_non_exist_map_routes_present_rmap_filter' polling started (interval 1 secs, maximum wait 90 secs)
2020-10-14 17:07:01,767 INFO: '_non_exist_map_routes_present_rmap_filter' succeeded after 0.54 seconds
2020-10-14 17:07:01,767 INFO: TC53: non-exist-map routes present, with route-map filter - PASSED!!!
2020-10-14 17:07:02,321 INFO: '_non_exist_map_routes_present_no_rmap_filter' polling started (interval 1 secs, maximum wait 90 secs)
2020-10-14 17:08:00,419 INFO: '_non_exist_map_routes_present_no_rmap_filter' succeeded after 58.10 seconds
2020-10-14 17:08:00,419 INFO: TC54: non-exist-map routes present, no route-map filter - PASSED!!!
2020-10-14 17:08:01,485 INFO: '_exist_map_routes_not_present_rmap_filter' polling started (interval 1 secs, maximum wait 90 secs)
2020-10-14 17:08:02,039 INFO: '_exist_map_routes_not_present_rmap_filter' succeeded after 0.55 seconds
2020-10-14 17:08:02,039 INFO: TC61: exist-map routes not present, route-map filter - PASSED!!!
2020-10-14 17:08:02,568 INFO: '_exist_map_routes_not_present_no_rmap_filter' polling started (interval 1 secs, maximum wait 90 secs)
2020-10-14 17:08:59,147 INFO: '_exist_map_routes_not_present_no_rmap_filter' succeeded after 56.58 seconds
2020-10-14 17:08:59,147 INFO: TC62: exist-map routes not present, no route-map filter - PASSED!!!
2020-10-14 17:08:59,686 INFO: '_non_exist_map_routes_not_present_rmap_filter' polling started (interval 1 secs, maximum wait 90 secs)
2020-10-14 17:09:59,354 INFO: '_non_exist_map_routes_not_present_rmap_filter' succeeded after 59.67 seconds
2020-10-14 17:09:59,354 INFO: TC63: non-exist-map routes not present, route-map filter - PASSED!!!
2020-10-14 17:09:59,886 INFO: '_non_exist_map_routes_not_present_no_rmap_filter' polling started (interval 1 secs, maximum wait 90 secs)
2020-10-14 17:10:00,424 INFO: '_non_exist_map_routes_not_present_no_rmap_filter' succeeded after 0.54 seconds
2020-10-14 17:10:00,424 INFO: TC64: non-exist-map routes not present, no route-map filter - PASSED!!!
.2020-10-14 17:10:01,989 INFO: assert skipped at "bgp_conditional_advertisement.test_bgp_conditional_advertisement/test_memory_leak": Memory leak test/report is disabled
s2020-10-14 17:10:01,989 INFO: Running teardown_module to delete topology
2020-10-14 17:10:01,990 INFO: stopping topology: bgp_conditional_advertisement.test_bgp_conditional_advertisement
2020-10-14 17:10:01,990 INFO: stopping "s2"
2020-10-14 17:10:01,990 INFO: stopping "s1"
2020-10-14 17:10:01,993 INFO: r1: stopping bgpd
2020-10-14 17:10:01,995 INFO: r1: stopping staticd
2020-10-14 17:10:02,010 INFO: r1: stopping zebra
2020-10-14 17:10:02,013 INFO: r1: stopping bgpd
2020-10-14 17:10:02,015 INFO: r1: stopping zebra
2020-10-14 17:10:02,025 INFO: r1: waiting for daemons stopping: bgpd, zebra (0.1 seconds)
2020-10-14 17:10:02,143 INFO: r2: stopping bgpd
2020-10-14 17:10:02,147 INFO: r2: stopping staticd
2020-10-14 17:10:02,152 INFO: r2: stopping zebra
2020-10-14 17:10:02,156 INFO: r2: stopping bgpd
2020-10-14 17:10:02,164 INFO: r2: stopping zebra
2020-10-14 17:10:02,175 INFO: r2: waiting for daemons stopping: zebra (0.1 seconds)
2020-10-14 17:10:02,291 INFO: r3: stopping bgpd
2020-10-14 17:10:02,302 INFO: r3: stopping staticd
2020-10-14 17:10:02,309 INFO: r3: stopping zebra
2020-10-14 17:10:02,313 INFO: r3: stopping bgpd
2020-10-14 17:10:02,316 INFO: r3: stopping zebra
2020-10-14 17:10:02,323 INFO: r3: waiting for daemons stopping: zebra (0.1 seconds)
2020-10-14 17:10:03,615 INFO: Testsuite end time: Wed Oct 14 17:10:03 2020
2020-10-14 17:10:03,615 INFO: ========================================

================================================================================== 1 passed, 1 skipped in 556.55 seconds ===================================================================================

Signed-off-by: Madhuri Kuruganti <k.madhuri@samsung.com>
temp

Signed-off-by: Madhuri Kuruganti <k.madhuri@samsung.com>
3 years agobgpd: conditional advertisement - comments addressed and few checks
Madhuri Kuruganti [Fri, 9 Oct 2020 08:29:49 +0000 (13:59 +0530)]
bgpd: conditional advertisement - comments addressed and few checks

Signed-off-by: Madhuri Kuruganti <k.madhuri@samsung.com>
3 years agobgpd: conditional advertisement - comments addressed
Madhuri Kuruganti [Wed, 7 Oct 2020 12:10:00 +0000 (17:40 +0530)]
bgpd: conditional advertisement - comments addressed

Signed-off-by: Madhuri Kuruganti <k.madhuri@samsung.com>
3 years agobgpd: conditional advertisement - other match rules support
Madhuri Kuruganti [Mon, 5 Oct 2020 17:40:56 +0000 (23:10 +0530)]
bgpd: conditional advertisement - other match rules support

Sample Configuration with prefix-list and community match rules
---------------------------------------------------------------

R1 ------- R2(DUT) ------- R3

Router2# show running-config
Building configuration...

Current configuration:
!
frr version 7.6-dev-MyOwnFRRVersion
frr defaults traditional
hostname router
log file /var/log/frr/bgpd.log
log syslog informational
hostname Router2
service integrated-vtysh-config
!
debug bgp updates in
debug bgp updates out
!
debug route-map
!
ip route 20.20.0.0/16 blackhole
ipv6 route 2001:db8::200/128 blackhole
!
interface enp0s9
 ip address 10.10.10.2/24
!
interface enp0s10
 ip address 10.10.20.2/24
!
interface lo
 ip address 2.2.2.2/32
!
router bgp 2
 bgp log-neighbor-changes
 no bgp ebgp-requires-policy
 neighbor 10.10.10.1 remote-as 1
 neighbor 10.10.20.3 remote-as 3
 !
 address-family ipv4 unicast
  neighbor 10.10.10.1 soft-reconfiguration inbound
  neighbor 10.10.20.3 soft-reconfiguration inbound
  neighbor 10.10.20.3 advertise-map ADV-MAP non-exist-map EXIST-MAP
 exit-address-family
!
ip prefix-list DEFAULT seq 5 permit 1.1.1.5/32
ip prefix-list DEFAULT seq 10 permit 1.1.1.1/32
ip prefix-list EXIST seq 5 permit 10.10.10.10/32
ip prefix-list DEFAULT-ROUTE seq 5 permit 0.0.0.0/0
ip prefix-list IP1 seq 5 permit 10.139.224.0/20
ip prefix-list T2 seq 5 permit 1.1.1.5/32
!
bgp community-list standard DC-ROUTES seq 5 permit 64952:3008
bgp community-list standard DC-ROUTES seq 10 permit 64671:501
bgp community-list standard DC-ROUTES seq 15 permit 64950:3009
bgp community-list standard DEFAULT-ROUTE seq 5 permit 65013:200
!
route-map ADV-MAP permit 10
 match ip address prefix-list IP1
!
route-map ADV-MAP permit 20
 match community DC-ROUTES
!
route-map EXIST-MAP permit 10
 match community DEFAULT-ROUTE
 match ip address prefix-list DEFAULT-ROUTE
!
line vty
!
end
Router2#

Router2# show ip bgp 0.0.0.0
BGP routing table entry for 0.0.0.0/0
Paths: (1 available, best #1, table default)
  Advertised to non peer-group peers:
  10.10.10.1 10.10.20.3
  1
    10.10.10.1 from 10.10.10.1 (10.139.224.1)
      Origin IGP, metric 0, valid, external, best (First path received)
      Community: 64848:3011 65011:200 65013:200
      Last update: Tue Oct  6 02:39:42 2020
Router2#

Sample output with non-exist-map when default route present in table
--------------------------------------------------------------------
Router2# show ip bgp
BGP table version is 4, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
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        10.10.10.1               0             0 1 i
*> 1.1.1.1/32       10.10.10.1               0             0 1 i
*> 1.1.1.5/32       10.10.10.1               0             0 1 i
*> 10.139.224.0/20  10.10.10.1               0             0 1 ?

Displayed  4 routes and 4 total paths

Router2# show ip bgp neighbors 10.10.20.3 advertised-routes
BGP table version is 4, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
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                                0 1 i
*> 1.1.1.5/32       0.0.0.0                                0 1 i    <<<<<<<<<  non-exist-map : 0.0.0.0/0 is present so, 10.139.224.0/20 not advertised

Total number of prefixes 2

Sample output with non-exist-map when default route not present in table
------------------------------------------------------------------------
Router2# show ip bgp
BGP table version is 5, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
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
*> 1.1.1.1/32       10.10.10.1               0             0 1 i
*> 1.1.1.5/32       10.10.10.1               0             0 1 i
*> 10.139.224.0/20  10.10.10.1               0             0 1 ?

Displayed  3 routes and 3 total paths
Router2#
Router2#
Router2# show ip bgp neighbors 10.10.20.3 advertised-routes
BGP table version is 5, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
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
*> 1.1.1.1/32       0.0.0.0                                0 1 i
*> 1.1.1.5/32       0.0.0.0                                0 1 i
*> 10.139.224.0/20  0.0.0.0                                0 1 ?                <<<<<<<<<  non-exist-map : 0.0.0.0/0 is not present so, 10.139.224.0/20 advertised

Total number of prefixes 3
Router2#

Sample output with exist-map when default route present in table
--------------------------------------------------------------------
Router2# show ip bgp
BGP table version is 8, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
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        10.10.10.1               0             0 1 i
*> 1.1.1.1/32       10.10.10.1               0             0 1 i
*> 1.1.1.5/32       10.10.10.1               0             0 1 i
*> 10.139.224.0/20  10.10.10.1               0             0 1 ?

Displayed  4 routes and 4 total paths
Router2#
Router2#
Router2#
Router2#
Router2# show ip bgp neighbors 10.10.20.3 advertised-routes
BGP table version is 8, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
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                                0 1 i
*> 1.1.1.1/32       0.0.0.0                                0 1 i
*> 1.1.1.5/32       0.0.0.0                                0 1 i
*> 10.139.224.0/20  0.0.0.0                                0 1 ? <<<<<<<<<  exist-map : 0.0.0.0/0 is present so, 10.139.224.0/20 advertised

Total number of prefixes 4
Router2#

Sample output with exist-map when default route not present in table
--------------------------------------------------------------------
Router2# show ip bgp
BGP table version is 9, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
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
*> 1.1.1.1/32       10.10.10.1               0             0 1 i
*> 1.1.1.5/32       10.10.10.1               0             0 1 i
*> 10.139.224.0/20  10.10.10.1               0             0 1 ?

Displayed  3 routes and 3 total paths
Router2#
Router2#
Router2#
Router2# show ip bgp neighbors 10.10.20.3 advertised-routes
BGP table version is 9, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
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
*> 1.1.1.5/32       0.0.0.0                                0 1 i <<<<<<<<<  exist-map : 0.0.0.0/0 is not present so, 10.139.224.0/20 not advertised

Total number of prefixes 1
Router2#

Signed-off-by: Madhuri Kuruganti <k.madhuri@samsung.com>
3 years agobgpd: conditional advertisement - with route-map filter
Madhuri Kuruganti [Thu, 1 Oct 2020 20:40:48 +0000 (02:10 +0530)]
bgpd: conditional advertisement - with route-map filter

Sample configuration along with route-map filter
------------------------------------------------
Router2# show running-config
Building configuration...

Current configuration:
!
frr version 7.6-dev-MyOwnFRRVersion
frr defaults traditional
hostname router
log file /var/log/frr/bgpd.log
log syslog informational
hostname Router2
service integrated-vtysh-config
!
debug bgp updates in
debug bgp updates out
!
debug route-map
!
ip route 200.200.0.0/16 blackhole
ipv6 route 2001:db8::200/128 blackhole
!
interface enp0s9
 ip address 10.10.10.2/24
!
interface enp0s10
 ip address 10.10.20.2/24
!
interface lo
 ip address 2.2.2.2/24
 ipv6 address 2001:db8::2/128
!
router bgp 2
 bgp log-neighbor-changes
 no bgp ebgp-requires-policy
 neighbor 10.10.10.1 remote-as 1
 neighbor 10.10.20.3 remote-as 3
 !
 address-family ipv4 unicast
  network 2.2.2.0/24
  network 200.200.0.0/16
  neighbor 10.10.10.1 soft-reconfiguration inbound
  neighbor 10.10.10.1 route-map RMAP_PERMIT_100 out
  neighbor 10.10.10.1 advertise-map ADVERTISE non-exist-map CONDITION
  neighbor 10.10.20.3 soft-reconfiguration inbound
 exit-address-family
 !
 address-family ipv6 unicast
  network 2001:db8::2/128
  network 2001:db8::200/128
  neighbor 10.10.10.1 activate
  neighbor 10.10.10.1 soft-reconfiguration inbound
  neighbor 10.10.10.1 route-map CONDITION_6 out
  neighbor 10.10.10.1 advertise-map ADVERTISE_6 non-exist-map CONDITION_6
  neighbor 10.10.20.3 activate
  neighbor 10.10.20.3 soft-reconfiguration inbound
 exit-address-family
!
access-list CONDITION seq 5 permit 3.3.3.0/24
access-list ADVERTISE seq 6 permit 200.200.0.0/16
access-list ADVERTISE seq 7 permit 20.20.0.0/16
access-list ADVERTISE seq 5 permit 2.2.2.0/24
access-list RMAP_PERMIT_100 seq 4 permit 100.100.0.0/16
!
ipv6 access-list ADVERTISE_6 seq 5 permit 2001:db8::2/128
ipv6 access-list CONDITION_6 seq 5 permit 2001:db8::3/128
!
route-map ADVERTISE permit 10
 match ip address ADVERTISE
!
route-map CONDITION permit 10
 match ip address CONDITION
!
route-map ADVERTISE_6 permit 10
 match ipv6 address ADVERTISE_6
!
route-map CONDITION_6 permit 10
 match ipv6 address CONDITION_6
!
route-map RMAP_PERMIT_100 permit 10
 match ip address RMAP_PERMIT_100
!
line vty
!
end

Sample output when non-exist-map prefixes present in BGP table
--------------------------------------------------------------
Router2# show ip bgp all wide

For address family: IPv4 Unicast
BGP table version is 5, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
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
*> 1.1.1.0/24                                   10.10.10.1                                     0             0 1 i
*> 2.2.2.0/24                                   0.0.0.0                                        0         32768 i
*> 3.3.3.0/24                                   10.10.20.3                                     0             0 3 i
*> 100.100.0.0/16                               10.10.20.3                                     0             0 3 i
*> 200.200.0.0/16                               0.0.0.0                                        0         32768 i

Displayed  5 routes and 5 total paths

For address family: IPv6 Unicast
BGP table version is 4, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
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
*> 2001:db8::1/128                              fe80::a00:27ff:fecb:ad57                       0             0 1 i
*> 2001:db8::2/128                              ::                                             0         32768 i
*> 2001:db8::3/128                              fe80::a00:27ff:fe76:6738                       0             0 3 i
*> 2001:db8::200/128                            ::                                             0         32768 i

Displayed  4 routes and 4 total paths
Router2#
Router2#
Router2#
Router2#
Router2# show ip bgp all neighbors 10.10.10.1 advertised-routes wide

For address family: IPv4 Unicast
BGP table version is 5, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
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
*> 100.100.0.0/16                               0.0.0.0                                                      0 3 i

Total number of prefixes 1

For address family: IPv6 Unicast
BGP table version is 4, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
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
*> 2001:db8::3/128                              ::                                                           0 3 i

Total number of prefixes 1
Router2#

Sample output when non-exist-map prefixes not present in BGP table
------------------------------------------------------------------
Router2# show ip bgp all wide

For address family: IPv4 Unicast
BGP table version is 6, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
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
*> 1.1.1.0/24                                   10.10.10.1                                     0             0 1 i
*> 2.2.2.0/24                                   0.0.0.0                                        0         32768 i
*> 100.100.0.0/16                               10.10.20.3                                     0             0 3 i
*> 200.200.0.0/16                               0.0.0.0                                        0         32768 i

Displayed  4 routes and 4 total paths

For address family: IPv6 Unicast
BGP table version is 5, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
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
*> 2001:db8::1/128                              fe80::a00:27ff:fecb:ad57                       0             0 1 i
*> 2001:db8::2/128                              ::                                             0         32768 i
*> 2001:db8::200/128                            ::                                             0         32768 i

Displayed  3 routes and 3 total paths
Router2#

Router2# show ip bgp all neighbors 10.10.10.1 advertised-routes wide

For address family: IPv4 Unicast
BGP table version is 6, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
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.2.2.0/24                                   0.0.0.0                                        0         32768 i
*> 100.100.0.0/16                               0.0.0.0                                                      0 3 i
*> 200.200.0.0/16                               0.0.0.0                                        0         32768 i

Total number of prefixes 3

For address family: IPv6 Unicast
BGP table version is 5, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
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
*> 2001:db8::2/128                              ::                                             0         32768 i

Total number of prefixes 1
Router2#

Signed-off-by: Madhuri Kuruganti <k.madhuri@samsung.com>
3 years agobgpd: conditional advertisement
Madhuri Kuruganti [Tue, 29 Sep 2020 09:46:04 +0000 (15:16 +0530)]
bgpd: conditional advertisement

Implemented as per the feature description given in the source link.

Descriprion:
The BGP conditional advertisement feature uses the non-exist-map or exist-map
and the advertise-map keywords of the neighbor advertise-map command in order
to track routes by the route prefix.

non-exist-map :
If a route prefix is not present in output of the non-exist-map command, then
the route specified by the advertise-map command is announced.

exist-map :
If a route prefix is present in output of the exist-map command, then the route
specified by the advertise-map command is announced.

The conditional BGP announcements are sent in addition to the normal
announcements that a BGP router sends to its peers.

The conditional advertisement process is triggered by the BGP scanner process,
which runs every 60 seconds. This means that the maximum time for the conditional
advertisement to take effect is 60 seconds. The conditional advertisement can take
effect sooner, depending on when the tracked route is removed from the BGP table
and when the next instance of the BGP scanner occurs.

Sample Configuration on DUT
---------------------------
Router2# show running-config
Building configuration...

Current configuration:
!
frr version 7.6-dev-MyOwnFRRVersion
frr defaults traditional
hostname router
log file /var/log/frr/bgpd.log
log syslog informational
hostname Router2
service integrated-vtysh-config
!
debug bgp updates in
debug bgp updates out
!
debug route-map
!
ip route 200.200.0.0/16 blackhole
ipv6 route 2001:db8::200/128 blackhole
!
interface enp0s9
 ip address 10.10.10.2/24
!
interface enp0s10
 ip address 10.10.20.2/24
!
interface lo
 ip address 2.2.2.2/24
 ipv6 address 2001:db8::2/128
!
router bgp 2
 bgp log-neighbor-changes
 no bgp ebgp-requires-policy
 neighbor 10.10.10.1 remote-as 1
 neighbor 10.10.20.3 remote-as 3
 !
 address-family ipv4 unicast
  network 2.2.2.0/24
  network 200.200.0.0/16
  neighbor 10.10.10.1 soft-reconfiguration inbound
  neighbor 10.10.10.1 advertise-map ADVERTISE non-exist-map CONDITION
  neighbor 10.10.20.3 soft-reconfiguration inbound
 exit-address-family
 !
 address-family ipv6 unicast
  network 2001:db8::2/128
  network 2001:db8::200/128
  neighbor 10.10.10.1 activate
  neighbor 10.10.10.1 soft-reconfiguration inbound
  neighbor 10.10.10.1 advertise-map ADVERTISE_6 non-exist-map CONDITION_6
  neighbor 10.10.20.3 activate
  neighbor 10.10.20.3 soft-reconfiguration inbound
 exit-address-family
!
access-list CONDITION seq 5 permit 3.3.3.0/24
access-list ADVERTISE seq 5 permit 2.2.2.0/24
access-list ADVERTISE seq 6 permit 200.200.0.0/16
access-list ADVERTISE seq 7 permit 20.20.0.0/16
!
ipv6 access-list ADVERTISE_6 seq 5 permit 2001:db8::2/128
ipv6 access-list CONDITION_6 seq 5 permit 2001:db8::3/128
!
route-map ADVERTISE permit 10
 match ip address ADVERTISE
!
route-map CONDITION permit 10
 match ip address CONDITION
!
route-map ADVERTISE_6 permit 10
 match ipv6 address ADVERTISE_6
!
route-map CONDITION_6 permit 10
 match ipv6 address CONDITION_6
!
line vty
!
end
Router2#

Withdraw when non-exist-map prefixes present in BGP table:
----------------------------------------------------------
Router2# show ip bgp all wide

For address family: IPv4 Unicast
BGP table version is 8, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
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
*> 1.1.1.0/24                                   10.10.10.1                                     0             0 1 i
*> 2.2.2.0/24                                   0.0.0.0                                        0         32768 i
*> 3.3.3.0/24                                   10.10.20.3                                     0             0 3 i
*> 200.200.0.0/16                               0.0.0.0                                        0         32768 i

Displayed  4 routes and 4 total paths

For address family: IPv6 Unicast
BGP table version is 8, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
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
*> 2001:db8::1/128                              fe80::a00:27ff:fecb:ad57                       0             0 1 i
*> 2001:db8::2/128                              ::                                             0         32768 i
*> 2001:db8::3/128                              fe80::a00:27ff:fe76:6738                       0             0 3 i
*> 2001:db8::200/128                            ::                                             0         32768 i

Displayed  4 routes and 4 total paths
Router2#

Router2# show ip bgp neighbors 10.10.10.1
BGP neighbor is 10.10.10.1, remote AS 1, local AS 2, external link

!--- Output suppressed.

 For address family: IPv4 Unicast
  Update group 9, subgroup 5
  Packet Queue length 0
  Inbound soft reconfiguration allowed
  Community attribute sent to this neighbor(all)
  Condition NON_EXIST, Condition-map *CONDITION, Advertise-map *ADVERTISE, status: Withdraw
  1 accepted prefixes

 For address family: IPv6 Unicast
  Update group 10, subgroup 6
  Packet Queue length 0
  Inbound soft reconfiguration allowed
  Community attribute sent to this neighbor(all)
  Condition NON_EXIST, Condition-map *CONDITION_6, Advertise-map *ADVERTISE_6, status: Withdraw
  1 accepted prefixes

!--- Output suppressed.

Router2#

Here 2.2.2.0/24 & 200.200.0.0/16 (prefixes in advertise-map) are withdrawn
by conditional advertisement scanner as the prefix(3.3.3.0/24) specified
by non-exist-map is present in BGP table.

Router2# show ip bgp all neighbors 10.10.10.1 advertised-routes wide

For address family: IPv4 Unicast
BGP table version is 8, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
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
*> 1.1.1.0/24                                   0.0.0.0                                                      0 1 i
*> 3.3.3.0/24                                   0.0.0.0                                                      0 3 i

Total number of prefixes 2

For address family: IPv6 Unicast
BGP table version is 8, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
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
*> 2001:db8::1/128                              ::                                                           0 1 i
*> 2001:db8::3/128                              ::                                                           0 3 i
*> 2001:db8::200/128                            ::                                             0         32768 i

Total number of prefixes 3
Router2#

Advertise when non-exist-map prefixes not present in BGP table:
---------------------------------------------------------------
After Removing 3.3.3.0/24 (prefix present in non-exist-map),
2.2.2.0/24 & 200.200.0.0/16 (prefixes present in advertise-map) are advertised

Router2# show ip bgp all wide

For address family: IPv4 Unicast
BGP table version is 9, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
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
*> 1.1.1.0/24                                   10.10.10.1                                     0             0 1 i
*> 2.2.2.0/24                                   0.0.0.0                                        0         32768 i
*> 200.200.0.0/16                               0.0.0.0                                        0         32768 i

Displayed  3 routes and 3 total paths

For address family: IPv6 Unicast
BGP table version is 9, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
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
*> 2001:db8::1/128                              fe80::a00:27ff:fecb:ad57                       0             0 1 i
*> 2001:db8::2/128                              ::                                             0         32768 i
*> 2001:db8::200/128                            ::                                             0         32768 i

Displayed  3 routes and 3 total paths
Router2#

Router2# show ip bgp neighbors 10.10.10.1

!--- Output suppressed.

 For address family: IPv4 Unicast
  Update group 9, subgroup 5
  Packet Queue length 0
  Inbound soft reconfiguration allowed
  Community attribute sent to this neighbor(all)
  Condition NON_EXIST, Condition-map *CONDITION, Advertise-map *ADVERTISE, status: Advertise
  1 accepted prefixes

 For address family: IPv6 Unicast
  Update group 10, subgroup 6
  Packet Queue length 0
  Inbound soft reconfiguration allowed
  Community attribute sent to this neighbor(all)
  Condition NON_EXIST, Condition-map *CONDITION_6, Advertise-map *ADVERTISE_6, status: Advertise
  1 accepted prefixes

!--- Output suppressed.

Router2#
Router2# show ip bgp all neighbors 10.10.10.1 advertised-routes wide

For address family: IPv4 Unicast
BGP table version is 9, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
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
*> 1.1.1.0/24                                   0.0.0.0                                                      0 1 i
*> 2.2.2.0/24                                   0.0.0.0                                        0         32768 i
*> 200.200.0.0/16                               0.0.0.0                                        0         32768 i

Total number of prefixes 3

For address family: IPv6 Unicast
BGP table version is 9, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 2
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
*> 2001:db8::1/128                              ::                                                           0 1 i
*> 2001:db8::2/128                              ::                                             0         32768 i
*> 2001:db8::200/128                            ::                                             0         32768 i

Total number of prefixes 3
Router2#

Signed-off-by: Madhuri Kuruganti <k.madhuri@samsung.com>
3 years agoMerge pull request #7393 from chiragshah6/mdev
Donatas Abraitis [Tue, 27 Oct 2020 09:35:37 +0000 (11:35 +0200)]
Merge pull request #7393 from chiragshah6/mdev

bgpd: fix mem leak in router bgp import vrf check

3 years agoMerge pull request #7389 from donaldsharp/no_bfdd
Donatas Abraitis [Tue, 27 Oct 2020 09:35:21 +0000 (11:35 +0200)]
Merge pull request #7389 from donaldsharp/no_bfdd

bgpd: Fix profiles compile issue when not using bfdd

3 years agoMerge pull request #7387 from dslicenc/bgp-update-delay-local
Santosh P K [Tue, 27 Oct 2020 08:44:54 +0000 (14:14 +0530)]
Merge pull request #7387 from dslicenc/bgp-update-delay-local

bgpd: delay local routes until update-delay is over

3 years agobgpd: fix mem leak in router bgp import vrf check
Chirag Shah [Tue, 27 Oct 2020 05:18:46 +0000 (22:18 -0700)]
bgpd: fix mem leak in router bgp import vrf check

==916511== 18 bytes in 2 blocks are definitely lost in loss record 7 of 147
==916511==    at 0x483877F: malloc (vg_replace_malloc.c:307)
==916511==    by 0x4BE0F0A: strdup (strdup.c:42)
==916511==    by 0x48D66CE: qstrdup (memory.c:122)
==916511==    by 0x1E6E31: bgp_vpn_leak_export (bgp_mplsvpn.c:2690)
==916511==    by 0x28E892: bgp_router_create (bgp_nb_config.c:124)
==916511==    by 0x48E05AB: nb_callback_create (northbound.c:869)
==916511==    by 0x48E0FA2: nb_callback_configuration (northbound.c:1183)
==916511==    by 0x48E13D0: nb_transaction_process (northbound.c:1308)
==916511==    by 0x48E0137: nb_candidate_commit_apply (northbound.c:741)
==916511==    by 0x48E024B: nb_candidate_commit (northbound.c:773)
==916511==    by 0x48E6B21: nb_cli_classic_commit (northbound_cli.c:64)
==916511==    by 0x48E757E: nb_cli_apply_changes (northbound_cli.c:281)

Signed-off-by: Chirag Shah <chirag@nvidia.com>
3 years agozebra: Add uptime to `show evpn mac vni ... detail`
Donald Sharp [Mon, 26 Oct 2020 20:46:03 +0000 (16:46 -0400)]
zebra: Add uptime to `show evpn mac vni ... detail`

Add the uptime a mac entry has been in the system.

New Output:

eva# show evpn mac vni all detail

VNI 1000 #MACs (local and remote) 16

MAC: 4e:2d:f3:75:ff:db
 ESI: 03:44:38:39:ff:ff:01:00:00:02
 Intf: hostbond2(10) VLAN: 1000
 Sync-info: neigh#: 0 peer-active
 Local Seq: 0 Remote Seq: 0
 Uptime: 00:00:28
 Neighbors:
    No Neighbors

MAC: 7a:a4:f2:30:dd:5d
 ESI: 03:44:38:39:ff:ff:01:00:00:01
 Intf: hostbond1(9) VLAN: 1000
 Sync-info: neigh#: 0 peer-active
 Local Seq: 0 Remote Seq: 0
 Uptime: 00:00:28
 Neighbors:
    No Neighbors

MAC: 66:9e:d7:3a:f1:f1
 Remote VTEP: 192.168.100.18
 Sync-info: neigh#: 0
 Local Seq: 0 Remote Seq: 0
 Uptime: 00:00:26
 Neighbors:
    45.0.0.5 Active
    fe80::649e:d7ff:fe3a:f1f1 Active

MAC: 26:f1:bd:5f:e1:77
 Remote ES: 03:44:38:39:ff:ff:02:00:00:02
 Sync-info: neigh#: 0
 Local Seq: 0 Remote Seq: 0
 Uptime: 00:00:23
 Neighbors:
    No Neighbors

MAC: 16:80:eb:c4:43:6d
 ESI: 03:44:38:39:ff:ff:01:00:00:01
 Intf: hostbond1(9) VLAN: 1000
 Sync-info: neigh#: 0 peer-active
 Local Seq: 0 Remote Seq: 0
 Uptime: 00:00:28
 Neighbors:
    No Neighbors

MAC: 00:00:00:00:00:22
 Remote ES: 03:44:38:39:ff:ff:02:00:00:02
 Sync-info: neigh#: 0
 Local Seq: 0 Remote Seq: 0
 Uptime: 00:00:26
 Neighbors:
    No Neighbors

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
3 years agozebra: Add uptime to `show evpn arp-cache vni .. detail`
Donald Sharp [Mon, 26 Oct 2020 20:34:05 +0000 (16:34 -0400)]
zebra: Add uptime to `show evpn arp-cache vni .. detail`

Add uptime data to `show evpn arp-cache vni ... detail` command.

Effectively when we create a neighbor entry store the time it
was created.  When we modify the neighbor entry store the time it
was modified.  Display under detail output and json output.

New output:
eva# show evpn arp-cache vni all detail

VNI 1000 #ARP (IPv4 and IPv6, local and remote) 8

IP: 45.0.0.5
 Type: remote
 State: active
 Uptime: 00:01:59
 MAC: 0a:fd:87:ca:7c:00
 Sync-info: -
 Remote VTEP: 192.168.100.18
 Local Seq: 0 Remote Seq: 0
IP: fe80::8fd:87ff:feca:7c00
 Type: remote
 State: active
 Uptime: 00:01:59
 MAC: 0a:fd:87:ca:7c:00
 Sync-info: -
 Remote VTEP: 192.168.100.18
 Local Seq: 0 Remote Seq: 0
IP: fe80::14e5:c2ff:fe50:fa59
 Type: local
 State: active
 Uptime: 00:02:04
 MAC: 16:e5:c2:50:fa:59
 Sync-info: -
 Local Seq: 0 Remote Seq: 0
IP: 45.0.0.3
 Type: remote
 State: active
 Uptime: 00:02:02
 MAC: 0e:50:e8:cf:6b:eb
 Sync-info: -
 Remote VTEP: 192.168.100.16
 Local Seq: 0 Remote Seq: 0
IP: 45.0.0.2
 Type: local
 State: active
 Uptime: 00:02:05
 MAC: 16:e5:c2:50:fa:59
 Sync-info: -
 Local Seq: 0 Remote Seq: 0
IP: fe80::c50:e8ff:fecf:6beb
 Type: remote
 State: active
 Uptime: 00:02:02
 MAC: 0e:50:e8:cf:6b:eb
 Sync-info: -
 Remote VTEP: 192.168.100.16
 Local Seq: 0 Remote Seq: 0
IP: 45.0.0.4
 Type: remote
 State: active
 Uptime: 00:01:55
 MAC: 02:ad:5f:d8:da:80
 Sync-info: -
 Remote VTEP: 192.168.100.17
 Local Seq: 0 Remote Seq: 0
IP: fe80::ad:5fff:fed8:da80
 Type: remote
 State: active
 Uptime: 00:01:55
 MAC: 02:ad:5f:d8:da:80
 Sync-info: -
 Remote VTEP: 192.168.100.17
 Local Seq: 0 Remote Seq: 0
eva#

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
3 years agoMerge pull request #7376 from mjstapp/fix_pim_align
Quentin Young [Mon, 26 Oct 2020 20:24:00 +0000 (16:24 -0400)]
Merge pull request #7376 from mjstapp/fix_pim_align

pimd: Fix pim address-of-unaligned error and use of zlog_warn

3 years agozebra,doc: add type specifier to show nexthop-group
Stephen Worley [Fri, 23 Oct 2020 18:28:50 +0000 (14:28 -0400)]
zebra,doc: add type specifier to show nexthop-group

Add a type specifier to the `show nexthop-group` command
so we can easily filter by type when using proto created
nexthop groups.

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
3 years agobgpd: cleanup inet_ntoa in the bgp_evpn_mh debug logs
Anuradha Karuppiah [Mon, 19 Oct 2020 17:42:39 +0000 (10:42 -0700)]
bgpd: cleanup inet_ntoa in the bgp_evpn_mh debug logs

Replaced inet_ntoa with %pI4 in the debug logs.

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
3 years agozebra: cleanup inet_ntoa usage in zebra_evpn_mh.c logs
Anuradha Karuppiah [Mon, 19 Oct 2020 17:35:44 +0000 (10:35 -0700)]
zebra: cleanup inet_ntoa usage in zebra_evpn_mh.c logs

Replaced inet_ntoa with %pI4 in the zebra debugs logs.

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
3 years agotopotest: tests for evpn-mh DF via Type-4 routes
Anuradha Karuppiah [Fri, 18 Sep 2020 17:58:14 +0000 (10:58 -0700)]
topotest: tests for evpn-mh DF via Type-4 routes

Change DF preference and validate DF role.

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
3 years agozebra: add json output for zebra ES, ES-EVI and access vlan dumps
Anuradha Karuppiah [Sun, 17 May 2020 17:59:30 +0000 (10:59 -0700)]
zebra: add json output for zebra ES, ES-EVI and access vlan dumps

1. ES
root@torm-11:mgmt:~# vtysh -c "show evpn es 03:44:38:39:ff:ff:01:00:00:01 json"
|python -m json.tool
{
    "accessPort": "hostbond1",
    "dfPreference": 50000,
    "esi": "03:44:38:39:ff:ff:01:00:00:01",
    "flags": [
        "local",
        "remote",
        "readyForBgp",
        "bridgePort",
        "operUp",
        "nexthopGroupActive"
    ],
    "macCount": 10,
    "nexthopGroup": 536870913,
    "vniCount": 10,
    "vteps": [
        {
            "dfAlgorithm": "preference",
            "dfPreference": 32767,
            "nexthopId": 268435460,
            "vtep": "27.0.0.16"
        },
        {
            "dfAlgorithm": "preference",
            "dfPreference": 32767,
            "nexthopId": 268435463,
            "vtep": "27.0.0.17"
        }
    ]
}
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

2. ES-EVI -
root@torm-11:mgmt:~# vtysh -c "show evpn es-evi vni 1001 detail json" |python -m json.tool
[
    {
        "esi": "03:44:38:39:ff:ff:01:00:00:01",
        "flags": [
            "local",
            "readyForBgp"
        ],
        "vni": 1001
    },
    {
        "esi": "03:44:38:39:ff:ff:01:00:00:02",
        "flags": [
            "local",
            "readyForBgp"
        ],
        "vni": 1001
    },
]
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

3. access-vlan
root@torm-11:mgmt:~# vtysh -c "show evpn access-vlan 1001 json" |python -m json.
tool
{
    "memberIfCount": 4,
    "members": [
        {
            "ifName": "hostbond4"
        },
        {
            "ifName": "hostbond1"
        },
        {
            "ifName": "hostbond2"
        },
        {
            "ifName": "hostbond3"
        }
    ],
    "vlan": 1001,
    "vni": 1001,
    "vxlanIf": "vx-1001"
}
root@torm-11:mgmt:~#
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
3 years agolib, bgpd: move json_array_string_add to lib
Anuradha Karuppiah [Sun, 17 May 2020 17:57:35 +0000 (10:57 -0700)]
lib, bgpd: move json_array_string_add to lib

json_array_string_add is used to add a string entry into a JSON
list. This API is needed by zebra so moving it from bgpd to lib.

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
3 years agozebra: handle local-es bridge port association
Anuradha Karuppiah [Tue, 14 Apr 2020 15:30:09 +0000 (08:30 -0700)]
zebra: handle local-es bridge port association

A local ES can be added or removed to a bridge after it is created.
When it becomes a bridge port member the dataplane attributes need
to be programmed.

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
3 years agozebra: changes for programming SPH, non-DF and backup NHG br-port attrs
Anuradha Karuppiah [Mon, 13 Apr 2020 22:56:03 +0000 (15:56 -0700)]
zebra: changes for programming SPH, non-DF and backup NHG br-port attrs

split horizon filter, non-DF block filter and backup nexthop group
are passed as bridge port attributes to the dataplane.

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
3 years agozebra: dplane APIs for programming evpn-mh access port attributes
Anuradha Karuppiah [Fri, 8 May 2020 23:53:25 +0000 (16:53 -0700)]
zebra: dplane APIs for programming evpn-mh access port attributes

This includes -
1. non-DF block filter
2. List of es-peers that need to be blocked per-access port (for
split horizon filtering)
3. Backup nexthop group to failover local-es via the VxLAN overlay

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
3 years agozebra: changes to run DF election
Anuradha Karuppiah [Fri, 8 May 2020 23:41:43 +0000 (16:41 -0700)]
zebra: changes to run DF election

1. DF preference is configurable per-ES
!
interface hostbond1
 evpn mh es-df-pref 100 >>>>>>>>>>>
 evpn mh es-id 1
 evpn mh es-sys-mac 00:00:00:00:01:11
!
2. This parameter is sent to BGP and advertised via the ESR.
3. The peer-ESs' DF params are sent to zebra (by BGP) and used
for running the DF election.
4. If the local VTEP becomes non-DF on an ES a block filter is
programmed in the dataplane to drop de-capsulated BUM packets
destined to that ES.

Sample output
=============
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
torm-11# sh evpn es
Type: L local, R remote, N non-DF
ESI                            Type ES-IF                 VTEPs
03:00:00:00:00:01:11:00:00:01  LRN  hostbond1             27.0.0.16
03:00:00:00:00:01:22:00:00:02  LR   hostbond2             27.0.0.16
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
torm-11# sh evpn es 03:00:00:00:00:01:11:00:00:01
ESI: 03:00:00:00:00:01:11:00:00:01
 Type: Local,Remote
 Interface: hostbond1
 State: up
 Ready for BGP: yes
 VNI Count: 10
 MAC Count: 2
 DF: status: non-df preference: 100 >>>>>>>>
 Nexthop group: 0x2000001
 VTEPs:
     27.0.0.16 df_alg: preference df_pref: 32767 nh: 0x100000d >>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
3 years agobgpd: support for DF election in EVPN-MH
Anuradha Karuppiah [Fri, 8 May 2020 23:35:09 +0000 (16:35 -0700)]
bgpd: support for DF election in EVPN-MH

DF (Designated forwarder) election is used for picking a single
BUM-traffic forwarded per-ES. RFC7432 specifies a mechanism called
service carving for DF election. However that mechanism has many
disadvantages -
1. LBs poorly.
2. Doesn't allow for a controlled failover needed in upgrade
scenarios.
3. Not easy to hw accelerate.

To fix the poor performance of service carving alternate DF mechanisms
have been proposed via the following drafts -
draft-ietf-bess-evpn-df-election-framework
draft-ietf-bess-evpn-pref-df

This commit adds support for the pref-df election mechanism which
is used as the default. Other mechanisms including service-carving
may be added later.

In this mechanism one switch on an ES is elected as DF based on the
preference value; higher preference wins with IP address acting
as the tie-breaker (lower-IP wins if pref value is the same).

Sample output
=============
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
torm-11# sh bgp l2vpn evpn es 03:00:00:00:00:01:11:00:00:01
ESI: 03:00:00:00:00:01:11:00:00:01
 Type: LR
 RD: 27.0.0.15:6
 Originator-IP: 27.0.0.15
 Local ES DF preference: 100
 VNI Count: 10
 Remote VNI Count: 10
 Inconsistent VNI VTEP Count: 0
 Inconsistencies: -
 VTEPs:
  27.0.0.16 flags: EA df_alg: preference df_pref: 32767
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
torm-11# sh bgp l2vpn evpn route esi 03:00:00:00:00:01:11:00:00:01
*> [4]:[03:00:00:00:00:01:11:00:00:01]:[32]:[27.0.0.15]
                    27.0.0.15                          32768 i
                    ET:8 ES-Import-Rt:00:00:00:00:01:11 DF: (alg: 2, pref: 100)
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
3 years agoMerge pull request #7384 from opensourcerouting/nb-dyn-modules
Quentin Young [Mon, 26 Oct 2020 17:14:30 +0000 (13:14 -0400)]
Merge pull request #7384 from opensourcerouting/nb-dyn-modules

lib: add API to load YANG modules on demand

3 years agotools: add comment on staticd in daemon config file
Emanuele Bovisio [Thu, 22 Oct 2020 12:47:35 +0000 (14:47 +0200)]
tools: add comment on staticd in daemon config file

staticd is always started, so no need to specify it explicitly

Signed-off-by: Emanuele Bovisio <emanuele.bovisio@eolo.it>
3 years agoMerge pull request #7388 from donaldsharp/more_string
Mark Stapp [Mon, 26 Oct 2020 16:24:10 +0000 (12:24 -0400)]
Merge pull request #7388 from donaldsharp/more_string

More string

3 years agobgpd: add nb support for suppress-map in aggregate cmd
Chirag Shah [Fri, 23 Oct 2020 18:28:11 +0000 (11:28 -0700)]
bgpd: add nb support for suppress-map in aggregate cmd

Signed-off-by: Chirag Shah <chirag@nvidia.com>
3 years agobgpd: convert distance bgp source cmd to defpy
Chirag Shah [Wed, 14 Oct 2020 00:57:33 +0000 (17:57 -0700)]
bgpd: convert distance bgp source cmd to defpy

Consolidate v4/v6 prefix with/without acl name distance source
command to DEFPY.

Signed-off-by: Chirag Shah <chirag@nvidia.com>
3 years agobgpd: convert bgp dampening cli to defpy
Chirag Shah [Wed, 14 Oct 2020 19:36:42 +0000 (12:36 -0700)]
bgpd: convert bgp dampening cli to defpy

Signed-off-by: Chirag Shah <chirag@nvidia.com>
3 years agobgpd: add match-med nb support in aggregate cmd
Chirag Shah [Sun, 11 Oct 2020 23:27:42 +0000 (16:27 -0700)]
bgpd: add match-med nb support in aggregate cmd

Signed-off-by: Chirag Shah <chirag@nvidia.com>
3 years agobgpd: convert addr-family clis to transactional clis
Chirag Shah [Wed, 19 Aug 2020 04:21:16 +0000 (21:21 -0700)]
bgpd: convert addr-family clis to transactional clis

Convert IPv4 and IPv6 unicast address family clis
to transactional clis and implementation of
northbound callbacks.

Signed-off-by: Chirag Shah <chirag@nvidia.com>
3 years agolib: handle exit cmd for bgp afi-safi nodes
Chirag Shah [Thu, 27 Aug 2020 19:49:45 +0000 (12:49 -0700)]
lib: handle exit cmd for bgp afi-safi nodes

In transactional cli mode, bgp address-family <afi> <afi>
node builds xpath on top of `router bgp` node's xpath.
When `exit` is applied under afi-safi commands, retain
xpath_index to 1 to keep using bgp global xpath.

Signed-off-by: Chirag Shah <chirag@nvidia.com>
3 years agoyang: update bgp module afi-safi parameters
Chirag Shah [Tue, 11 Aug 2020 23:58:14 +0000 (16:58 -0700)]
yang: update bgp module afi-safi parameters

add vnc-direct route-type.

Signed-off-by: Chirag Shah <chirag@nvidia.com>
3 years agobgpd: Fix profiles compile issue when not using bfdd
Donald Sharp [Mon, 26 Oct 2020 15:25:28 +0000 (11:25 -0400)]
bgpd: Fix profiles compile issue when not using bfdd

When compiling w/ --enable-bfdd=no we get warnings
about functions not being used.

Add a #if check to include it as needed.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
3 years agozebra: Fix prefix2str buf and some invalid data output in zebra_mpls.c
Donald Sharp [Mon, 26 Oct 2020 13:29:52 +0000 (09:29 -0400)]
zebra: Fix prefix2str buf and some invalid data output in zebra_mpls.c

There are several places where prefix2str was used to convert
a prefix but they were debug guarded and the buffer was
used for flog_err/warn.  This would lead to corrupt data
being output in the failure cases if debugs were not turned
on.

Modify the code in zebra_mpls.c to not use prefix2str

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
3 years agozebra: Replace some prefix2str with %pFX
Donald Sharp [Mon, 26 Oct 2020 13:17:35 +0000 (09:17 -0400)]
zebra: Replace some prefix2str with %pFX

We are loading a buffer with the prefix2str results then
using it in the debugs throughout functions.  Replace
with just using %pFX and remove the buffer.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
3 years agopbrd: Remove inet_ntoa usage from pbr
Donald Sharp [Mon, 26 Oct 2020 13:36:17 +0000 (09:36 -0400)]
pbrd: Remove inet_ntoa usage from pbr

Convert over to using %pI4 for the last inet_ntoa

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
3 years agobgpd: delay local routes until update-delay is over
Don Slice [Wed, 21 Oct 2020 14:46:49 +0000 (07:46 -0700)]
bgpd: delay local routes until update-delay is over

Problem found that turning an update-delay would only delay prefixes
learned from peers by delaying bestpath, but would allow local routes
(network statements or redistributed) to be immediately advertised,
followed by an End of Rib indicator. This fix delays sending local
routes until the update-delay process is completed, which matches
what testing shows other vendors do..

Ticket: CM-31743
Signed-off-by: Don Slice <dslice@nvidia.com>
3 years agoMerge pull request #7217 from AnuradhaKaruppiah/fix-es-del-regression
Patrick Ruddy [Mon, 26 Oct 2020 10:12:54 +0000 (10:12 +0000)]
Merge pull request #7217 from AnuradhaKaruppiah/fix-es-del-regression

zebra: fix double clearing of zif->es_info.es

3 years agoMerge pull request #7194 from qlyoung/tracing
Mark Stapp [Sat, 24 Oct 2020 20:50:35 +0000 (16:50 -0400)]
Merge pull request #7194 from qlyoung/tracing

Tracing

3 years agoMerge pull request #7374 from sworleys/Revert-Revert-NHG-Dependents
Mark Stapp [Sat, 24 Oct 2020 20:49:09 +0000 (16:49 -0400)]
Merge pull request #7374 from sworleys/Revert-Revert-NHG-Dependents

zebra: Fix the NHG dependents relationship

3 years agoMerge pull request #7377 from donaldsharp/bgp_static_leak
Renato Westphal [Sat, 24 Oct 2020 18:29:34 +0000 (15:29 -0300)]
Merge pull request #7377 from donaldsharp/bgp_static_leak

bgpd: Bgp static routes memory leak

3 years agoMerge pull request #7379 from donaldsharp/isis_mem_leak
Renato Westphal [Sat, 24 Oct 2020 18:28:18 +0000 (15:28 -0300)]
Merge pull request #7379 from donaldsharp/isis_mem_leak

isisd: Fix memory leak on shutdown

3 years agoospfd: External LSA not flushed when area is configured as nssa or stub
Soman K S [Sun, 18 Oct 2020 11:49:32 +0000 (17:19 +0530)]
ospfd: External LSA not flushed when area is configured as nssa or stub

Issue:
When the ospf area is changed from default to nssa or stub, the previously
advertised external LSAs are not removed from the neighbor.
The LSAs remain in database till maxage timeout.

Fix:
Advertise the external LSAs with age set to maxage and flood to the
nssa or stub area.

Signed-off-by: kssoman <somanks@gmail.com>
3 years agoMerge pull request #7380 from Orange-OpenSource/ospf-sr
Donald Sharp [Sat, 24 Oct 2020 01:28:06 +0000 (21:28 -0400)]
Merge pull request #7380 from Orange-OpenSource/ospf-sr

Add more Segment Routing controls

3 years agoMerge pull request #7382 from sworleys/Fix-Msg-Buff
Mark Stapp [Fri, 23 Oct 2020 22:05:04 +0000 (18:05 -0400)]
Merge pull request #7382 from sworleys/Fix-Msg-Buff

zebra: fix unitialized msg header reading at startup

3 years agolib: add API to load YANG modules on demand
Renato Westphal [Tue, 20 Oct 2020 03:20:48 +0000 (00:20 -0300)]
lib: add API to load YANG modules on demand

Make it possible to load YANG modules outside the main northbound
initialization. The primary use case is to support YANG modules
that are specific to an FRR plugin. Example: only load the PCEP
YANG module when the corresponding FRR plugin is loaded. Other use
cases might arise in the future.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
3 years agolib: combine two YANG schema iteration functions into one
Renato Westphal [Fri, 23 Oct 2020 01:19:10 +0000 (22:19 -0300)]
lib: combine two YANG schema iteration functions into one

Combine yang_snodes_iterate_module() and yang_snodes_iterate_all()
into an unified yang_snodes_iterate() function, where the first
"module" parameter is optional. There's no point in having two
separate YANG schema iteration functions anymore now that they are
too similar.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
3 years agolib: fix iteration over schema nodes of a single YANG module
Renato Westphal [Tue, 20 Oct 2020 02:56:54 +0000 (23:56 -0300)]
lib: fix iteration over schema nodes of a single YANG module

The only safe way to iterate over all schema nodes of a given YANG
module is by iterating over all schema nodes of all YANG modules
and filter out the nodes that belong to other modules.

The original yang_snodes_iterate_module() code did the following:
1 - Iterate over all top-level schema nodes of the given module;
2 - Iterate over all augmentations of the given module.

While that iteration strategy is more efficient, it does't handle
well more complex YANG hierarchies containing nested augmentations
or self-augmenting modules. Any iteration that isn't done on the
resolved YANG data hierarchy is fragile and prone to errors.

Fixes regression introduced by commit 8a923b48513316b where the
gen_northbound_callbacks tool was generating duplicate callbacks
for certain modules.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
3 years agobgpd: clean up trace header style a bit
Quentin Young [Fri, 23 Oct 2020 19:23:12 +0000 (15:23 -0400)]
bgpd: clean up trace header style a bit

Signed-off-by: Quentin Young <qlyoung@nvidia.com>
3 years agobgpd: move packet read tracepoint out of mutex
Quentin Young [Thu, 8 Oct 2020 20:54:37 +0000 (16:54 -0400)]
bgpd: move packet read tracepoint out of mutex

Signed-off-by: Quentin Young <qlyoung@nvidia.com>
3 years agodoc: add developer docs for tracing
Quentin Young [Tue, 29 Sep 2020 00:12:41 +0000 (20:12 -0400)]
doc: add developer docs for tracing

Signed-off-by: Quentin Young <qlyoung@nvidia.com>
3 years agolib, bgpd: convert lttng tracepoints to frrtrace()
Quentin Young [Mon, 28 Sep 2020 22:13:27 +0000 (18:13 -0400)]
lib, bgpd: convert lttng tracepoints to frrtrace()

- tracepoint() -> frrtrace()
- tracelog() -> frrtracelog()
- tracepoint_enabled() -> frrtrace_enabled()

Also removes copypasta'd #ifdefs for those LTTng macros, those are
handled in lib/trace.h

Signed-off-by: Quentin Young <qlyoung@nvidia.com>
3 years agolib: add trace.h, frrtrace(), support for USDT
Quentin Young [Mon, 28 Sep 2020 21:22:53 +0000 (17:22 -0400)]
lib: add trace.h, frrtrace(), support for USDT

Previous commits added LTTng tracepoints. This was primarily for testing
/ trial purposes; in practice we'd like to support arbitrary tracing
methods, and especially USDT probes, which SystemTap and dtrace expect,
and which are supported on at least one flavor of BSD (FreeBSD).

To that end this patch adds an frr-specific tracing macro, frrtrace(),
which proxies into either DTRACE_PROBEn() or tracepoint() macros
depending on whether --enable-usdt or --enable-lttng is passed at
compile time.

At some point this could be tweaked to allow compiling in both types of
probes. Ideally there should be some logic there to use LTTng's optional
support for generating USDT probes when both are requested.

No additional libraries are required to use USDT, since these probes are
a kernel feature and only need the <sys/sdt.h> header.

- add --enable-usdt to toggle use of LTTng tracepoints or USDT probes
- add new trace.h library header for use with tracepoint definition
  headers
- add frrtrace() wrapper macro; this should be used to define
  tracepoints instead of using tracepoint() or DTRACE_PROBEn()

Compilation with USDT does nothing as of this commit; the existing LTTng
tracepoints need to be converted to use the frrtrace*() macros in a
subsequent commit.

Signed-off-by: Quentin Young <qlyoung@nvidia.com>
3 years agolib: move trace.h -> libfrr_trace.h
Quentin Young [Mon, 28 Sep 2020 19:49:22 +0000 (15:49 -0400)]
lib: move trace.h -> libfrr_trace.h

Signed-off-by: Quentin Young <qlyoung@nvidia.com>
3 years agolib: add tracepoint for route table get
Quentin Young [Fri, 18 Sep 2020 19:14:09 +0000 (15:14 -0400)]
lib: add tracepoint for route table get

Signed-off-by: Quentin Young <qlyoung@nvidia.com>
3 years agolib: add tracepoints for *malloc, list ops
Quentin Young [Thu, 17 Sep 2020 18:57:36 +0000 (14:57 -0400)]
lib: add tracepoints for *malloc, list ops

- Add tracepoints for FRR malloc and free
- Add tracepoints for basic list operations

Signed-off-by: Quentin Young <qlyoung@nvidia.com>
3 years agolib: add tracepoint for hash insertion
Quentin Young [Wed, 16 Sep 2020 23:29:32 +0000 (19:29 -0400)]
lib: add tracepoint for hash insertion

hash_get is used for both lookup and insert; add a tracepoint for when
we insert something into the hash

Signed-off-by: Quentin Young <qlyoung@nvidia.com>
3 years agobgpd: route processing tracepoints
Quentin Young [Wed, 16 Sep 2020 23:16:35 +0000 (19:16 -0400)]
bgpd: route processing tracepoints

Add tracepoints for route process, input filter and output filter.

Signed-off-by: Quentin Young <qlyoung@nvidia.com>
3 years agobgpd: add basic packet-related tracepoints
Quentin Young [Wed, 16 Sep 2020 00:13:36 +0000 (20:13 -0400)]
bgpd: add basic packet-related tracepoints

Add tracepoints for:
- packet pushed to internal rx queue
- packet dequeued from rx queue and processed

Signed-off-by: Quentin Young <qlyoung@nvidia.com>
3 years agolib: add tracepoints for pthread run, stop
Quentin Young [Tue, 15 Sep 2020 04:28:55 +0000 (00:28 -0400)]
lib: add tracepoints for pthread run, stop

Signed-off-by: Quentin Young <qlyoung@nvidia.com>
3 years agolib: generate trace events for log messages
Quentin Young [Mon, 14 Sep 2020 22:05:47 +0000 (18:05 -0400)]
lib: generate trace events for log messages

LTTng supports tracef() and tracelog() macros, which work like printf,
and are used to ease transition between logging and tracing. Messages
printed using these macros end up as trace events. For our uses we are
not interested in dropping logging, but it is nice to get log messages
in trace output, so I've added a call to tracelog() in zlog that dumps
our zlog messages as trace events.

Signed-off-by: Quentin Young <qlyoung@nvidia.com>
3 years agolib: add tracepoints for hash ops, thread events
Quentin Young [Mon, 14 Sep 2020 22:04:33 +0000 (18:04 -0400)]
lib: add tracepoints for hash ops, thread events

Define some initial tracepoints for hash table operations, thread
schedules, and thread cancels

Signed-off-by: Quentin Young <qlyoung@nvidia.com>
3 years agolib, configure.ac: initial LTTng support
Quentin Young [Mon, 14 Sep 2020 22:02:56 +0000 (18:02 -0400)]
lib, configure.ac: initial LTTng support

This commit adds initial support for LTTng.

When --enable-lttng=no or is not specified, no tracing code is included.
When --enable-lttng=yes, LTTng tracing events are (will be) generated.

configure.ac:
- add --enable-lttng
- define HAVE_LTTNG when enabled
- minimum LTTng version: 2.12.0

lib:
- add trace.[ch]
- update subdir.am

Signed-off-by: Quentin Young <qlyoung@nvidia.com>
3 years agolib: #undef _ASSERT_FUNCTION
Quentin Young [Wed, 16 Sep 2020 19:39:41 +0000 (15:39 -0400)]
lib: #undef _ASSERT_FUNCTION

Redefining it has issues depending on header order.

Signed-off-by: Quentin Young <qlyoung@nvidia.com>
3 years agoMerge pull request #7361 from wesleycoakley/alpine-build-fix
Quentin Young [Fri, 23 Oct 2020 19:05:04 +0000 (15:05 -0400)]
Merge pull request #7361 from wesleycoakley/alpine-build-fix

alpine: Remove old docker deps for alpine

3 years agoMerge pull request #7184 from opensourcerouting/anycast-sids-v4
Olivier Dugeon [Fri, 23 Oct 2020 19:03:55 +0000 (21:03 +0200)]
Merge pull request #7184 from opensourcerouting/anycast-sids-v4

isisd: refactor Prefix-SID code + Anycast-SIDs (v2)

3 years agoMerge pull request #6788 from mjstapp/thread_cancel_off
Quentin Young [Fri, 23 Oct 2020 19:02:50 +0000 (15:02 -0400)]
Merge pull request #6788 from mjstapp/thread_cancel_off

*: unify thread/task cancel apis

3 years agozebra: fix unitialized msg header reading at startup
Stephen Worley [Fri, 23 Oct 2020 18:57:29 +0000 (14:57 -0400)]
zebra: fix unitialized msg header reading at startup

Fixes the valgrind error we were seeing on startup due to
initializing the msg header struct:

```
==2534283== Thread 3 zebra_dplane:
==2534283== Syscall param recvmsg(msg) points to uninitialised byte(s)
==2534283==    at 0x4D616DD: recvmsg (in /usr/lib64/libpthread-2.31.so)
==2534283==    by 0x43107C: netlink_recv_msg (kernel_netlink.c:744)
==2534283==    by 0x4330E4: nl_batch_read_resp (kernel_netlink.c:1070)
==2534283==    by 0x431D12: nl_batch_send (kernel_netlink.c:1201)
==2534283==    by 0x431E8B: kernel_update_multi (kernel_netlink.c:1369)
==2534283==    by 0x46019B: kernel_dplane_process_func (zebra_dplane.c:3979)
==2534283==    by 0x45EB7F: dplane_thread_loop (zebra_dplane.c:4368)
==2534283==    by 0x493F5CC: thread_call (thread.c:1585)
==2534283==    by 0x48D3450: fpt_run (frr_pthread.c:303)
==2534283==    by 0x48D3D41: frr_pthread_inner (frr_pthread.c:156)
==2534283==    by 0x4D56431: start_thread (in /usr/lib64/libpthread-2.31.so)
==2534283==    by 0x4E709D2: clone (in /usr/lib64/libc-2.31.so)
==2534283==  Address 0x85cd850 is on thread 3's stack
==2534283==  in frame #2, created by nl_batch_read_resp (kernel_netlink.c:1051)
==2534283==
==2534283== Syscall param recvmsg(msg.msg_control) points to unaddressable byte(s)
==2534283==    at 0x4D616DD: recvmsg (in /usr/lib64/libpthread-2.31.so)
==2534283==    by 0x43107C: netlink_recv_msg (kernel_netlink.c:744)
==2534283==    by 0x4330E4: nl_batch_read_resp (kernel_netlink.c:1070)
==2534283==    by 0x431D12: nl_batch_send (kernel_netlink.c:1201)
==2534283==    by 0x431E8B: kernel_update_multi (kernel_netlink.c:1369)
==2534283==    by 0x46019B: kernel_dplane_process_func (zebra_dplane.c:3979)
==2534283==    by 0x45EB7F: dplane_thread_loop (zebra_dplane.c:4368)
==2534283==    by 0x493F5CC: thread_call (thread.c:1585)
==2534283==    by 0x48D3450: fpt_run (frr_pthread.c:303)
==2534283==    by 0x48D3D41: frr_pthread_inner (frr_pthread.c:156)
==2534283==    by 0x4D56431: start_thread (in /usr/lib64/libpthread-2.31.so)
==2534283==    by 0x4E709D2: clone (in /usr/lib64/libc-2.31.so)
==2534283==  Address 0xa0 is not stack'd, malloc'd or (recently) free'd
==2534283==
```

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
3 years agoospfd: Add more Segment Routing controls
Olivier Dugeon [Fri, 23 Oct 2020 15:39:53 +0000 (17:39 +0200)]
ospfd: Add more Segment Routing controls

When Segment Routing is not enabled, some related output messages are
printed on the console especially when Segment Routing Debug is enabled.

This patch adds additional controls to check whether segment routing
is enabled or not.

Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
3 years agotools: add cocci patch for thread cancel api changes
Mark Stapp [Tue, 22 Sep 2020 16:02:28 +0000 (12:02 -0400)]
tools: add cocci patch for thread cancel api changes

Add Quentin's cocci patch to align code with the changes
to the event cancel api. Also added a README to explain what
this collection of cocci patches is for.

Signed-off-by: Quentin Young <qlyoung@nvidia.com>
Signed-off-by: Mark Stapp <mjs@voltanet.io>
3 years ago*: unify thread/event cancel macros
Mark Stapp [Fri, 17 Jul 2020 21:09:51 +0000 (17:09 -0400)]
*: unify thread/event cancel macros

Replace all lib/thread cancel macros, use thread_cancel()
everywhere. Only the THREAD_OFF macro and thread_cancel() api are
supported. Also adjust thread_cancel_async() to NULL caller's pointer (if
present).

Signed-off-by: Mark Stapp <mjs@voltanet.io>
3 years agoisisd: Fix memory leak on shutdown
Donald Sharp [Fri, 23 Oct 2020 00:51:24 +0000 (20:51 -0400)]
isisd: Fix memory leak on shutdown

==935465== 40 bytes in 1 blocks are definitely lost in loss record 71 of 546
==935465==    at 0x483AB65: calloc (vg_replace_malloc.c:760)
==935465==    by 0x48D6611: qcalloc (memory.c:110)
==935465==    by 0x48CFE02: list_new (linklist.c:32)
==935465==    by 0x15DBF0: isis_new (isisd.c:213)
==935465==    by 0x15DAC4: isis_global_instance_create (isisd.c:179)
==935465==    by 0x121892: main (isis_main.c:264)
==935465== 64 (40 direct, 24 indirect) bytes in 1 blocks are definitely lost in loss record 101 of 546
==935465==    at 0x483AB65: calloc (vg_replace_malloc.c:760)
==935465==    by 0x48D6611: qcalloc (memory.c:110)
==935465==    by 0x48CFE02: list_new (linklist.c:32)
==935465==    by 0x15DBE3: isis_new (isisd.c:212)
==935465==    by 0x15DAC4: isis_global_instance_create (isisd.c:179)
==935465==    by 0x121892: main (isis_main.c:264)

On isis shutdown we are seeing the above memory leaks.  Modify
the code to start cleaning this up.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
3 years agobgpd: Bgp static routes memory leak
Donald Sharp [Fri, 23 Oct 2020 15:09:51 +0000 (11:09 -0400)]
bgpd: Bgp static routes memory leak

When using MPLS_VPN/EVPN ( or really any two level table/route data structure setup )
FRR is leaking memory on shutdown:

eva# conf
eva(config)# router bgp 329
eva(config-router)# address-family ipv4 vpn
eva(config-router-af)# network 5.6.7.8/32 rd 44:55 label 3293
eva(config-router-af)# end
eva# exit
sharpd@eva ~/frr_coverity (master)> ps -ef | grep frr
root     1186423   10793  0 07:51 pts/1    00:00:00 sudo /usr/lib/frr/zebra --log stdout --log-level debug
frr      1186425 1186423  0 07:51 pts/1    00:00:00 /usr/lib/frr/zebra --log stdout --log-level debug
root     1263168  491694  0 11:10 pts/20   00:00:00 sudo valgrind --leak-check=full /usr/lib/frr/bgpd --log stdout --log-level debug
frr      1263169 1263168 22 11:10 pts/20   00:00:04 /usr/bin/valgrind.bin --leak-check=full /usr/lib/frr/bgpd --log stdout --log-level debug
sharpd   1263214  845829  0 11:10 pts/9    00:00:00 grep --color=auto frr
sharpd@eva ~/frr_coverity (master)> sudo kill -SIGTERM 1263169
sharpd@eva ~/frr_coverity (master)>

gives us this:

==1263169== 304 (40 direct, 264 indirect) bytes in 1 blocks are definitely lost in loss record 61 of 78
==1263169==    at 0x483AB65: calloc (vg_replace_malloc.c:760)
==1263169==    by 0x48DD878: qcalloc (memory.c:110)
==1263169==    by 0x5116D5: bgp_table_init (bgp_table.c:110)
==1263169==    by 0x4EB5C4: bgp_static_set_safi (bgp_route.c:5927)
==1263169==    by 0x4C3382: vpnv4_network (bgp_mplsvpn.c:1911)
==1263169==    by 0x489FBEC: cmd_execute_command_real (command.c:916)
==1263169==    by 0x489F7CB: cmd_execute_command (command.c:976)
==1263169==    by 0x489FD04: cmd_execute (command.c:1138)
==1263169==    by 0x493AF73: vty_command (vty.c:517)
==1263169==    by 0x493AA07: vty_execute (vty.c:1282)
==1263169==    by 0x4939B54: vtysh_read (vty.c:2115)
==1263169==    by 0x492E63C: thread_call (thread.c:1585)

The bgp_static_delete function was not unlocking the right bgp_dest.  This
problem goes away after fixing this.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
3 years agoMerge pull request #7364 from donaldsharp/zebra_nhg_keep
Mark Stapp [Fri, 23 Oct 2020 14:28:31 +0000 (10:28 -0400)]
Merge pull request #7364 from donaldsharp/zebra_nhg_keep

zebra: Do not delete nhg's when retain_mode is engaged

3 years agotests: extend the isisd SR topotest to test Anycast-SIDs as well
Renato Westphal [Wed, 23 Sep 2020 04:49:00 +0000 (01:49 -0300)]
tests: extend the isisd SR topotest to test Anycast-SIDs as well

Add the following Anycast-SIDs on routers rt4 and rt5:
* segment-routing prefix 10.10.10.10/32 index 100 no-php-flag n-flag-clear
* segment-routing prefix 2001:db8:1000::10/128 index 101 no-php-flag n-flag-clear

The updated JSON data will then check whether the Anycast-SIDs are
being processed as expected (e.g. rt1 should use ECMP to rt2 and rt3,
rt2 should use rt4 only as it's directly connected, etc).

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
3 years agoisisd: add support for Anycast-SIDs
Renato Westphal [Sun, 20 Sep 2020 05:42:32 +0000 (02:42 -0300)]
isisd: add support for Anycast-SIDs

Add the "n-flag-clear" option to the "segment-routing prefix"
command. The only thing that option does is to clear the node
flag of the Prefix-SID, even if it corresponds to a local loopback
address. No changes are necessary other than that in order to fully
support Anycast-SIDs.  isisd already supports multiple routers
advertising the same route with the same Prefix-SID after the recent
refactoring. Clearing the node flag for such anycast routes isn't
strictly required, but failure to do so can lead to problems like
TI-LFA picking the wrong Prefix-SID when calculating repair paths.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
3 years agoisisd: fix the TI-LFA repair paths to preserve the original Prefix-SID
Renato Westphal [Fri, 25 Sep 2020 05:45:19 +0000 (02:45 -0300)]
isisd: fix the TI-LFA repair paths to preserve the original Prefix-SID

When computing backup nexthops for routes that contain a Prefix-SID,
the original Prefix-SID label should be present at the end of
backup label stacks (after the repair labels). This commit fixes
that oversight in the original TI-LFA code. The SPF unit tests and
TI-LFA topotes were also updated accordingly.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
3 years agoisisd: refactor handling of SR Prefix-SIDs
Renato Westphal [Sun, 20 Sep 2020 05:39:28 +0000 (02:39 -0300)]
isisd: refactor handling of SR Prefix-SIDs

Embed Prefix-SID information inside SPF data structures so that
Prefix-SIDs can be installed together with their associated routes
at the end of the SPF algorithm. This is different from the current
implementation where Prefix-SIDs are parsed and processed separately,
which is vastly suboptimal.

Advantages of the new code:
* No need to parse the LSPDB an additional time to detect and process
  SR-related changes;
* Routes are installed with their Prefix-SID labels in the same ZAPI
  message. This can prevent packet dropping for a few milliseconds
  after each SPF run if there are BGP-labeled routes (e.g. L3VPN) that
  recurse on IGP labeled routes;
* Much easier to support Anycast-SIDs, as the SPF code will naturally
  figure out the best nexthops and use only them (that can't be done
  in any reasonable way if the Prefix-SID Sub-TVLs are processed
  separately);
* Less code to maintain and reduced memory footprint;

The "show isis segment-routing prefix-sids" command was removed as
it doesn't make sense anymore now that "show isis route" exists.
Prefix-SIDs are a property of routes, so what was done was to extend
the "show isis route" command with a new "prefix-sid" option that
changes the output table to show the Prefix-SID information associated
to each route.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
3 years agoisisd: create routes for local destinations
Renato Westphal [Fri, 16 Oct 2020 23:57:37 +0000 (20:57 -0300)]
isisd: create routes for local destinations

This is preparatory change for the upcoming SR Prefix-SID
refactoring.
Since Prefix-SID information will be stored inside IS-IS routes
(instead of being maintained separately), it will be necessary to
have local routes in order to store local Prefix-SID information.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
3 years agoisisd: give precedence to new-style TLVs when generating routes
Renato Westphal [Fri, 25 Sep 2020 21:37:48 +0000 (18:37 -0300)]
isisd: give precedence to new-style TLVs when generating routes

When both old and new-style TLVs exist for a particular prefix, give
precedence to the new-style TLV (like JUNOS does) when generating
routes from the SPT. This changes the current behavior which is to
generate a route for both TLVs, whereas the first is overwritten by
the second in a non-deterministic order (i.e. either the old-style
or the new-style TLV can "win" depending on how the SPF TENTative
list is arranged).

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
3 years ago* : update signature of thread_cancel api
Mark Stapp [Mon, 6 Jul 2020 16:55:03 +0000 (12:55 -0400)]
* : update signature of thread_cancel api

Change thread_cancel to take a ** to an event, NULL-check
before dereferencing, and NULL the caller's pointer. Update
many callers to use the new signature.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
3 years agopimd: replace some zlog_warn with zlog_debug
Mark Stapp [Fri, 23 Oct 2020 12:35:57 +0000 (08:35 -0400)]
pimd: replace some zlog_warn with zlog_debug

A pim module had a number of warnings being used instead of
debugs - use debugs.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
3 years agopimd: avoid possible unaligned pointer
Mark Stapp [Fri, 23 Oct 2020 12:34:41 +0000 (08:34 -0400)]
pimd: avoid possible unaligned pointer

Use inet_ntop instead of %pI4 in one place - clang doesn't like
the struct's address being taken that way.

Signed-off-by: Mark Stapp <mjs@voltanet.io>