]> git.proxmox.com Git - mirror_frr.git/log
mirror_frr.git
2 years agobgpd: Handle TCP connection errors with connection callbacks for RPKI
Donatas Abraitis [Thu, 27 Jan 2022 09:14:11 +0000 (11:14 +0200)]
bgpd: Handle TCP connection errors with connection callbacks for RPKI

Before this patch, if the first server crashed or was terminated, RPKI
connection keeps _active_ forever.

With this patch, if we catch connection problem (FATAL), we reset RPKI, to
switch to another available RTR-Server by using configured preference.

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
(cherry picked from commit 38775a3c5fdfece7002f0495a76e3c96a7d6417c)

2 years agoMerge pull request #10645 from ton31337/feature/advmap_set_8.2
Jafar Al-Gharaibeh [Wed, 23 Feb 2022 22:53:05 +0000 (16:53 -0600)]
Merge pull request #10645 from ton31337/feature/advmap_set_8.2

bgpd: [8.2] Conditional advertisement with route-map set backports

2 years agoMerge pull request #10642 from FRRouting/mergify/bp/dev/8.2/pr-10621
Donatas Abraitis [Wed, 23 Feb 2022 19:40:19 +0000 (21:40 +0200)]
Merge pull request #10642 from FRRouting/mergify/bp/dev/8.2/pr-10621

