pbrd: add frr-vrf to the list of implemented yang modules
PR #6376 introduced a VRF leafref in the frr-interface YANG module.
That change exposed a bug in the northbound layer that is causing
pbrd to crash under certain circumstances. Even though pbrd wasn't
converted to the new northbound model yet, make it implement the
frr-vrf module in order to work around this problem. This is a
temporary fix until a better solution is available.
Don slice [Wed, 5 Aug 2020 19:08:17 +0000 (19:08 +0000)]
bgpd: add global config for update-delay
Enhancement to update-delay configuration to allow setting globally
rather than per-instance. Setting the update-delay is allowed either
per-vrf or globally, but not both at the same time.
Ticket: CM-31096 Signed-off-by: Don Slice <dslice@nvidia.com>
This would be useful in cases with lots of peers and shutdown them
automatically if RTT goes above the specified limit.
A host with 512 or more IPv6 addresses has a higher latency due to
ipv6_addr_label(). This method tries to pick the best candidate address
fo outgoing connection and literally increases processing latency.
lynne [Wed, 12 Aug 2020 23:15:24 +0000 (19:15 -0400)]
ldpd: Fix issue when starting up LDP with no configuration.
LDP would mark all routes as learned on a non-ldp interface. Then
when LDP was configured the labels were not updated correctly. This
commit fixes issues 6841 and 6842.
This commit
=> provides "all" option, to display the table entries for all(or specific) AFI/SAFIs.
=> Also introduced "show_flags" to avoid passing multiple arguments(use_json, wide, all)
to functions
1. show <ip> bgp <ipv4/ipv6> <all> <wide|json>
2. show <ip> bgp <ipv4/ipv6> <all> summary <json>
3. show <ip> bgp <ipv4/ipv6> <all> cidr-only <wide|json>
4. show <ip> bgp <ipv4/ipv6> <all> community <wide|json>
5. show <ip> bgp <ipv4/ipv6> <all> dampening <dampened-paths|flap-statistics|parameters> <wide|json>
6. show <ip> bgp <ipv4/ipv6> <all> neighbors A.B.C.D advertised-routes|filtered-routes|received-routes <wide|json>
show bgp all summary == show ip bgp all summary => output is same => display entries for all AFIs and for each SAFI.
show bgp ipv4 all summary == show ip bgp ipv4 all summary => output is same => display entries for each SAFI in AFI_IP
show bgp ipv6 all summary == show ip bgp ipv6 all summart => output is same => display entries for each SAFI in AFI_IP6
similarly for all other commands.
sample output
1. show <ip> bgp <ipv4/ipv6> <all> <wide|json>
router# show ip bgp all wide
For address family: IPv4 Unicast
BGP table version is 6, local router ID is 1.1.1.1, vrf id 0
Default local pref 100, local AS 1
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
BGP table version is 3, local router ID is 1.1.1.1, vrf id 0
Default local pref 100, local AS 1
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
BGP table version is 6, local router ID is 1.1.1.1, vrf id 0
Default local pref 100, local AS 1
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
BGP table version is 3, local router ID is 1.1.1.1, vrf id 0
Default local pref 100, local AS 1
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
BGP table version is 6, local router ID is 1.1.1.1, vrf id 0
Default local pref 100, local AS 1
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
BGP table version is 3, local router ID is 1.1.1.1, vrf id 0
Default local pref 100, local AS 1
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
Displayed 3 routes and 3 total paths
router#
router#
router# show bgp ipv4 all wide
For address family: IPv4 Unicast
BGP table version is 6, local router ID is 1.1.1.1, vrf id 0
Default local pref 100, local AS 1
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
BGP table version is 3, local router ID is 1.1.1.1, vrf id 0
Default local pref 100, local AS 1
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
For address family: IPv4 Unicast
Half-life time: 15 min
Reuse penalty: 750
Suppress penalty: 2000
Max suppress time: 60 min
Max suppress penalty: 12000
For address family: IPv4 Multicast
Half-life time: 20 min
Reuse penalty: 1000
Suppress penalty: 10000
Max suppress time: 40 min
Max suppress penalty: 4000
For address family: IPv4 VPN
dampening not enabled for IPv4 VPN
For address family: IPv4 Encap
dampening not enabled for IPv4 Encap
For address family: IPv4 Labeled Unicast
dampening not enabled for IPv4 Labeled Unicast
For address family: IPv4 Flowspec
dampening not enabled for IPv4 Flowspec
For address family: IPv6 Unicast
dampening not enabled for IPv6 Unicast
For address family: IPv6 Multicast
Half-life time: 10 min
Reuse penalty: 1500
Suppress penalty: 15000
Max suppress time: 20 min
Max suppress penalty: 6000
For address family: IPv6 VPN
dampening not enabled for IPv6 VPN
For address family: IPv6 Encap
dampening not enabled for IPv6 Encap
For address family: IPv6 Labeled Unicast
dampening not enabled for IPv6 Labeled Unicast
For address family: IPv6 Flowspec
dampening not enabled for IPv6 Flowspec
For address family: L2VPN EVPN
dampening not enabled for L2VPN EVPN
router#
bgpd: all option with json-c apis used
Replaced vty_out with json-c wrapper functions for all option
support to show <ip> bgp commands
ospfd: install Type-7 when NSSA enabled after redistribution
If NSSA is enabled before redistribution is configured, Type-7 LSA's
are installed. But if NSSA is enabled after redistribution is
configured, Type-7 LSAs are missing.
With this change, when NSSA is enabled, scan for external LSA's and
if they exist, install Type-7.
Signed-off-by: Alexander Chernavin <achernavin@netgate.com>
Quentin Young [Wed, 2 Sep 2020 20:02:55 +0000 (16:02 -0400)]
lib: remove overflow arithmetic from hash stats
Signed values get converted to unsigned for addition, so when the value
to adjust a stats variable for hash tables was negative this resulted in
overflow arithmetic, which we generally don't want.
Quentin Young [Wed, 2 Sep 2020 19:11:26 +0000 (15:11 -0400)]
bgpd: make flag values explicitly unsigned
When using these flag #defines, by default their types are integers but
they are always used in conjunction with unsigned integers, which
introduces some implicit conversions that really ought to be avoided.
Quentin Young [Wed, 2 Sep 2020 17:16:35 +0000 (13:16 -0400)]
bgpd: modify attr fields before hash insert
bgp_attr_intern(attr) takes an attribute, duplicates it, and inserts it
into the attribute hash table, returning the inserted attr. This is done
when processing a bgp update. We store the returned attribute in the
path info struct. However, later on we modify one of the fields of the
attribute. This field is inspected by attrhash_cmp, the function that
allows the hash table to select the correct item from the hash chain for
a given key when doing a lookup on an item. By modifying the field after
it's been inserted, we open the possibility that two items in the same
chain that at insertion time were differential by attrhash_cmp becomes
equal according to that function. When performing subsequent hash
lookups, it is then indeterminate which of the equivalent items the hash
table will select from the chain (in practice it is the first one but
this may not be the one we want). Thus, it is illegal to modify
data used by a hash comparison function after inserting that data into
a hash table.
In fact this is occurring for attributes. We insert two attributes that
hash to the same key and thus end up in the same hash chain. Then we
modify one of them such that the two items now compare equal. Later one
we want to release the second item from the chain before XFREE()'ing it,
but since the two items compare equal we get the first item back, then
free the second one, which constitutes two bugs, the first being the
wrong attribute removed from the hash table and the second being a
dangling pointer stored in the hash table.
To rectify this we need to perform any modifications to an attr before
it is inserted into the table, i.e., before calling bgp_attr_intern().
This patch does that by moving the sole modification to the attr that
occurs after the insert (that I have seen) before that call.
Babis Chalios [Tue, 4 Aug 2020 13:19:25 +0000 (15:19 +0200)]
bgpd: fix invocation of bgpTrapBackwardTransition
The bgpTrapBackwardTransition callback was being called only during
bgp_stop and only under the condition that peer status was Established.
The MIB defines that the event should be generated for every transition
of the BGP FSM from a higher to a lower state.
Kuldeep Kashyap [Mon, 17 Aug 2020 04:41:51 +0000 (04:41 +0000)]
tests: Add bgp_vrf_dynamic_route_leak test suite
1. Added test to verify bgp vrf dynamic route leak functionality
2. Total execution time is ~8 mins
3. Added kernel version check, these script would be run for kernel version >= 4.19
Pat Ruddy [Mon, 20 Jul 2020 12:54:04 +0000 (13:54 +0100)]
bgpd: do not clear password if peer is dynamic
When deleting a dynamic peer, unsetting md5 password would cause
it to be unset on the listener allowing unauthenticated connections
from any peer in the range.
Check for dynamic peers in peer delete and avoid this.
Pat Ruddy [Tue, 21 Jul 2020 14:03:41 +0000 (15:03 +0100)]
bgpd: associate listener with the appropriate bgp instance
When setting authentication on a BGP peer in a VRF the listener is
looked up from a global list. However there is no check that the
listener is the one associated with the VRF being configured. This
can result in the wrong listener beiong configured with a password,
leaving the intended listener in an open authentication state.
To simplify this lookup stash a pointer to the bgp instance in
the listener on creating (in the same way as is done for NS-based
VRFS).
1. Topotest for isis-vrf is added for ipv4 and ipv6.
2. Test case for checking isis topology.
3. Test case for checking zebra isis routes.
4. Test case for checking linux vrf routes.
5. 2 new API's written in topotest/lib for checking vrf routes.
harios_niral [Tue, 18 Aug 2020 07:26:51 +0000 (00:26 -0700)]
doc, yang, isisd : Support for different VRF in isisd
1. Added isis with different vrf and it's dependecies.
2. Added new vrf leaf in yang.
3. A minor change for IF_DOWN_FROM_Z passing argrument is
replaced with ifp pointer in api "isis_if_delete_hook()".
4. Minor fix in the isisd spf unit test.
Pat Ruddy [Fri, 26 Jun 2020 16:37:30 +0000 (17:37 +0100)]
bgpd: do not unregister for prefix nexthop updates if nh exists
since the addition of srte_color to the comparison for bgp nexthops
it is possible to have several nexthops per prefix but since zebra
only sores a per prefix registration we should not unregister for
nh notifications for a prefix unti all the nexthops for that prefix
have been deleted. Otherwise we can get into a deadlock situation
where BGP thinks we have registered but we have unregistered from zebra.
Sebastien Merle [Tue, 28 Jan 2020 11:59:57 +0000 (11:59 +0000)]
bgpd: Add support for SR-TE Policies in route-maps
Example configuration:
route-map SET_SR_POLICY permit 10
set sr-te color 1
!
router bgp 1
bgp router-id 1.1.1.1
neighbor 2.2.2.2 remote-as 1
neighbor 2.2.2.2 update-source lo
address-family ipv4 unicast
neighbor 2.2.2.2 next-hop-self
neighbor 2.2.2.2 route-map SET_SR_POLICY in
exit-address-family
!
!
Learned BGP routes from 2.2.2.2 are mapped to the SR-TE Policy
which is uniquely determined by the BGP nexthop (2.2.2.2 in this
case) and the SR-TE color in the route-map.
bgpd: convert NHT code to use rb-trees instead of routing tables
Fist, routing tables aren't the most appropriate data structure
to store nexthops and imported routes since we don't need to do
longest prefix matches with that information.
Second, by converting the NHT code to use rb-trees, we can index
the nexthops using additional information, not only the destination
address. This will be useful later to index bgpd's nexthops by
both destination and SR-TE color.