Cov fun (backport #10621)

2 years agobgpd: Allow setting attributes over route-maps for conditional advertisements
Donatas Abraitis [Tue, 15 Feb 2022 16:08:32 +0000 (18:08 +0200)]
bgpd: Allow setting attributes over route-maps for conditional advertisements

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2 years agobgpd: Add bgp_check_selected() helper for abstraction
Donatas Abraitis [Thu, 27 Jan 2022 08:12:59 +0000 (10:12 +0200)]
bgpd: Add bgp_check_selected() helper for abstraction

Just check if the path is selected to be advertised: best path or addpath
capable.

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2 years agobgpd: Convert bgp_addpath_encode_[tr]x() to bool from int
Donatas Abraitis [Thu, 27 Jan 2022 07:51:59 +0000 (09:51 +0200)]
bgpd: Convert bgp_addpath_encode_[tr]x() to bool from int

Rename addpath_encode[d] to addpath_capable to be consistent.

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2 years agopceplib: Fix uninited data in test vehicle
Donald Sharp [Tue, 22 Feb 2022 13:21:32 +0000 (08:21 -0500)]
pceplib: Fix uninited data in test vehicle

Coverity SA found this.  Fix

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
(cherry picked from commit bd6beab0a6722f4ea05b528010ee5064adc66e53)

2 years agoeigrpd: Up convert to uint64_t before doing math
Donald Sharp [Fri, 18 Feb 2022 15:55:16 +0000 (10:55 -0500)]
eigrpd: Up convert to uint64_t before doing math

Intentionally up convert uint8_t and uint32_t values
to a uint64_t before doing math to make Coverity happy.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
(cherry picked from commit c960cb28f72bce27dbf0aad75e1a41b85cf1a614)

2 years agobfdd: Fix overflow possibility with time statements
Donald Sharp [Fri, 18 Feb 2022 15:45:46 +0000 (10:45 -0500)]
bfdd: Fix overflow possibility with time statements

If time ( a uint64_t ) is large enough doing division
and subtraction can still lead to situations where
the resulting number is greater than a uint32_t.
Just use uint32_t as an intermediate storage spot.
This is unlikely to every occur in a time frame
I could possibly care about but makes Coverity happy.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
(cherry picked from commit 46da676a62bbf87dc35d46c86c073869b41fae3d)

2 years agolib: Fix possible usage of uninited data
Donald Sharp [Thu, 17 Feb 2022 19:07:57 +0000 (14:07 -0500)]
lib: Fix possible usage of uninited data

assert when if_lookup_address is passed with
a family that is not AF_INET or AF_INET6 as
that we are dead in the water and this is a
dev escape

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
(cherry picked from commit 4d7aae38ab5f88421dea48a6f6541f86ce4cd954)

2 years agoMerge pull request #10631 from FRRouting/mergify/bp/dev/8.2/pr-10615
Donatas Abraitis [Wed, 23 Feb 2022 08:34:37 +0000 (10:34 +0200)]
Merge pull request #10631 from FRRouting/mergify/bp/dev/8.2/pr-10615

pimd: Do not allow 224.0.0.0/24 range in igmp join (backport #10615)

2 years agopimd: Do not allow 224.0.0.0/24 range in igmp join
Mobashshera Rasool [Fri, 18 Feb 2022 06:03:07 +0000 (22:03 -0800)]
pimd: Do not allow 224.0.0.0/24 range in igmp join

224.0.0.0/24 cannot be used by igmp since this is reserved
for routing protocols and other low-level topology discovery or
maintenance protocols.

Fixes: #10614
Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
(cherry picked from commit fcfd479d99295f82ef5979fc74ca38c9787cac2d)

2 years agoMerge pull request #10613 from FRRouting/mergify/bp/dev/8.2/pr-10604
Jafar Al-Gharaibeh [Fri, 18 Feb 2022 05:31:34 +0000 (23:31 -0600)]
Merge pull request #10613 from FRRouting/mergify/bp/dev/8.2/pr-10604

staticd: reject route config with too many nexthops (backport #10604)

2 years agostaticd: reject route config with too many nexthops
Mark Stapp [Thu, 17 Feb 2022 14:49:41 +0000 (09:49 -0500)]
staticd: reject route config with too many nexthops

Restrict the number of nexthops for a route to the compiled-in
limit. Be careful with the zapi route struct's array of nexthops
too.

Signed-off-by: Mark Stapp <mstapp@nvidia.com>
(cherry picked from commit 1f7ab1a2cc2a7079c9dd2cb791fc6ba3b9c5a6aa)

2 years agostaticd: capture zebra's advertised ECMP limit
Mark Stapp [Thu, 17 Feb 2022 14:53:25 +0000 (09:53 -0500)]
staticd: capture zebra's advertised ECMP limit

Capture the ECMP limit advertised by zebra (via zapi).

Signed-off-by: Mark Stapp <mstapp@nvidia.com>
(cherry picked from commit abc246e19345cbd2bc74c7dc50dac0b9cf2addf8)

2 years agostaticd: fix spelling in an error message
Mark Stapp [Thu, 17 Feb 2022 14:48:07 +0000 (09:48 -0500)]
staticd: fix spelling in an error message

whitespace change to fix a typo.

Signed-off-by: Mark Stapp <mstapp@nvidia.com>
(cherry picked from commit 423e32cb01bf3cf8c34674b15f1af107ca28a3eb)

2 years agoMerge pull request #10611 from FRRouting/mergify/bp/dev/8.2/pr-10591
Jafar Al-Gharaibeh [Fri, 18 Feb 2022 00:28:41 +0000 (18:28 -0600)]
Merge pull request #10611 from FRRouting/mergify/bp/dev/8.2/pr-10591

ripd: Fix packet send for non primary addresses (backport #10591)

2 years agoMerge pull request #10610 from FRRouting/mergify/bp/dev/8.2/pr-10562
Jafar Al-Gharaibeh [Fri, 18 Feb 2022 00:28:24 +0000 (18:28 -0600)]
Merge pull request #10610 from FRRouting/mergify/bp/dev/8.2/pr-10562

lib: Save number of times a thread is starved (backport #10562)

2 years agoripd: Fix packet send for non primary addresses
Donald Sharp [Wed, 16 Feb 2022 00:47:23 +0000 (19:47 -0500)]
ripd: Fix packet send for non primary addresses

When rip is configured to work on secondary addresses
on an interface, rip was not properly sending out
the packets on secondary addresses because the source of the
packet was never properly being setup and rip would
send the packet out multiple times for the primary address
not once for each address on the interface that is setup to work.

tcpdump + rip debugs output with fix:

2022/02/15 19:59:50 RIP: [ZG173-BHW0K] turn on virbr0
2022/02/15 19:59:51 RIP: [PYB7S-80D89] multicast join at virbr0
2022/02/15 19:59:51 RIP: [GZR24-FCQGG] multicast request on virbr0
2022/02/15 19:59:51 RIP: [JTNCV-XD8S1] rip_send_packet 192.168.122.1 > 224.0.0.9 (virbr0)
2022/02/15 19:59:51 RIP: [VEJY5-67P5X] SEND to  224.0.0.9520
2022/02/15 19:59:51 RIP: [JTNCV-XD8S1] rip_send_packet 73.3.3.8 > 224.0.0.9 (virbr0)
2022/02/15 19:59:51 RIP: [VEJY5-67P5X] SEND to  224.0.0.9520
19:59:51.831128 IP 192.168.122.1.route > rip2-routers.mcast.net.route: RIPv2, Request, length: 24
19:59:51.831161 IP c-73-3-3-8.hsd1.mo.comcast.net.route > rip2-routers.mcast.net.route: RIPv2, Request, length: 24

Fixes: #10588
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
(cherry picked from commit 114918bd0ba2a54f144bcd672973f3a3b88a4251)

2 years agoMerge pull request #10607 from FRRouting/mergify/bp/dev/8.2/pr-10575
Donatas Abraitis [Thu, 17 Feb 2022 19:56:34 +0000 (21:56 +0200)]
Merge pull request #10607 from FRRouting/mergify/bp/dev/8.2/pr-10575

bgp: Add a 6 hour warning to missing policy (backport #10575)

2 years agoMerge pull request #10609 from FRRouting/mergify/bp/dev/8.2/pr-10590
Donatas Abraitis [Thu, 17 Feb 2022 19:56:06 +0000 (21:56 +0200)]
Merge pull request #10609 from FRRouting/mergify/bp/dev/8.2/pr-10590

Bgp error codes (backport #10590)

2 years agoMerge pull request #10608 from FRRouting/mergify/bp/dev/8.2/pr-10557
Donald Sharp [Thu, 17 Feb 2022 18:59:06 +0000 (13:59 -0500)]
Merge pull request #10608 from FRRouting/mergify/bp/dev/8.2/pr-10557

Zebra FPM: don't lose next hop weights while exporting via FPM (backport #10557)

2 years agolib: Save number of times a thread is starved
Donald Sharp [Thu, 10 Feb 2022 19:10:26 +0000 (14:10 -0500)]
lib: Save number of times a thread is starved

Add a counter to the number of times a thread is starved from
a timer event and add the output to `show thread cpu`

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
(cherry picked from commit 1dd08c2243976182595f99561f478b1bafaa4483)

2 years agobgpd: Renumber bgp_create_error_code enum values
Donald Sharp [Tue, 15 Feb 2022 21:36:30 +0000 (16:36 -0500)]
bgpd: Renumber bgp_create_error_code enum values

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
(cherry picked from commit e4aa4745f2e6e53e4cadb103551b2044ca0e8b59)

2 years agobgpd: Convert bgp error codes for cli input to an enum
Donald Sharp [Tue, 15 Feb 2022 20:53:30 +0000 (15:53 -0500)]
bgpd: Convert bgp error codes for cli input to an enum

Conversion of bgp error codes returned for cli input into
an enum and then properly handling all the error cases
in bgp_vty_return.

Because not all error codes returned were properly handled
in this function there existed configuration examples that
were accepted on the cli without an error message but not
saved.

Fixes: #10589
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
(cherry picked from commit 4b7e23e9f2822def568cc9dd1a942d9d36cbb3a5)

2 years agobgpd: Remove unused BGP_ERR_MAX #define
Donald Sharp [Tue, 15 Feb 2022 21:12:02 +0000 (16:12 -0500)]
bgpd: Remove unused BGP_ERR_MAX #define

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
(cherry picked from commit b5d6f2d068346e532d132421c52277206368c8af)

2 years agobgpd: Move some error codes to bgp_vty_return handling
Donald Sharp [Tue, 15 Feb 2022 21:04:50 +0000 (16:04 -0500)]
bgpd: Move some error codes to bgp_vty_return handling

BGP_ERR_PEER_GROUP_MEMBER and BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT
both are not handled by bgp_vty_return, but both can be handled by
this function as that there is nothing special going on here.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
(cherry picked from commit 6dcea6fe05f38d8542edd7b06d301d237e0c028a)

2 years agobgpd: Remove impossible invalid state
Donald Sharp [Tue, 15 Feb 2022 20:54:53 +0000 (15:54 -0500)]
bgpd: Remove impossible invalid state

confederations are checking to see that the bgp pointer
is non-null.  But it's impossible to have a null pointer
in the cli and in all paths we have already deref'ed the bgp
pointer.  Let's remove that error code as that it is impossible
to happen.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
(cherry picked from commit 8b4a0b6631c9484a8925a7279b7a111c3e340de1)

2 years agozebra: FPM next hop weights
kiselev99@gmail.com [Thu, 10 Feb 2022 15:47:20 +0000 (18:47 +0300)]
zebra: FPM next hop weights

Don't lose next hop weights while exporting via FPM

Signed-off-by: Alex Kiselev <alex@bisonrouter.com>
(cherry picked from commit eca3256db8eaea0315d01f48b1037e918be629be)

2 years agobgp: Add a 15 minute warning to missing policy
Donald Sharp [Mon, 14 Feb 2022 12:57:45 +0000 (07:57 -0500)]
bgp: Add a 15 minute warning to missing policy

Add a 15 minute warning to the logging system when
bgp policy is not setup properly.  Operators keep asking
about the missing policy( on upgrade typically ).  Let's
try to give them a bit more of a hint when something is
going wrong as that they are clearly missing the other
various places FRR tells them about it.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
(cherry picked from commit b17826b715996558df93ae52e281c10c8925fdce)

2 years agoMerge pull request #10597 from FRRouting/mergify/bp/dev/8.2/pr-10586
Mark Stapp [Wed, 16 Feb 2022 17:57:20 +0000 (12:57 -0500)]
Merge pull request #10597 from FRRouting/mergify/bp/dev/8.2/pr-10586

bgpd: uninitialized compiler warning (backport #10586)

2 years agobgpd: Fix uninitialized compiler warning
Punith Kumar [Tue, 15 Feb 2022 22:07:19 +0000 (22:07 +0000)]
bgpd: Fix uninitialized compiler warning

Signed-off-by: Punith Kumar <punithkumar.spk@gmail.com>
(cherry picked from commit 73e770b7ade52ffc189eee91c2f60ba60e5865c1)

2 years agoMerge pull request #10564 from FRRouting/mergify/bp/dev/8.2/pr-10552
Donatas Abraitis [Fri, 11 Feb 2022 07:48:31 +0000 (09:48 +0200)]
Merge pull request #10564 from FRRouting/mergify/bp/dev/8.2/pr-10552

tools: fix frr-reload context keywords (backport #10552)

2 years agotools: fix frr-reload context keywords
Igor Ryzhov [Wed, 9 Feb 2022 23:51:49 +0000 (02:51 +0300)]
tools: fix frr-reload context keywords

There are singline-line commands inside `router bgp` that start with
`vnc ` or `bmp `. Those commands are currently treated as node-entering
commands. We need to specify such commands more precisely.

Fixes #10548.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
(cherry picked from commit 57692f125e60acc5b94e5b9ab11b654cce589ad9)

2 years agoMerge pull request #10553 from FRRouting/mergify/bp/dev/8.2/pr-10551
Donatas Abraitis [Thu, 10 Feb 2022 12:47:13 +0000 (14:47 +0200)]
Merge pull request #10553 from FRRouting/mergify/bp/dev/8.2/pr-10551

bgpd: fix a couple of memleaks (backport #10551)

2 years agobgpd: fix aspath memleak on error in vnc_direct_bgp_add_nve
Igor Ryzhov [Wed, 9 Feb 2022 22:23:41 +0000 (01:23 +0300)]
bgpd: fix aspath memleak on error in vnc_direct_bgp_add_nve

bgp_attr_default_set creates a new empty aspath. If family error happens,
this aspath is not freed. Move attr initialization after we checked the
family.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
(cherry picked from commit 606c3f9fb2e164ea3f2fe87b46f99c4be44104bc)

2 years agobgpd: fix aspath memory leak in aggr_suppress_map_test
Igor Ryzhov [Wed, 9 Feb 2022 22:20:03 +0000 (01:20 +0300)]
bgpd: fix aspath memory leak in aggr_suppress_map_test

aspth_empty a couple of lines earlier creates an aspath and it must be
freed.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
(cherry picked from commit afb254d79235e4a4cf41e761d7c99c030069758b)

2 years agobgpd: fix missing bgp_attr_flush on errors in bgp_update
Igor Ryzhov [Wed, 9 Feb 2022 22:15:57 +0000 (01:15 +0300)]
bgpd: fix missing bgp_attr_flush on errors in bgp_update

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
(cherry picked from commit 4dbf2038ea76f8ee697f9ec0d8f9aa5e7e5e69d9)

2 years agoMerge pull request #10543 from FRRouting/mergify/bp/dev/8.2/pr-10511
Donald Sharp [Wed, 9 Feb 2022 15:19:25 +0000 (10:19 -0500)]
Merge pull request #10543 from FRRouting/mergify/bp/dev/8.2/pr-10511

ospfd: fix loss of mixed form in "range" command (backport #10511)

2 years agoMerge pull request #10534 from FRRouting/mergify/bp/dev/8.2/pr-10531
Donatas Abraitis [Wed, 9 Feb 2022 15:01:03 +0000 (17:01 +0200)]
Merge pull request #10534 from FRRouting/mergify/bp/dev/8.2/pr-10531

bgpd: avoid memcmp comparison of struct nexthop (backport #10531)

2 years agoMerge pull request #10541 from FRRouting/mergify/bp/dev/8.2/pr-10161
Donatas Abraitis [Wed, 9 Feb 2022 13:15:31 +0000 (15:15 +0200)]
Merge pull request #10541 from FRRouting/mergify/bp/dev/8.2/pr-10161

zebra: Fix improper usage of hash_iterate that caused crashes (backport #10161)

2 years agoMerge pull request #10542 from FRRouting/mergify/bp/dev/8.2/pr-10517
Donald Sharp [Wed, 9 Feb 2022 13:13:25 +0000 (08:13 -0500)]
Merge pull request #10542 from FRRouting/mergify/bp/dev/8.2/pr-10517

isisd: fix router capability TLV parsing issues (backport #10517)

2 years agoMerge pull request #10544 from FRRouting/mergify/bp/dev/8.2/pr-10530
Donald Sharp [Wed, 9 Feb 2022 13:12:49 +0000 (08:12 -0500)]
Merge pull request #10544 from FRRouting/mergify/bp/dev/8.2/pr-10530

*: use ipaddr_cmp instead of memcmp (backport #10530)

2 years ago*: use ipaddr_cmp instead of memcmp
Igor Ryzhov [Tue, 8 Feb 2022 17:31:34 +0000 (20:31 +0300)]
*: use ipaddr_cmp instead of memcmp

Using memcmp is wrong because struct ipaddr may contain unitialized
padding bytes that should not be compared.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
(cherry picked from commit 60cda04dda2659b5bef684fe7b05ee0e501eb498)

2 years agoospfd: fix loss of mixed form in "range" command
anlan_cs [Mon, 7 Feb 2022 13:25:28 +0000 (21:25 +0800)]
ospfd: fix loss of mixed form in "range" command

Currently "range" command can only accept `cost` or `substitute`
individually, and `show running` will mix them.

So need make it accept mixed form with both of them, otherwise
configuration file in mixed form will fail to start.

Signed-off-by: anlan_cs <vic.lan@pica8.com>
(cherry picked from commit ec88a72a375bc3a228cf2752b03e5aa22d8ef206)

2 years agoisisd: fix router capability TLV parsing issues
Juraj Vijtiuk [Wed, 13 Oct 2021 16:32:53 +0000 (18:32 +0200)]
isisd: fix router capability TLV parsing issues

isis_tlvs.c would fail at multiple places if incorrect TLVs were
received causing stream assertion violations.
This patch fixes the issues by adding missing length checks, missing
consumed length updates and handling malformed Segment Routing subTLVs.

Signed-off-by: Juraj Vijtiuk <juraj.vijtiuk@sartura.hr>
Small adjustments by Igor Ryzhov:
- fix incorrect replacement of srgb by srlb on lines 3052 and 3054
- add length check for ISIS_SUBTLV_ALGORITHM
- fix conflict in fuzzing data during rebase

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
(cherry picked from commit 9ba865f54d331c550629304cb25e77ac81455803)

2 years agolib: Update hash.h documentation to warn of a possible crash
Donald Sharp [Wed, 1 Dec 2021 22:03:38 +0000 (17:03 -0500)]
lib: Update hash.h documentation to warn of a possible crash

Multiple deletions from the hash_walk or hash_iteration calls
during a single invocation of the passed in function can and
will cause the program to crash.  Warn against doing such a
thing.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
(cherry picked from commit 341743ac5b2a11fe27416a2b34cc470f36ea4d17)

2 years agozebra: Ensure zebra_nhg_sweep_table accounts for double deletes
Donald Sharp [Wed, 1 Dec 2021 21:28:42 +0000 (16:28 -0500)]
zebra: Ensure zebra_nhg_sweep_table accounts for double deletes

I'm seeing this crash in various forms:
Program terminated with signal SIGSEGV, Segmentation fault.
50 ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
[Current thread is 1 (Thread 0x7f418efbc7c0 (LWP 3580253))]
(gdb) bt
(gdb) f 4
267 (*func)(hb, arg);
(gdb) p hb
$1 = (struct hash_bucket *) 0x558cdaafb250
(gdb) p *hb
$2 = {len = 0, next = 0x0, key = 0, data = 0x0}
(gdb)

I've also seen a crash where data is 0x03.

My suspicion is that hash_iterate is calling zebra_nhg_sweep_entry which
does delete the particular entry we are looking at as well as possibly other
entries when the ref count for those entries gets set to 0 as well.

Then we have this loop in hash_iterate.c:

   for (i = 0; i < hash->size; i++)
            for (hb = hash->index[i]; hb; hb = hbnext) {
                    /* get pointer to next hash bucket here, in case (*func)
                     * decides to delete hb by calling hash_release
                     */
                    hbnext = hb->next;
                    (*func)(hb, arg);
            }
Suppose in the previous loop hbnext is set to hb->next and we call
zebra_nhg_sweep_entry. This deletes the previous entry and also
happens to cause the hbnext entry to be deleted as well, because of nhg
refcounts. At this point in time the memory pointed to by hbnext is
not owned by the pthread anymore and we can end up on a state where
it's overwritten by another pthread in zebra with data for other incoming events.

What to do?  Let's change the sweep function to a hash_walk and have
it stop iterating and to start over if there is a possible double
delete operation.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
(cherry picked from commit 07b9ebca65832813cc00722401f282a51a11ac17)

2 years agoMerge pull request #10538 from FRRouting/mergify/bp/dev/8.2/pr-10445
Jafar Al-Gharaibeh [Wed, 9 Feb 2022 03:22:36 +0000 (21:22 -0600)]
Merge pull request #10538 from FRRouting/mergify/bp/dev/8.2/pr-10445

tools: Stop disabled daemons when doing reload (backport #10445)

2 years agotools: Stop disabled daemons when doing reload
Donatas Abraitis [Sun, 30 Jan 2022 16:04:00 +0000 (18:04 +0200)]
tools: Stop disabled daemons when doing reload

After:
```
root@exit1-debian-11:~# grep ripngd= /etc/frr/daemons
ripngd=no
root@exit1-debian-11:~# pgrep -f ripngd -c
0
root@exit1-debian-11:~# sed -i 's/ripngd=no/ripngd=yes/' /etc/frr/daemons
root@exit1-debian-11:~# /usr/lib/frr/frrinit.sh reload
Stopped watchfrr.
Started watchfrr.
root@exit1-debian-11:~# pgrep -f ripngd -c
2
root@exit1-debian-11:~# grep ripngd= /etc/frr/daemons
ripngd=yes
root@exit1-debian-11:~# sed -i 's/ripngd=yes/ripngd=no/' /etc/frr/daemons
root@exit1-debian-11:~# /usr/lib/frr/frrinit.sh reload
Stopped watchfrr.
Started watchfrr.
Stopped ripngd.
root@exit1-debian-11:~# pgrep -f ripngd -c
0
```

Before:
```
root@exit1-debian-11:~# grep ripngd= /etc/frr/daemons
ripngd=no
root@exit1-debian-11:~# pgrep -f ripngd -c
0
root@exit1-debian-11:~# sed -i 's/ripngd=no/ripngd=yes/' /etc/frr/daemons
root@exit1-debian-11:~# /usr/lib/frr/frrinit.sh reload
Stopped watchfrr.
Started watchfrr.
root@exit1-debian-11:~# pgrep -f ripngd -c
2
root@exit1-debian-11:~# grep ripngd= /etc/frr/daemons
ripngd=yes
root@exit1-debian-11:~# sed -i 's/ripngd=yes/ripngd=no/' /etc/frr/daemons
root@exit1-debian-11:~# /usr/lib/frr/frrinit.sh reload
Stopped watchfrr.
Started watchfrr.
Stopped ripngd.
root@exit1-debian-11:~# pgrep -f ripngd -c
1 <<<<<< ripngd is running, while watchfrr skips it
```

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
(cherry picked from commit dc3bae68a2422ead82a12fa8480417fd4e351cdd)

2 years agobgpd: avoid memcmp comparison of struct nexthop
Igor Ryzhov [Tue, 8 Feb 2022 17:34:28 +0000 (20:34 +0300)]
bgpd: avoid memcmp comparison of struct nexthop

Using memcmp is wrong because struct nexthop may contain unitialized
padding bytes that should not be compared.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
(cherry picked from commit e4190ca4abb5282a9b4144f8c629b8008c41f64b)

2 years agoMerge pull request #10528 from FRRouting/mergify/bp/dev/8.2/pr-10504
Donald Sharp [Tue, 8 Feb 2022 18:26:31 +0000 (13:26 -0500)]
Merge pull request #10528 from FRRouting/mergify/bp/dev/8.2/pr-10504

babeld: fix the checks for truncated packets (backport #10504)

2 years agobabeld: fix #10502 #10503 by repairing the checks on length
qingkaishi [Fri, 4 Feb 2022 21:41:11 +0000 (16:41 -0500)]
babeld: fix #10502 #10503 by repairing the checks on length

This patch repairs the checking conditions on length in four functions:
babel_packet_examin, parse_hello_subtlv, parse_ihu_subtlv, and parse_update_subtlv

Signed-off-by: qingkaishi <qingkaishi@gmail.com>
(cherry picked from commit c3793352a8d76d2eee1edc38a9a16c1c8a6573f4)

2 years agoMerge pull request #10526 from FRRouting/mergify/bp/dev/8.2/pr-10524
Donatas Abraitis [Tue, 8 Feb 2022 06:57:08 +0000 (08:57 +0200)]
Merge pull request #10526 from FRRouting/mergify/bp/dev/8.2/pr-10524

pimd: Modify `show ip pim assert` to only show interesting bits (backport #10524)

2 years agoMerge pull request #10521 from FRRouting/mergify/bp/dev/8.2/pr-9926
Jafar Al-Gharaibeh [Tue, 8 Feb 2022 06:10:06 +0000 (00:10 -0600)]
Merge pull request #10521 from FRRouting/mergify/bp/dev/8.2/pr-9926

zebra: Fix v6 route replace failure turned into success (backport #9926)

2 years agoMerge pull request #10522 from FRRouting/mergify/bp/dev/8.2/pr-10441
Jafar Al-Gharaibeh [Tue, 8 Feb 2022 04:48:04 +0000 (22:48 -0600)]
Merge pull request #10522 from FRRouting/mergify/bp/dev/8.2/pr-10441

pimd: Only remove bsr NHT if we actually have tracked something (backport #10441)

2 years agopimd: Modify `show ip pim assert` to only show interesting bits
Donald Sharp [Tue, 8 Feb 2022 00:55:00 +0000 (19:55 -0500)]
pimd: Modify `show ip pim assert` to only show interesting bits

`show ip pim assert` shows S,G ifchannel information even when
there is no information available about the assert process.

Fix the code to not dump non-interesting cases.

Fixes: 10462
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
(cherry picked from commit 35e5ef55f1ec3f6e3fa78c268b2ed2a392b17d23)

2 years agopim: Use INADDR_ANY for current_bsr checking is valid yet
Donald Sharp [Fri, 4 Feb 2022 13:49:39 +0000 (08:49 -0500)]
pim: Use INADDR_ANY for current_bsr checking is valid yet

In all places that pim_nht_bsr_del is called, the code
needs to not unregister if the current_bsr is INADDR_ANY.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
(cherry picked from commit 5f010b1205a9b4977d08329bd3e100fb5f41c0ff)

2 years agopimd: Only remove bsr NHT if we actually have tracked something
Donald Sharp [Fri, 28 Jan 2022 16:17:53 +0000 (11:17 -0500)]
pimd: Only remove bsr NHT if we actually have tracked something

I'm now seeing in my log file:

2022/01/28 11:20:05 PIM: [Q0PZ7-QBBN3] attempting to delete nonexistent NHT BSR entry 0.0.0.0
2022/01/28 11:20:05 PIM: [Q0PZ7-QBBN3] attempting to delete nonexistent NHT BSR entry 0.0.0.0
2022/01/28 11:20:06 PIM: [Q0PZ7-QBBN3] attempting to delete nonexistent NHT BSR entry 0.0.0.0

When I run pimd.  Looking at the code there are 3 places where pim_bsm.c removes the
NHT BSR tracking.  In 2 of them the code ensures that the address is already setup
in 1 place it is not.  Fix.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
(cherry picked from commit 2d51f27f028412ad089ff1f910f6489eb917631d)

2 years agozebra: Fix v6 route replace failure turned into success
Donald Sharp [Wed, 10 Nov 2021 21:58:58 +0000 (16:58 -0500)]
zebra: Fix v6 route replace failure turned into success

Currently when we have a route replace operation for v6 routes
with a new nexthop group the order of kernel installation is this:

a) New nexthop group insertion seq  1
b) Route delete operation seq 3
c) Route insertion operation seq 2

Currently the code in nl_batch_read_resp is attempting
to handle this situation by skipping the delete operation.
*BUT* it is enqueuing the context into the zebra dplane
queue before we read the response.  Since we create the ctx
with an implied success, success is being reported to the
upper level dplane and the zebra rib thinks the route has
been properly handled.

This is showing up in the zebra_seg6_route test code because
the test code is installing a seg6 route w/ sharpd and it
is failing to install because the route's nexthop is rejected:

First installation:

2021/10/29 09:28:10.218 ZEBRA: [JGWSB-SMNVE] dplane: incoming new work counter: 2
2021/10/29 09:28:10.218 ZEBRA: [Q52A7-211QJ] dplane enqueues 2 new work to provider 'Kernel'
2021/10/29 09:28:10.218 ZEBRA: [JVY1P-93VFY] dplane provider 'Kernel': processing
2021/10/29 09:28:10.218 ZEBRA: [TX9N0-9JKDF] ID (9) Dplane nexthop update ctx 0x56125390a820 op NH_INSTALL
2021/10/29 09:28:10.218 ZEBRA: [PM9ZJ-07RCP] 0:1::1/128 Dplane route update ctx 0x56125390add0 op ROUTE_INSTALL
2021/10/29 09:28:10.218 ZEBRA: [TJ327-ET8HE] netlink_send_msg: >> netlink message dump [sent]
2021/10/29 09:28:10.218 ZEBRA: [JAS4D-NCWGP] nlmsghdr [len=104 type=(104) NEWNEXTHOP flags=(0x0501) {REQUEST,DUMP,(ROOT|REPLACE|CAPPED),(ATOMIC|CREATE)} seq=9 pid=3539131282]
2021/10/29 09:28:10.218 ZEBRA: [WCX94-SW894]   nhm [family=(10) AF_INET6 scope=(0) UNIVERSE protocol=(11) ZEBRA flags=0x00000000 {}]
2021/10/29 09:28:10.218 ZEBRA: [KFBSR-XYJV1]     rta [len=8 (payload=4) type=(1) ID]
2021/10/29 09:28:10.218 ZEBRA: [Z4E9C-GD9EP]       9
2021/10/29 09:28:10.218 ZEBRA: [KFBSR-XYJV1]     rta [len=20 (payload=16) type=(6) GATEWAY]
2021/10/29 09:28:10.218 ZEBRA: [STTSM-27M81]       2001::1
2021/10/29 09:28:10.218 ZEBRA: [KFBSR-XYJV1]     rta [len=8 (payload=4) type=(5) OIF]
2021/10/29 09:28:10.218 ZEBRA: [JR4EA-BKPTA]       6
2021/10/29 09:28:10.218 ZEBRA: [KFBSR-XYJV1]     rta [len=6 (payload=2) type=(7) ENCAP_TYPE]
2021/10/29 09:28:10.218 ZEBRA: [JR4EA-BKPTA]       5
2021/10/29 09:28:10.218 ZEBRA: [KFBSR-XYJV1]     rta [len=36 (payload=32) type=(32776) UNKNOWN]
2021/10/29 09:28:10.218 ZEBRA: [JAS4D-NCWGP] nlmsghdr [len=64 type=(24) NEWROUTE flags=(0x0401) {REQUEST,(ATOMIC|CREATE)} seq=10 pid=3539131282]
2021/10/29 09:28:10.218 ZEBRA: [GCEGC-W8YBF]   rtmsg [family=(10) AF_INET6 dstlen=128 srclen=0 tos=0 table=254 protocol=(194) UNKNOWN scope=(0) UNIVERSE type=(1) UNICAST flags=0x0000 {}]
2021/10/29 09:28:10.218 ZEBRA: [KFBSR-XYJV1]     rta [len=20 (payload=16) type=(1) DST]
2021/10/29 09:28:10.218 ZEBRA: [STTSM-27M81]       1::1
2021/10/29 09:28:10.218 ZEBRA: [KFBSR-XYJV1]     rta [len=8 (payload=4) type=(6) PRIORITY]
2021/10/29 09:28:10.218 ZEBRA: [Z4E9C-GD9EP]       20
2021/10/29 09:28:10.218 ZEBRA: [KFBSR-XYJV1]     rta [len=8 (payload=4) type=(30) NH_ID]
2021/10/29 09:28:10.218 ZEBRA: [Z4E9C-GD9EP]       9
2021/10/29 09:28:10.218 ZEBRA: [V8KNF-8EXH8] netlink_recv_msg: << netlink message dump [recv]
2021/10/29 09:28:10.218 ZEBRA: [JAS4D-NCWGP] nlmsghdr [len=76 type=(2) ERROR flags=(0x0300) {DUMP,(ROOT|REPLACE|CAPPED),(MATCH|EXCLUDE|ACK_TLVS)} seq=9 pid=3539131282]
2021/10/29 09:28:10.218 ZEBRA: [KWP1C-6CSXF]   nlmsgerr [error=(-22) Invalid argument]
2021/10/29 09:28:10.218 ZEBRA: [HSYZM-HV7HF] Extended Error: Gateway can not be a local address
2021/10/29 09:28:10.218 ZEBRA: [WVJCK-PPMGD][EC 4043309093] netlink-dp (NS 0) error: Invalid argument, type=RTM_NEWNEXTHOP(104), seq=9, pid=3539131282
2021/10/29 09:28:10.218 ZEBRA: [V8KNF-8EXH8] netlink_recv_msg: << netlink message dump [recv]
2021/10/29 09:28:10.218 ZEBRA: [JAS4D-NCWGP] nlmsghdr [len=68 type=(2) ERROR flags=(0x0300) {DUMP,(ROOT|REPLACE|CAPPED),(MATCH|EXCLUDE|ACK_TLVS)} seq=10 pid=3539131282]
2021/10/29 09:28:10.218 ZEBRA: [KWP1C-6CSXF]   nlmsgerr [error=(-22) Invalid argument]
2021/10/29 09:28:10.218 ZEBRA: [HSYZM-HV7HF] Extended Error: Nexthop id does not exist
2021/10/29 09:28:10.218 ZEBRA: [WVJCK-PPMGD][EC 4043309093] netlink-dp (NS 0) error: Invalid argument, type=RTM_NEWROUTE(24), seq=10, pid=3539131282
2021/10/29 09:28:10.218 ZEBRA: [VCDW6-A7ZF1] dplane dequeues 2 completed work from provider Kernel
2021/10/29 09:28:10.218 ZEBRA: [JTWAB-1MH4Y] dplane has 2 completed, 0 errors, for zebra main
2021/10/29 09:28:10.218 ZEBRA: [J7K9Z-9M7DT] Nexthop dplane ctx 0x56125390a820, op NH_INSTALL, nexthop ID (9), result FAILURE
2021/10/29 09:28:10.218 ZEBRA: [P2XBZ-RAFQ5][EC 4043309074] Failed to install Nexthop ID (9) into the kernel
2021/10/29 09:28:10.218 ZEBRA: [RMK34-61HV5] default(0:254):1::1/128 Processing dplane result ctx 0x56125390add0, op ROUTE_INSTALL result FAILURE

Note the last line `op ROUTE_INSTALL result FAILURE` because we are attempting to use a
a gw nexthop that is local.  This is the result.

Then the test code was installing the route again:

2021/10/29 09:30:00.493 ZEBRA: [JGWSB-SMNVE] dplane: incoming new work counter: 2
2021/10/29 09:30:00.493 ZEBRA: [Q52A7-211QJ] dplane enqueues 2 new work to provider 'Kernel'
2021/10/29 09:30:00.493 ZEBRA: [JVY1P-93VFY] dplane provider 'Kernel': processing
2021/10/29 09:30:00.493 ZEBRA: [TX9N0-9JKDF] ID (9) Dplane nexthop update ctx 0x561253916a00 op NH_INSTALL
2021/10/29 09:30:00.493 ZEBRA: [PM9ZJ-07RCP] 0:1::1/128 Dplane route update ctx 0x561253915f40 op ROUTE_UPDATE
2021/10/29 09:30:00.493 ZEBRA: [TJ327-ET8HE] netlink_send_msg: >> netlink message dump [sent]
2021/10/29 09:30:00.493 ZEBRA: [JAS4D-NCWGP] nlmsghdr [len=104 type=(104) NEWNEXTHOP flags=(0x0501) {REQUEST,DUMP,(ROOT|REPLACE|CAPPED),(ATOMIC|CREATE)} seq=11 pid=3539131282]
2021/10/29 09:30:00.493 ZEBRA: [WCX94-SW894]   nhm [family=(10) AF_INET6 scope=(0) UNIVERSE protocol=(11) ZEBRA flags=0x00000000 {}]
2021/10/29 09:30:00.493 ZEBRA: [KFBSR-XYJV1]     rta [len=8 (payload=4) type=(1) ID]
2021/10/29 09:30:00.493 ZEBRA: [Z4E9C-GD9EP]       9
2021/10/29 09:30:00.493 ZEBRA: [KFBSR-XYJV1]     rta [len=20 (payload=16) type=(6) GATEWAY]
2021/10/29 09:30:00.493 ZEBRA: [STTSM-27M81]       2001::1
2021/10/29 09:30:00.493 ZEBRA: [KFBSR-XYJV1]     rta [len=8 (payload=4) type=(5) OIF]
2021/10/29 09:30:00.493 ZEBRA: [JR4EA-BKPTA]       6
2021/10/29 09:30:00.493 ZEBRA: [KFBSR-XYJV1]     rta [len=6 (payload=2) type=(7) ENCAP_TYPE]
2021/10/29 09:30:00.493 ZEBRA: [JR4EA-BKPTA]       5
2021/10/29 09:30:00.493 ZEBRA: [KFBSR-XYJV1]     rta [len=36 (payload=32) type=(32776) UNKNOWN]
2021/10/29 09:30:00.493 ZEBRA: [JAS4D-NCWGP] nlmsghdr [len=56 type=(25) DELROUTE flags=(0x0401) {REQUEST,(ATOMIC|CREATE)} seq=13 pid=3539131282]
2021/10/29 09:30:00.493 ZEBRA: [GCEGC-W8YBF]   rtmsg [family=(10) AF_INET6 dstlen=128 srclen=0 tos=0 table=254 protocol=(194) UNKNOWN scope=(0) UNIVERSE type=(0) UNSPEC flags=0x0000 {}]
2021/10/29 09:30:00.493 ZEBRA: [KFBSR-XYJV1]     rta [len=20 (payload=16) type=(1) DST]
2021/10/29 09:30:00.493 ZEBRA: [STTSM-27M81]       1::1
2021/10/29 09:30:00.493 ZEBRA: [KFBSR-XYJV1]     rta [len=8 (payload=4) type=(6) PRIORITY]
2021/10/29 09:30:00.493 ZEBRA: [Z4E9C-GD9EP]       20
2021/10/29 09:30:00.493 ZEBRA: [JAS4D-NCWGP] nlmsghdr [len=64 type=(24) NEWROUTE flags=(0x0401) {REQUEST,(ATOMIC|CREATE)} seq=12 pid=3539131282]
2021/10/29 09:30:00.493 ZEBRA: [GCEGC-W8YBF]   rtmsg [family=(10) AF_INET6 dstlen=128 srclen=0 tos=0 table=254 protocol=(194) UNKNOWN scope=(0) UNIVERSE type=(1) UNICAST flags=0x0000 {}]
2021/10/29 09:30:00.493 ZEBRA: [KFBSR-XYJV1]     rta [len=20 (payload=16) type=(1) DST]
2021/10/29 09:30:00.493 ZEBRA: [STTSM-27M81]       1::1
2021/10/29 09:30:00.493 ZEBRA: [KFBSR-XYJV1]     rta [len=8 (payload=4) type=(6) PRIORITY]
2021/10/29 09:30:00.493 ZEBRA: [Z4E9C-GD9EP]       20
2021/10/29 09:30:00.493 ZEBRA: [KFBSR-XYJV1]     rta [len=8 (payload=4) type=(30) NH_ID]
2021/10/29 09:30:00.493 ZEBRA: [Z4E9C-GD9EP]       9
2021/10/29 09:30:00.493 ZEBRA: [V8KNF-8EXH8] netlink_recv_msg: << netlink message dump [recv]
2021/10/29 09:30:00.493 ZEBRA: [JAS4D-NCWGP] nlmsghdr [len=76 type=(2) ERROR flags=(0x0300) {DUMP,(ROOT|REPLACE|CAPPED),(MATCH|EXCLUDE|ACK_TLVS)} seq=11 pid=3539131282]
2021/10/29 09:30:00.493 ZEBRA: [KWP1C-6CSXF]   nlmsgerr [error=(-22) Invalid argument]
2021/10/29 09:30:00.493 ZEBRA: [HSYZM-HV7HF] Extended Error: Gateway can not be a local address
2021/10/29 09:30:00.493 ZEBRA: [WVJCK-PPMGD][EC 4043309093] netlink-dp (NS 0) error: Invalid argument, type=RTM_NEWNEXTHOP(104), seq=11, pid=3539131282
2021/10/29 09:30:00.493 ZEBRA: [V8KNF-8EXH8] netlink_recv_msg: << netlink message dump [recv]
2021/10/29 09:30:00.493 ZEBRA: [JAS4D-NCWGP] nlmsghdr [len=36 type=(2) ERROR flags=(0x0100) {DUMP,(ROOT|REPLACE|CAPPED)} seq=13 pid=3539131282]
2021/10/29 09:30:00.493 ZEBRA: [KWP1C-6CSXF]   nlmsgerr [error=(-3) No such process]
2021/10/29 09:30:00.493 ZEBRA: [V8KNF-8EXH8] netlink_recv_msg: << netlink message dump [recv]
2021/10/29 09:30:00.493 ZEBRA: [JAS4D-NCWGP] nlmsghdr [len=68 type=(2) ERROR flags=(0x0300) {DUMP,(ROOT|REPLACE|CAPPED),(MATCH|EXCLUDE|ACK_TLVS)} seq=12 pid=3539131282]
2021/10/29 09:30:00.493 ZEBRA: [KWP1C-6CSXF]   nlmsgerr [error=(-22) Invalid argument]
2021/10/29 09:30:00.493 ZEBRA: [VCDW6-A7ZF1] dplane dequeues 2 completed work from provider Kernel
2021/10/29 09:30:00.493 ZEBRA: [JTWAB-1MH4Y] dplane has 2 completed, 0 errors, for zebra main
2021/10/29 09:30:00.493 ZEBRA: [J7K9Z-9M7DT] Nexthop dplane ctx 0x561253916a00, op NH_INSTALL, nexthop ID (9), result FAILURE
2021/10/29 09:30:00.493 ZEBRA: [P2XBZ-RAFQ5][EC 4043309074] Failed to install Nexthop ID (9) into the kernel
2021/10/29 09:30:00.493 ZEBRA: [RMK34-61HV5] default(0:254):1::1/128 Processing dplane result ctx 0x561253915f40, op ROUTE_UPDATE result SUCCESS

Note that this time we do these three operations

a) nexthop installation seq 11
b) route delete seq 13
c) route add seq 12

Note the last line, we report the install as a success but it clearly failed from the seq=12 decode.
When we look at the v6 rib it thinks it is installed:

unet> r1 show ipv6 route
Codes: K - kernel route, C - connected, S - static, R - RIPng,
       O - OSPFv3, I - IS-IS, B - BGP, N - NHRP, T - Table,
       v - VNC, V - VNC-Direct, A - Babel, D - SHARP, F - PBR,
       f - OpenFabric,
       > - selected route, * - FIB route, q - queued, r - rejected, b - backup
       t - trapped, o - offload failure

D>* 1::1/128 [150/0] via 2001::1, dum0, seg6local unspec unknown(seg6local_context2str), seg6 a::, weight 1, 00:00:17

So let's modify nl_batch_read_resp to not dequeue/enqueue the context until we are sure we have
the right one.  This fixes the test code to do the right thing on the second installation.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
(cherry picked from commit c8453cd77e92d90ee580f15d6c05788a3da10aed)

2 years agozebra: set zd_is_update in 1 spot
Donald Sharp [Wed, 10 Nov 2021 20:09:37 +0000 (15:09 -0500)]
zebra: set zd_is_update in 1 spot

The ctx->zd_is_update is being set in various
spots based upon the same value that we are
passing into dplane_ctx_ns_init.  Let's just
consolidate all this into the dplane_ctx_ns_init
so that the zd_is_udpate value is set at the
same time that we increment the sequence numbers
to use.

As a note for future me's reading this.  The sequence
number choosen for the seq number passed to the
kernel is that each context gets a copy of the
appropriate nlsock to use.  Since it's a copy
at a point in time, we know we have a unique sequence
number value.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
(cherry picked from commit e3ee55d4bde5de9d39a91b53b30f67a6e45bbdb8)

2 years agozebra: When we get an implicit or ack or full failure mark status
Donald Sharp [Wed, 10 Nov 2021 19:12:39 +0000 (14:12 -0500)]
zebra: When we get an implicit or ack or full failure mark status

When nl_batch_read_resp gets a full on failure -1 or an implicit
ack 0 from the kernel for a batch of code.  Let's immediately
mark all of those in the batch pass/fail as needed.  Instead
of having them marked else where.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
(cherry picked from commit 00249e255ee651eefb027f3a3c8deb0f130f6193)

2 years agoMerge pull request #10512 from FRRouting/mergify/bp/dev/8.2/pr-10510
Jafar Al-Gharaibeh [Mon, 7 Feb 2022 17:08:11 +0000 (11:08 -0600)]
Merge pull request #10512 from FRRouting/mergify/bp/dev/8.2/pr-10510

bgpd: Flush temporary attributes after route-map apply (backport #10510)

2 years agobgpd: Print route-map name for filtred outgoing prefixes
Donatas Abraitis [Mon, 7 Feb 2022 10:04:10 +0000 (12:04 +0200)]
bgpd: Print route-map name for filtred outgoing prefixes

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
(cherry picked from commit 024945804a0afa519de1926d8c8588f3700aac69)

2 years agobgpd: Flush temporary attributes after route-map apply
Donatas Abraitis [Mon, 7 Feb 2022 08:50:33 +0000 (10:50 +0200)]
bgpd: Flush temporary attributes after route-map apply

Fixes crash:

```
Received signal 6 at 1644222173 (si_addr 0x6f000012d2, PC 0x7f79274cbfb7); aborting...
/usr/lib/x86_64-linux-gnu/frr/libfrr.so.0(zlog_backtrace_sigsafe+0x6d) [0x7f79282e079d]
/usr/lib/x86_64-linux-gnu/frr/libfrr.so.0(zlog_signal+0xf3) [0x7f79282e0993]
/usr/lib/x86_64-linux-gnu/frr/libfrr.so.0(+0xbd881) [0x7f792830b881]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x12980) [0x7f7927890980]
/lib/x86_64-linux-gnu/libc.so.6(gsignal+0xc7) [0x7f79274cbfb7]
/lib/x86_64-linux-gnu/libc.so.6(abort+0x141) [0x7f79274cd921]
/lib/x86_64-linux-gnu/libc.so.6(+0x89967) [0x7f7927516967]
/lib/x86_64-linux-gnu/libc.so.6(+0x909da) [0x7f792751d9da]
/lib/x86_64-linux-gnu/libc.so.6(cfree+0x620) [0x7f7927525050]
/usr/lib/frr/bgpd(+0x1e7c1c) [0x55b5c53b1c1c]
/usr/lib/frr/bgpd(aspath_free+0x28) [0x55b5c53b1c78]
/usr/lib/frr/bgpd(bgp_attr_flush+0x245) [0x55b5c52abc15]
/usr/lib/frr/bgpd(subgroup_announce_check+0x1137) [0x55b5c530c5d7]
```

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
(cherry picked from commit 686826e90e5d8a96e6b4b93cef77aa595fd83ef0)

2 years agoMerge pull request #10508 from FRRouting/mergify/bp/dev/8.2/pr-10432
Donatas Abraitis [Mon, 7 Feb 2022 06:05:11 +0000 (08:05 +0200)]
Merge pull request #10508 from FRRouting/mergify/bp/dev/8.2/pr-10432

pbrd: pbr route maps get addr family of nhgs (backport #10432)

2 years agopbrd: pbr route maps get addr family of nhgs
Stephen Worley [Thu, 27 Jan 2022 17:41:49 +0000 (12:41 -0500)]
pbrd: pbr route maps get addr family of nhgs

When adding a nhg to a route map, make sure to specify the `family`
of the rm by looking at the contents of the nhg. Installation in the
kernel (for DSCP rules in particular) relies on this being specified in
the netlink message.

Signed-off-by: Wesley Coakley <wcoakley@nvidia.com>
Signed-off-by: Stephen Worley <sworley@nvidia.com>
(cherry picked from commit 9a7ea213c072a24aa2059e04cb51502a3e956705)

2 years agoMerge pull request #10497 from FRRouting/mergify/bp/dev/8.2/pr-10473
Donatas Abraitis [Fri, 4 Feb 2022 15:39:54 +0000 (17:39 +0200)]
Merge pull request #10497 from FRRouting/mergify/bp/dev/8.2/pr-10473

ospfd: Core in ospf_if_down during shutdown. (backport #10473)

2 years agoospfd: Core in ospf_if_down during shutdown.
Tomi Salminen [Wed, 2 Feb 2022 09:19:09 +0000 (11:19 +0200)]
ospfd: Core in ospf_if_down during shutdown.

Skip marking routes as changed in ospf_if_down if there's now
new_table present, which might be the case when the instance is
being finished

The backtrace for the core was:

  raise (sig=sig@entry=11) at ../sysdeps/unix/sysv/linux/raise.c:50
  core_handler (signo=11, siginfo=0x7fffffffe170, context=<optimized out>) at lib/sigevent.c:262
  <signal handler called>
  route_top (table=0x0) at lib/table.c:401
  ospf_if_down (oi=oi@entry=0x555555999090) at ospfd/ospf_interface.c:849
  ospf_if_free (oi=0x555555999090) at ospfd/ospf_interface.c:339
  ospf_finish_final (ospf=0x55555599c830) at ospfd/ospfd.c:749
  ospf_deferred_shutdown_finish (ospf=0x55555599c830) at ospfd/ospfd.c:578
  ospf_deferred_shutdown_check (ospf=<optimized out>) at ospfd/ospfd.c:627
  ospf_finish (ospf=<optimized out>) at ospfd/ospfd.c:683
  ospf_terminate () at ospfd/ospfd.c:653
  sigint () at ospfd/ospf_main.c:109
  quagga_sigevent_process () at lib/sigevent.c:130
  thread_fetch (m=m@entry=0x5555556e45e0, fetch=fetch@entry=0x7fffffffe9b0) at lib/thread.c:1709
  frr_run (master=0x5555556e45e0) at lib/libfrr.c:1174
  main (argc=9, argv=0x7fffffffecb8) at ospfd/ospf_main.c:254

Signed-off-by: Tomi Salminen <tsalminen@forcepoint.com>
(cherry picked from commit d4e66f14854d1cc5bdb8b8209613fd596f8c1775)

2 years agoMerge pull request #10488 from FRRouting/mergify/bp/dev/8.2/pr-10485
Donatas Abraitis [Thu, 3 Feb 2022 08:05:17 +0000 (10:05 +0200)]
Merge pull request #10488 from FRRouting/mergify/bp/dev/8.2/pr-10485

bgpd: strncmp -> strcmp in community hash foo (backport #10485)

2 years agobgpd: strncmp -> strcmp in community hash foo
Quentin Young [Wed, 2 Feb 2022 21:34:03 +0000 (16:34 -0500)]
bgpd: strncmp -> strcmp in community hash foo

buffers are null terminated

Signed-off-by: Quentin Young <qlyoung@nvidia.com>
(cherry picked from commit c975f1a5e405f7a74d45519862388cd9ea8ce782)

2 years agoMerge pull request #10463 from idryzhov/bgp-memcmp
Jafar Al-Gharaibeh [Wed, 2 Feb 2022 18:38:54 +0000 (12:38 -0600)]
Merge pull request #10463 from idryzhov/bgp-memcmp

[8.2] bgpd: Fixing memcmp to avoid coverity issue

2 years agoMerge pull request #10476 from FRRouting/mergify/bp/dev/8.2/pr-10409
Mark Stapp [Wed, 2 Feb 2022 17:53:07 +0000 (12:53 -0500)]
Merge pull request #10476 from FRRouting/mergify/bp/dev/8.2/pr-10409

zebra: fix cleanup of meta queues on vrf disable (backport #10409)

2 years agozebra: fix cleanup of meta queues on vrf disable
Igor Ryzhov [Sun, 23 Jan 2022 17:22:42 +0000 (20:22 +0300)]
zebra: fix cleanup of meta queues on vrf disable

Current code treats all metaqueues as lists of route_node structures.
However, some queues contain other structures that need to be cleaned up
differently. Casting the elements of those queues to struct route_node
and dereferencing them leads to a crash. The crash may be seen when
executing bgp_multi_vrf_topo2.

Fix the code by using the proper list element types.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
(cherry picked from commit 0ef6eacc95c82014c04f13be3b641ff3983040ca)

2 years agoMerge pull request #10466 from idryzhov/8.2-ospf-aggr-timer
Donatas Abraitis [Tue, 1 Feb 2022 19:26:11 +0000 (21:26 +0200)]
Merge pull request #10466 from idryzhov/8.2-ospf-aggr-timer

[8.2] ospfd: fix missing "aggregation timer" in running configuration

2 years agoospfd: fix missing "aggregation timer" in running configuration
anlan_cs [Wed, 19 Jan 2022 13:42:02 +0000 (08:42 -0500)]
ospfd: fix missing "aggregation timer" in running configuration

Signed-off-by: anlan_cs <vic.lan@pica8.com>
2 years agobgpd: Fixing memcmp to avoid coverity issue
Iqra Siddiqui [Tue, 18 Jan 2022 08:36:13 +0000 (00:36 -0800)]
bgpd: Fixing memcmp to avoid coverity issue

Description:
Replacing memcmp at certain places,
to avoid the coverity issues caused by it.

Co-authored-by: Kantesh Mundargi <kmundaragi@vmware.com>
Signed-off-by: Iqra Siddiqui <imujeebsiddi@vmware.com>
2 years agoMerge pull request #10451 from donaldsharp/route_tag_ntohl
Igor Ryzhov [Mon, 31 Jan 2022 19:50:48 +0000 (22:50 +0300)]
Merge pull request #10451 from donaldsharp/route_tag_ntohl

ospfd: Convert output to host order from network order for route_tag

2 years agoMerge pull request #10448 from ton31337/fix/zebra_ospf6d_json_leak
Donald Sharp [Mon, 31 Jan 2022 17:58:19 +0000 (12:58 -0500)]
Merge pull request #10448 from ton31337/fix/zebra_ospf6d_json_leak

ospf6d: Fix memory leak for `show ipv6 ospf6 zebra json`

2 years agoospfd: Convert output to host order from network order for route_tag
Donald Sharp [Mon, 31 Jan 2022 17:49:55 +0000 (12:49 -0500)]
ospfd: Convert output to host order from network order for route_tag

FRR stores the route_tag in network byte order.  Bug filed indicates
that the `show ip ospf route` command shows the correct value.
Every place route_tag is dumped in ospf_vty.c the ntohl function
is used first.

Fixes: #10450
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2 years agoospf6d: Fix memory leak for `show ipv6 ospf6 zebra json`
Donatas Abraitis [Mon, 31 Jan 2022 13:56:56 +0000 (15:56 +0200)]
ospf6d: Fix memory leak for `show ipv6 ospf6 zebra json`

$ for x in $(seq 1 10000); do vtysh -c 'show ipv6 ospf6 zebra json' >/dev/null; done

Before:
```
$ vtysh -c 'show memory ospf6d' | grep 'Total heap allocated'
  Total heap allocated:  26 MiB
```

After:
```
$ vtysh -c 'show memory ospf6d' | grep 'Total heap allocated'
  Total heap allocated:  2256 KiB
```

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2 years agoMerge pull request #9869 from leonshaw/fix/evpn-queue
Mark Stapp [Fri, 28 Jan 2022 16:58:43 +0000 (11:58 -0500)]
Merge pull request #9869 from leonshaw/fix/evpn-queue

zebra: Fix EVPN route nexthop config order

2 years agoMerge pull request #10357 from ton31337/fix/peer_address_self_check_relax
Russ White [Fri, 28 Jan 2022 16:12:45 +0000 (11:12 -0500)]
Merge pull request #10357 from ton31337/fix/peer_address_self_check_relax

bgpd: Relax peer to be on the same host

2 years agozebra: Fix EVPN route nexthop config order
Xiao Liang [Fri, 22 Oct 2021 07:45:33 +0000 (15:45 +0800)]
zebra: Fix EVPN route nexthop config order

EVPN route add should be queued to preserve the config order.
In particular, against deletion in rib_delete().

Signed-off-by: Xiao Liang <shaw.leon@gmail.com>
2 years agoMerge pull request #10408 from idryzhov/no-opaque-by-default
Donatas Abraitis [Fri, 28 Jan 2022 10:54:16 +0000 (12:54 +0200)]
Merge pull request #10408 from idryzhov/no-opaque-by-default

*: do not send opaque data to zebra by default

2 years agoMerge pull request #10159 from taspelund/retain-peer-asn
Donatas Abraitis [Fri, 28 Jan 2022 07:22:06 +0000 (09:22 +0200)]
Merge pull request #10159 from taspelund/retain-peer-asn

bgpd: retain peer asn even with remove-private-AS

2 years agoMerge pull request #10389 from gromit1811/bugfix_9720_ecmp_inter_area
Donatas Abraitis [Fri, 28 Jan 2022 07:09:51 +0000 (09:09 +0200)]
Merge pull request #10389 from gromit1811/bugfix_9720_ecmp_inter_area

ospf6d: Fix ECMP inter-area route nexthop update

2 years agoMerge pull request #10420 from donaldsharp/zebra_multicast_vrf_cleanup
Donatas Abraitis [Fri, 28 Jan 2022 06:55:12 +0000 (08:55 +0200)]
Merge pull request #10420 from donaldsharp/zebra_multicast_vrf_cleanup

zebra: Actually delete the table we are looking for

2 years agoMerge pull request #10433 from idryzhov/vrrp-ip-addr-is-zero
Quentin Young [Thu, 27 Jan 2022 21:08:15 +0000 (16:08 -0500)]
Merge pull request #10433 from idryzhov/vrrp-ip-addr-is-zero

2 years agoMerge pull request #10434 from idryzhov/isis-attached-bit
Mark Stapp [Thu, 27 Jan 2022 20:54:59 +0000 (15:54 -0500)]
Merge pull request #10434 from idryzhov/isis-attached-bit

isisd: remove deprecated command

2 years agoisisd: remove deprecated command
Igor Ryzhov [Thu, 27 Jan 2022 18:12:22 +0000 (21:12 +0300)]
isisd: remove deprecated command

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2 years agovrrpd: use ipaddr_is_zero when needed
Igor Ryzhov [Thu, 27 Jan 2022 18:05:40 +0000 (21:05 +0300)]
vrrpd: use ipaddr_is_zero when needed

Replace custom implementation or call to ipaddr_isset with a call to
ipaddr_is_zero.

ipaddr_isset is not fully correct, because it's fine to have some
non-zero bytes at the end of the struct in case of IPv4 and the function
doesn't allow that.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2 years agoMerge pull request #9880 from louis-oui/maximum-prefix-out
Donatas Abraitis [Thu, 27 Jan 2022 06:49:31 +0000 (08:49 +0200)]
Merge pull request #9880 from louis-oui/maximum-prefix-out

bgpd: fixes maximum prefix out

2 years agotopotests: set bgp peer-group with maximum-prefix-out
Louis Scalbert [Mon, 25 Oct 2021 11:25:35 +0000 (13:25 +0200)]
topotests: set bgp peer-group with maximum-prefix-out

Set different combinations of bgp peer-group with a maximum-prefix-out
value.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2 years agobgpd: fix peer-group with maximum-prefix-out
Louis Scalbert [Mon, 25 Oct 2021 11:25:19 +0000 (13:25 +0200)]
bgpd: fix peer-group with maximum-prefix-out

When setting maximum-prefix-out on peer-group, the applied value on
member is 0.

Fix usage of maximum-prefix-out on peer-group.

The peer_maximum_prefix_out_(un)set functions are derived from
peer_maximum_prefix_(un)set.

Fixes: fde246e8353a ("bgpd: Add an option to limit outgoing prefixes")
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2 years agotopotests: bgp no neighbor X.X.X.X maximum-prefix-out Y
Louis Scalbert [Mon, 25 Oct 2021 11:24:09 +0000 (13:24 +0200)]
topotests: bgp no neighbor X.X.X.X maximum-prefix-out Y

Test the ability to use the following configure command with a Y value:

no neighbor X.X.X.X maximum-prefix-out Y

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2 years agobgpd: allow no neighbor X.X.X.X maximum-prefix-out [(1-4294967295)]
Louis Scalbert [Mon, 25 Oct 2021 11:23:38 +0000 (13:23 +0200)]
bgpd: allow no neighbor X.X.X.X maximum-prefix-out [(1-4294967295)]

Specifying a number is not possible with command no neighbor X.X.X.X
maximum-prefix-out

> frr(config-router-af)# no neighbor 192.168.1.2 maximum-prefix-out 1
> % Unknown command: no neighbor 192.168.1.2 maximum-prefix-out 1

This patch allows it.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2 years agoMerge pull request #10425 from ckishimo/ospf6d_nssa
Donald Sharp [Wed, 26 Jan 2022 14:56:34 +0000 (09:56 -0500)]
Merge pull request #10425 from ckishimo/ospf6d_nssa

ospf6d: show if area is NSSA

2 years agozebra: Don't double delete the table we are cleaning up
Donald Sharp [Mon, 24 Jan 2022 20:37:54 +0000 (15:37 -0500)]
zebra: Don't double delete the table we are cleaning up

vrf_disable is always called first before
vrf_delete.  The rnh_table and rnh_table_multicast tables
are already deleted as part of vrf_disable.  No need
to do it again.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2 years agoospf6d: show if area is NSSA
ckishimo [Tue, 25 Jan 2022 17:49:27 +0000 (18:49 +0100)]
ospf6d: show if area is NSSA

This PR will include if the area is NSSA in the output of "show ipv6 ospf"

    r2# show ipv6 ospf
     ...
     Area 0.0.0.0
         Number of Area scoped LSAs is 8
         Interface attached to this area: r2-eth1
         SPF last executed 20.46717s ago
     Area 0.0.0.1[Stub]
         Number of Area scoped LSAs is 9
         Interface attached to this area: r2-eth0
         SPF last executed 20.46911s ago
     Area 0.0.0.2[NSSA]
         Number of Area scoped LSAs is 14
         Interface attached to this area: r2-eth2
         SPF last executed 20.46801s ago

Signed-off-by: ckishimo <carles.kishimoto@gmail.com>