]> git.puffer.fish Git - matthieu/frr.git/log
matthieu/frr.git
4 years agoMerge pull request #7654 from idryzhov/7.5-ospf-init-instance
Donald Sharp [Wed, 2 Dec 2020 13:53:53 +0000 (08:53 -0500)]
Merge pull request #7654 from idryzhov/7.5-ospf-init-instance

[7.5] ospf: fix instance initialization when using multi-instance mode

4 years agoospf: fix instance initialization when using multi-instance mode
Igor Ryzhov [Wed, 2 Dec 2020 00:36:10 +0000 (03:36 +0300)]
ospf: fix instance initialization when using multi-instance mode

OSPF instance initialization was moved from "router ospf" vty command to
ospf_get function some time ago but the same thing must be done in
ospf_get_instance function used when multi-instance mode is enabled.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
4 years agoMerge pull request #7616 from idryzhov/more-7.5-backports
Donald Sharp [Mon, 30 Nov 2020 12:48:41 +0000 (07:48 -0500)]
Merge pull request #7616 from idryzhov/more-7.5-backports

[7.5] backport fixes

4 years agoMerge pull request #7622 from idryzhov/7.5-fix-cisco-access-list
Rafael Zalamena [Mon, 30 Nov 2020 12:17:19 +0000 (09:17 -0300)]
Merge pull request #7622 from idryzhov/7.5-fix-cisco-access-list

[7.5] yang: fix cisco access list source value

4 years agoyang: fix cisco access list source value
Igor Ryzhov [Fri, 27 Nov 2020 18:53:25 +0000 (21:53 +0300)]
yang: fix cisco access list source value

Source value must be a choice between host, network and any, not a set
of all three.

Fixes #7599.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
4 years agoldpd: Prevent usage after free
Donald Sharp [Thu, 26 Nov 2020 23:23:57 +0000 (18:23 -0500)]
ldpd: Prevent usage after free

error 26-Nov-2020 14:35:02 ERROR: AddressSanitizer: heap-use-after-free on address 0x631000024838 at pc 0x55cefae977e9 bp 0x7ffdd3546860 sp 0x7ffdd3546850
error 26-Nov-2020 14:35:02 READ of size 4 at 0x631000024838 thread T0
error 26-Nov-2020 14:35:02     #0 0x55cefae977e8 in ldpe_imsg_compose_parent_sync ldpd/ldpe.c:256
error 26-Nov-2020 14:35:02     #1 0x55cefae9ab13 in vlog ldpd/log.c:53
error 26-Nov-2020 14:35:02     #2 0x55cefae9b21f in log_info ldpd/log.c:102
error 26-Nov-2020 14:35:02     #3 0x55cefae96eae in ldpe_shutdown ldpd/ldpe.c:237
error 26-Nov-2020 14:35:02     #4 0x55cefae99254 in ldpe_dispatch_main ldpd/ldpe.c:585
error 26-Nov-2020 14:35:02     #5 0x55cefaf93875 in thread_call lib/thread.c:1681
error 26-Nov-2020 14:35:02     #6 0x55cefae97304 in ldpe ldpd/ldpe.c:136
error 26-Nov-2020 14:35:02     #7 0x55cefae5a2e2 in main ldpd/ldpd.c:322
error 26-Nov-2020 14:35:02     #8 0x7f4ef0c33b96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96)
error 26-Nov-2020 14:35:02     #9 0x55cefae525e9 in _start (/usr/lib/frr/ldpd+0xb35e9)
error 26-Nov-2020 14:35:02
error 26-Nov-2020 14:35:02 0x631000024838 is located 65592 bytes inside of 65632-byte region [0x631000014800,0x631000024860)
error 26-Nov-2020 14:35:02 freed by thread T0 here:
error 26-Nov-2020 14:35:02     #0 0x7f4ef21e37a8 in __interceptor_free (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xde7a8)
error 26-Nov-2020 14:35:02     #1 0x55cefae96e91 in ldpe_shutdown ldpd/ldpe.c:234
error 26-Nov-2020 14:35:02     #2 0x55cefae99254 in ldpe_dispatch_main ldpd/ldpe.c:585
error 26-Nov-2020 14:35:02     #3 0x55cefaf93875 in thread_call lib/thread.c:1681
error 26-Nov-2020 14:35:02     #4 0x55cefae97304 in ldpe ldpd/ldpe.c:136
error 26-Nov-2020 14:35:02     #5 0x55cefae5a2e2 in main ldpd/ldpd.c:322
error 26-Nov-2020 14:35:02     #6 0x7f4ef0c33b96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96)
error 26-Nov-2020 14:35:02
error 26-Nov-2020 14:35:02 previously allocated by thread T0 here:
error 26-Nov-2020 14:35:02     #0 0x7f4ef21e3d28 in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xded28)
error 26-Nov-2020 14:35:02     #1 0x55cefae9725d in ldpe ldpd/ldpe.c:127
error 26-Nov-2020 14:35:02     #2 0x55cefae5a2e2 in main ldpd/ldpd.c:322
error 26-Nov-2020 14:35:02     #3 0x7f4ef0c33b96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96)

Clean this problem up in the same way as the previous commit

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
4 years agoldpd: Prevent usage after free
Donald Sharp [Wed, 25 Nov 2020 12:36:43 +0000 (07:36 -0500)]
ldpd: Prevent usage after free

We are using data after it has been freed and handed back to the
OS.
Address Sanitizer output:

error 23-Nov-2020 18:53:57 ERROR: AddressSanitizer: heap-use-after-free on address 0x631000024838 at pc 0x55f825998f58 bp 0x7fffa5b0f5b0 sp 0x7fffa5b0f5a0
error 23-Nov-2020 18:53:57 READ of size 4 at 0x631000024838 thread T0
error 23-Nov-2020 18:53:57     #0 0x55f825998f57 in lde_imsg_compose_parent_sync ldpd/lde.c:226
error 23-Nov-2020 18:53:57     #1 0x55f8259ca9ed in vlog ldpd/log.c:48
error 23-Nov-2020 18:53:57     #2 0x55f8259cb1c8 in log_info ldpd/log.c:102
error 23-Nov-2020 18:53:57     #3 0x55f82599e841 in lde_shutdown ldpd/lde.c:208
error 23-Nov-2020 18:53:57     #4 0x55f8259a2703 in lde_dispatch_parent ldpd/lde.c:666
error 23-Nov-2020 18:53:57     #5 0x55f825ac3815 in thread_call lib/thread.c:1681
error 23-Nov-2020 18:53:57     #6 0x55f825998d5e in lde ldpd/lde.c:160
error 23-Nov-2020 18:53:57     #7 0x55f82598a289 in main ldpd/ldpd.c:320
error 23-Nov-2020 18:53:57     #8 0x7fe3f749db96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96)
error 23-Nov-2020 18:53:57     #9 0x55f825982579 in _start (/usr/lib/frr/ldpd+0xb3579)
error 23-Nov-2020 18:53:57
error 23-Nov-2020 18:53:57 0x631000024838 is located 65592 bytes inside of 65632-byte region [0x631000014800,0x631000024860)
error 23-Nov-2020 18:53:57 freed by thread T0 here:
error 23-Nov-2020 18:53:57     #0 0x7fe3f8a4d7a8 in __interceptor_free (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xde7a8)
error 23-Nov-2020 18:53:57     #1 0x55f82599e830 in lde_shutdown ldpd/lde.c:206
error 23-Nov-2020 18:53:57     #2 0x55f8259a2703 in lde_dispatch_parent ldpd/lde.c:666
error 23-Nov-2020 18:53:57     #3 0x55f825ac3815 in thread_call lib/thread.c:1681
error 23-Nov-2020 18:53:57     #4 0x55f825998d5e in lde ldpd/lde.c:160
error 23-Nov-2020 18:53:57     #5 0x55f82598a289 in main ldpd/ldpd.c:320
error 23-Nov-2020 18:53:57     #6 0x7fe3f749db96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96)
error 23-Nov-2020 18:53:57
error 23-Nov-2020 18:53:57 previously allocated by thread T0 here:
error 23-Nov-2020 18:53:57     #0 0x7fe3f8a4dd28 in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xded28)
error 23-Nov-2020 18:53:57     #1 0x55f825998cb7 in lde ldpd/lde.c:151
error 23-Nov-2020 18:53:57     #2 0x55f82598a289 in main ldpd/ldpd.c:320
error 23-Nov-2020 18:53:57     #3 0x7fe3f749db96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96)
error 23-Nov-2020 18:53:57

The fix is to put this in global space.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
4 years agoisisd: check vertex type before checking its data
Renato Westphal [Fri, 20 Nov 2020 22:26:45 +0000 (19:26 -0300)]
isisd: check vertex type before checking its data

vertex->N is an union whose "id" and "ip" fields are only valid
depending on the vertex type (IS adjacency or IP reachability
information). As such, add a vertex type check before consulting
vertex->N.id in order to prevent unexpected behavior from happening.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
4 years agoisisd: fix some crashes with --tcli
Renato Westphal [Fri, 6 Nov 2020 13:02:16 +0000 (10:02 -0300)]
isisd: fix some crashes with --tcli

The "ifp" variable returned by nb_running_get_entry() might be
NULL when using the transactional CLI mode. Make the required
modifications to avoid null pointer dereferences.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
4 years agobgpd: sh running config is not considering values provided via -e for max-paths
vdhingra [Thu, 19 Nov 2020 12:46:39 +0000 (04:46 -0800)]
bgpd: sh running config is not considering values provided via -e for max-paths

problem
1. run the bgp with -e1 option
2. c t
   router bgp 100
3. show running config
    !
     address-family ipv6 multicast
      maximum-paths 1
      maximum-paths ibgp 1
     exit-address-family
    !
address families should not dump maximum-paths if there
value is same as value provided at run time.

fix
if the maxpaths_ebgp value is same as multipath_num global
object, don't dump maximum-paths.

Signed-off-by: vishaldhingra <vdhingra@vmware.com>
4 years agoospfd: fix NSSA translate-always
ckishimo [Fri, 20 Nov 2020 21:53:20 +0000 (13:53 -0800)]
ospfd: fix NSSA translate-always

When an ABR NSSA router is configured to be ALWAYS the translator:
  r22(config-router)# area 1 nssa translate-always

It will advertise this condition in the type-1 LSA setting the Nt
bit, taking over the translator role from r33

  r22# show ip ospf
     We are an ABR and always an NSSA Translator.
  r33# show ip ospf
     We are an ABR, but not the NSSA Elected Translator.

However when the command above is removed:
  r22(config-router)# no area 1 nssa translate-always

the bit Nt needs to be cleared otherwise we end up with no translator
in the area
  r22# show ip ospf
     We are an ABR, but not the NSSA Elected Translator.
  r33# show ip ospf
     We are an ABR, but not the NSSA Elected Translator.

This PR forces the ABR to send a type-1 LSA with the Nt bit updated
according to the translator role

Signed-off-by: ckishimo <carles.kishimoto@gmail.com>
4 years agoospfd: fix NSSA translator
ckishimo [Thu, 19 Nov 2020 07:23:14 +0000 (23:23 -0800)]
ospfd: fix NSSA translator

Having 2 ABR in NSSA area where R3 is the elected translator

R3# show ip ospf
  We are an ABR and the NSSA Elected Translator.
R2# show ip ospf
  We are an ABR, but not the NSSA Elected Translator.

When R3 loses the Border condition by shutting down the interface
to the backbone, we end up with no translator in the NSSA area. It
is expected R2 to take over the translator role

R3# sh ip ospf
  It is not ABR, therefore not Translator.
R2# show ip ospf
   We are an ABR, but not the NSSA Elected Translator.

This PR forces the ABR to reevaluate the translator condition, so
R2 becomes the elected Translator

Signed-off-by: ckishimo <carles.kishimoto@gmail.com>
4 years agoospf6d: More lists being leaked
Donald Sharp [Thu, 19 Nov 2020 13:04:51 +0000 (08:04 -0500)]
ospf6d: More lists being leaked

Apparently the person who wrote this code was big into
cut-n-paste.  Commit 710a61d57c8f1b0ea66a37f09bad2161d7e2ddb7
found the first instance, but upon code inspection this morning
it became evident that 2 other functions had the exact same
problem.

Fix.  Note I have not cleaned up the cut-n-paste code for
two reasons: a) I'm chasing something else b) this code
has been fairly un-maintained for a very long time.  No
need to start up now.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
4 years agobfdd: fix multiple links same address
Rafael Zalamena [Wed, 18 Nov 2020 18:47:00 +0000 (15:47 -0300)]
bfdd: fix multiple links same address

Allows users with multiple links using same IPv6 address (same VRF) to
work.

Reported-by: Matti Suuronen
Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
4 years agobgpd: Prevent ecommunity_ecom2str memory leak
Donald Sharp [Wed, 18 Nov 2020 17:50:48 +0000 (12:50 -0500)]
bgpd: Prevent ecommunity_ecom2str memory leak

We were allocating but never freeing memory associated with the
ecommunity_ecom2str allocation.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
4 years agobgpd: Do not leak vname if we find the match
Donald Sharp [Wed, 18 Nov 2020 17:10:22 +0000 (12:10 -0500)]
bgpd: Do not leak vname if we find the match

If we are attempting to store the bgp name for route
leaking and we find a match do not leak the memory.

Please note this is probably not really going to happen
ever.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
4 years agoospf6d: Free up list memory
Donald Sharp [Wed, 18 Nov 2020 16:42:50 +0000 (11:42 -0500)]
ospf6d: Free up list memory

OSPFv3 snmp code creates a list but never deletes the actual
list.  Do so.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
4 years agopimd: A buffer may be used uninited
Donald Sharp [Wed, 18 Nov 2020 16:42:06 +0000 (11:42 -0500)]
pimd: A buffer may be used uninited

If we screw up and don't have the right flags we'll print
out garbage.  At the very least just print out nothing.

Signed-off-by: Donald Sharp <sharp@nvidia.com>
4 years agotools: fix frr-reload l2vpn delete
Emanuele Di Pascale [Wed, 11 Nov 2020 16:29:15 +0000 (17:29 +0100)]
tools: fix frr-reload l2vpn delete

when deleting a whole l2vpn context in ldpd which also had pseudowires
in it, we were first deleting the l2vpn with a 'no l2vpn XXX' command,
and then adding it again by running 'l2vpn XXX\n no member pseudowire YYY'
which obviously was not needed. As a result the l2vpn would be reinstated.

Signed-off-by: Emanuele Di Pascale <emanuele@voltanet.io>
4 years agoisisd: fix uninitialized variable
Igor Ryzhov [Wed, 18 Nov 2020 16:07:49 +0000 (19:07 +0300)]
isisd: fix uninitialized variable

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
4 years agozebra: fix writing to pointer instead of value
Igor Ryzhov [Wed, 18 Nov 2020 16:05:30 +0000 (19:05 +0300)]
zebra: fix writing to pointer instead of value

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
4 years agolib: Cleanup mem-leaks in error case
Donald Sharp [Wed, 18 Nov 2020 13:54:51 +0000 (08:54 -0500)]
lib: Cleanup mem-leaks in error case

When we fail to properly lookup an error code, properly cleanup
on return.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
4 years agoMerge pull request #7605 from donaldsharp/75_ospf_crash_fix
Donatas Abraitis [Thu, 26 Nov 2020 12:53:29 +0000 (14:53 +0200)]
Merge pull request #7605 from donaldsharp/75_ospf_crash_fix

[7.5]ospfd: Prevent crash by accessing memory not owned.

4 years agoospfd: Prevent crash by accessing memory not owned.
Donald Sharp [Wed, 25 Nov 2020 14:49:28 +0000 (09:49 -0500)]
ospfd: Prevent crash by accessing memory not owned.

When allocating memory for the `struct ospf_metric` we
were using `uint32_t` instead of the actual size of this
structure.  When we wrote to it we would be writing
into other people's memory.

Found-by: Amol Lad
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
4 years agoMerge pull request #7575 from idryzhov/7.5-fix-quit
Donald Sharp [Fri, 20 Nov 2020 18:01:13 +0000 (13:01 -0500)]
Merge pull request #7575 from idryzhov/7.5-fix-quit

[7.5] vtysh: send quit command to watchfrr

4 years agovtysh: send quit command to watchfrr
Igor Ryzhov [Fri, 20 Nov 2020 14:42:39 +0000 (17:42 +0300)]
vtysh: send quit command to watchfrr

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
4 years agoMerge pull request #7542 from idryzhov/7.5-bp
Donald Sharp [Wed, 18 Nov 2020 20:26:54 +0000 (15:26 -0500)]
Merge pull request #7542 from idryzhov/7.5-bp

[7.5] backport recent fixes

4 years agoMerge pull request #7547 from idryzhov/debian-revision
Donatas Abraitis [Wed, 18 Nov 2020 06:30:14 +0000 (08:30 +0200)]
Merge pull request #7547 from idryzhov/debian-revision

[7.5] changelog: add debian revision

4 years agochangelog: add debian revision
Igor Ryzhov [Tue, 17 Nov 2020 18:21:09 +0000 (21:21 +0300)]
changelog: add debian revision

It is optional, but lintian complains when a package mixes versions with
and without revision number. All previous versions have it so 7.5 should
have it too.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
4 years agolib: notify BFD when adding new profile
Rafael Zalamena [Sun, 4 Oct 2020 21:04:27 +0000 (18:04 -0300)]
lib: notify BFD when adding new profile

When a BFD integrated session already exists setting the profile
doesn't cause a session update (or vice versa): fix this issue by
handling the other cases.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
4 years agoospfd: reset mpls-te prior to ospf router removal
Carlo Galiotto [Fri, 13 Nov 2020 16:35:06 +0000 (17:35 +0100)]
ospfd: reset mpls-te prior to ospf router removal

This commits attempts to fix a problem that occurs when mpls-te gets
removed from ospfd config. Mpls-te has an inter-as option, which can be
set to Off/Area/AS. Whenever the inter-as takes "Area" or "AS" as a
value, this value will not be cleaned after removing mpls-te or after
removing the ospf router. Therefore, if mpls-te is configured with
inter-as AS or Area and we remove mpls-te or the ospf router, the
inter-as will still preserve its value; therefore, next time mpls-te is
enabled, it will automatically inherits the previous inter-as value
(either Area or AS). This leads to wrong configuration, which can be a
problem for frr_reload.py.
The commits forces mpls-te to reset inter-as to Off before it mpls-te
gets removed from the configuration and before the ospf router gets
removed.

Signed-off-by: Carlo Galiotto <carlo@voltanet.io>
4 years agolib: When aborting log data
Donald Sharp [Mon, 16 Nov 2020 20:12:43 +0000 (15:12 -0500)]
lib: When aborting log data

When a FRR process dies due to SIGILL/SIGABORT/etc attempt
to drain the log buffer.  This code change is capturing
some missing logs that were not part of the log file on
a crash.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
4 years agobabeld: Free ifc leak
Donald Sharp [Sun, 15 Nov 2020 02:19:42 +0000 (21:19 -0500)]
babeld: Free ifc leak

On removal of an address on an interface babel was not properly
cleaning memory.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
4 years agoisisd: Free created tables
Donald Sharp [Sat, 14 Nov 2020 22:58:40 +0000 (17:58 -0500)]
isisd: Free created tables

On redistribution into isis we were creating a table for
handling the redistributed routes, but never cleaning them
up on shutdown properly.  Do so.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
4 years agobgpd: on debug esi was not properly setup
Donald Sharp [Sat, 14 Nov 2020 22:33:43 +0000 (17:33 -0500)]
bgpd: on debug esi was not properly setup

There exists a code path where the esi would be passed
to a debug without the esi being setup with any values
causing us to display what ever is on the stack.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
4 years agoisisd: On shutdown leaking spf_timer thread data
Donald Sharp [Sat, 14 Nov 2020 22:32:01 +0000 (17:32 -0500)]
isisd: On shutdown leaking spf_timer thread data

When isis is being shutdown the area->spf_timer thread has
special data assigned to that was never being freed.
Free this data.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
4 years agobfdd: On interface address delete we are leaking memory
Donald Sharp [Sat, 14 Nov 2020 22:31:21 +0000 (17:31 -0500)]
bfdd: On interface address delete we are leaking memory

The interface address delete callback from zebra was not
deleting the ifc that was created as per normal work methodologies

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
4 years agobgpd: When showing a lcommunity free alloced memory
Donald Sharp [Sat, 14 Nov 2020 21:29:16 +0000 (16:29 -0500)]
bgpd: When showing a lcommunity free alloced memory

We are temporarily allocing memory to show lcommunity
information.  We then immediately drop it.  Account for
that memory properly.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
4 years agobgpd: Fix missed unlocks
Donald Sharp [Sat, 14 Nov 2020 20:32:49 +0000 (15:32 -0500)]
bgpd: Fix missed unlocks

When iterating over the bgp_dest table, using this pattern:

for (dest = bgp_table_top(table); dest;
     dest = bgp_route_next(dest)) {

If the code breaks or returns in the middle we will not have
properly unlocked the node as that bgp_table_top locks the top
dest and bgp_route_next locks the next dest and unlocks the old
dest.

From code inspection I have found a bunch of places that
we either return in the middle of or a break is issued.

Add appropriate unlocks.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
4 years agodoc: fix dup label in bgp doc
Mark Stapp [Thu, 12 Nov 2020 21:26:25 +0000 (16:26 -0500)]
doc: fix dup label in bgp doc

Make a label about v6 unique.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
4 years agolib, bgpd: fix crash using skiplist debug function
Emanuele Bovisio [Thu, 5 Nov 2020 13:36:00 +0000 (14:36 +0100)]
lib, bgpd: fix crash using skiplist debug function

calling "skiplist test" and then "skiplist debug",
there was a crash due to a freed pointer.

Agreed to remove static pointer (see PR #7474).

Signed-off-by: Emanuele Bovisio <emanuele.bovisio@eolo.it>
4 years agodocs: mention activate keyword in user docs
Michael Hohl [Wed, 11 Nov 2020 15:56:15 +0000 (16:56 +0100)]
docs: mention activate keyword in user docs

As of now, the BGP user documentation does not explicitly mention how
to use IPv6. This commit adds documentation of the activate command to
the user documentation which is crucial to get IPv6 networks announced
using FRRouting.

Signed-off-by: Michael Hohl <me@michaelhohl.net>
4 years agobgpd: withdraw any exported routes when deleting a vrf
Pat Ruddy [Thu, 29 Oct 2020 16:38:42 +0000 (16:38 +0000)]
bgpd: withdraw any exported routes when deleting a vrf

When a BGP vrf instance is deleted, the routes it exported into the
main VPN table are not deleted and they remain as stale routes
attached to an unknown bgp instance. When the new vrf instance comes
along, it imports these routes from the main table and thus we see
duplicatesalongside its own identical routes.
The solution is to call the unexport logic when a BGP vrf instance is
being deleted.

problem example
---------------
volta1# sh bgp vrf VRF-a ipv4 unicast
BGP table version is 4, local router ID is 18.0.0.1, vrf id 5
Default local pref 100, local AS 567
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
*> 7.0.0.6/32       7.0.0.5@0<              10    100      0 ?
*> 7.0.0.8/32       18.0.0.8                 0             0 111 ?
*> 18.0.0.0/24      18.0.0.8                 0             0 111 ?
*> 56.0.0.0/24      7.0.0.5@0<               0    100      0 ?
Displayed  4 routes and 4 total paths
volta1# conf t
volta1(config)# no router bgp 567 vrf VRF-a
volta1(config)#
volta1(config)# router bgp 567 vrf VRF-a
volta1(config-router)#  bgp router-id 18.0.0.1
volta1(config-router)#  no bgp ebgp-requires-policy
volta1(config-router)#  no bgp network import-check
volta1(config-router)#  neighbor 18.0.0.8 remote-as 111
volta1(config-router)#  !
volta1(config-router)#  address-family ipv4 unicast
volta1(config-router-af)#   label vpn export 12345
volta1(config-router-af)#   rd vpn export 567:111
volta1(config-router-af)#   rt vpn both 567:100
volta1(config-router-af)#   export vpn
volta1(config-router-af)#   import vpn
volta1(config-router-af)#  exit-address-family
volta1(config-router)# !
volta1(config-router)# end
volta1# sh bgp vrf VRF-a ipv4 unicast
BGP table version is 4, local router ID is 18.0.0.1, vrf id 5
Default local pref 100, local AS 567
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
*> 7.0.0.6/32       7.0.0.5@0<              10    100      0 ?
*  7.0.0.8/32       18.0.0.8                 0             0 111 ?
*>                  18.0.0.8@-<              0             0 111 ?
*  18.0.0.0/24      18.0.0.8                 0             0 111 ?
*>                  18.0.0.8@-<              0             0 111 ?
*> 56.0.0.0/24      7.0.0.5@0<               0    100      0 ?
Displayed  4 routes and 6 total paths

@- routes indicating unknown bgp instance are imported

Signed-off-by: Pat Ruddy <pat@voltanet.io>
4 years agostaticd: fixed memory leak on shudown
vdhingra [Fri, 23 Oct 2020 12:09:24 +0000 (05:09 -0700)]
staticd: fixed memory leak on shudown

When shutdown triggered, info pointer pointing to
static_route_info was not getting released for
route_table and srcdest_table.

Signed-off-by: vishaldhingra <vdhingra@vmware.com>
4 years agobgpd: avoid needless ebgp mhop reset
Emanuele Di Pascale [Mon, 9 Nov 2020 10:05:04 +0000 (11:05 +0100)]
bgpd: avoid needless ebgp mhop reset

if the user sets the ebgp-multihop for a neighbor to the same value
we currently have, avoid resetting the session and just return a
silent success.

Signed-off-by: Emanuele Di Pascale <emanuele@voltanet.io>
4 years agodoc: fix vrrp block quote
Quentin Young [Mon, 9 Nov 2020 21:19:13 +0000 (16:19 -0500)]
doc: fix vrrp block quote

Signed-off-by: Quentin Young <qlyoung@nvidia.com>
4 years agodoc: use anonymous link refs
Quentin Young [Mon, 9 Nov 2020 20:17:18 +0000 (15:17 -0500)]
doc: use anonymous link refs

rst...

Signed-off-by: Quentin Young <qlyoung@nvidia.com>
4 years agotests: only test count of nexthops in bgp max-paths test
Mark Stapp [Tue, 10 Nov 2020 14:50:50 +0000 (09:50 -0500)]
tests: only test count of nexthops in bgp max-paths test

Add support to compare the number of RIB nexthops, rather than the
specific nexthop addresses. Use this in the bgp_ecmp topotests that
test maximum-paths - testing the specific nexthops is wrong there,
it's not deterministic and we get spurious failures.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
4 years agozebra: Set NUD_NOARP on sticky MAC entries in addition to NTF_STICKY
Anuradha Karuppiah [Sat, 9 May 2020 02:53:36 +0000 (19:53 -0700)]
zebra: Set NUD_NOARP on sticky MAC entries in addition to NTF_STICKY

(ndm_state & NUD_NOARP) - prevents the entry from expiring
(ndm_flags & NTF_STICKY) - prevents station moves on the entry

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
4 years agonhrpd: Fix memory leak on shutdown
Donald Sharp [Sat, 7 Nov 2020 01:56:02 +0000 (20:56 -0500)]
nhrpd: Fix memory leak on shutdown

On shutdown we were blantantly dropping the node->info
data.  Make it happy.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
4 years agodoc: fix sphinx complaint about indent levels
Mark Stapp [Mon, 9 Nov 2020 17:44:44 +0000 (12:44 -0500)]
doc: fix sphinx complaint about indent levels

There was an inconsistency in the characters used for the second
level of title/section hierarchy - fix it.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
4 years agobgpd: Correct CLI description for `debug bgp keepalives`
Donatas Abraitis [Sat, 7 Nov 2020 15:22:34 +0000 (17:22 +0200)]
bgpd: Correct CLI description for `debug bgp keepalives`

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
4 years agodoc: add crosslink to developer docs
Quentin Young [Wed, 4 Nov 2020 22:33:17 +0000 (17:33 -0500)]
doc: add crosslink to developer docs

for source build instructions

Signed-off-by: Quentin Young <qlyoung@nvidia.com>
4 years agodoc: explain integrated config
Quentin Young [Wed, 4 Nov 2020 22:29:58 +0000 (17:29 -0500)]
doc: explain integrated config

This is poorly documented and confusing to users

Signed-off-by: Quentin Young <qlyoung@nvidia.com>
4 years agodoc: add troubleshooting info for vrrp
Quentin Young [Wed, 4 Nov 2020 22:21:33 +0000 (17:21 -0500)]
doc: add troubleshooting info for vrrp

Signed-off-by: Quentin Young <qlyoung@nvidia.com>
4 years agobfdd: fix crash on show bfd peers counters json
Emanuele Bovisio [Thu, 5 Nov 2020 13:27:51 +0000 (14:27 +0100)]
bfdd: fix crash on show bfd peers counters json

wrong pointer passed to bfd_id_iterate function

Signed-off-by: Emanuele Bovisio <emanuele.bovisio@eolo.it>
4 years agobfdd: fix possible null dereference
Igor Ryzhov [Thu, 5 Nov 2020 16:46:27 +0000 (19:46 +0300)]
bfdd: fix possible null dereference

bs->ifp may be null, so we should check it before dereferencing.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
4 years agoospf6d : Intra area route for connected prefix not installed
Soman K S [Sun, 4 Oct 2020 16:30:07 +0000 (22:00 +0530)]
ospf6d : Intra area route for connected prefix not installed

Issue: When ospfv3 is configured on interface between routers in different network,
       the intra area route for the remote connected prefix is not installed in ospf
       route table and zebra

Fix: When the advertising router is directly connected but in different network
     the interface lookup in the intra area lsa processing does not provide
     the matching interface and valid nexthop. Therefore the nexthop is
     copied from the link state entry which contains valid
     ifindex required for installing the route.

Signed-off-by: kssoman <somanks@gmail.com>
4 years agobgpd: Fix up rule encoding to zebra so it works
Donald Sharp [Wed, 4 Nov 2020 14:11:53 +0000 (09:11 -0500)]
bgpd: Fix up rule encoding to zebra so it works

Recent changes to the rule encoding that were made
did not get reflected in bgpd.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
4 years agopbrd: Fix memory leak in json output
Donald Sharp [Wed, 4 Nov 2020 14:11:13 +0000 (09:11 -0500)]
pbrd: Fix memory leak in json output

Fix a memory leak in using some pbr json commands.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
4 years agobgpd: Allow 1 prefix to generate statistics
Donald Sharp [Tue, 3 Nov 2020 20:24:03 +0000 (15:24 -0500)]
bgpd: Allow 1 prefix to generate statistics

When generating a config with 1 prefix:

BGP IPv4 Unicast RIB statistics
Total Advertisements          :            0
Total Prefixes                :            0
Average prefix length         :         0.00
Unaggregateable prefixes      :            0
Maximum aggregateable prefixes:            0
BGP Aggregate advertisements  :            0
Address space advertised      :            0
                  % announced :         0.00
                /8 equivalent :         0.00
               /24 equivalent :         0.00

Advertisements with paths     :            0
Longest AS-Path (hops)        :            0
Average AS-Path length (hops) :         0.00
Largest AS-Path (bytes)       :            0
Average AS-Path size (bytes)  :         0.00
Highest public ASN            :            0
eva# show bgp ipv4 uni summ
BGP router identifier 10.10.3.11, local AS number 329 vrf-id 0
BGP table version 1
RIB entries 1, using 192 bytes of memory
Peers 1, using 23 KiB of memory

Neighbor        V         AS   MsgRcvd   MsgSent   TblVer  InQ OutQ  Up/Down State/PfxRcd   PfxSnt
192.168.161.131 4      60000        24        27        0    0    0 00:01:05     (Policy)        1

Total number of neighbors 1

We are not displaying it in the statistics data.  This is because FRR is walking the associated
table and comparing the current dest to the top of the tree.  I have no idea why this is
the case as that when you have 1 prefix you only have 1 node in your tree.  Looking at the
code this is the original code that was imported in 2006.  I cannot think of any reason why
FRR needs to exclude this particular node.

Fixed:
eva# show bgp ipv4 uni summ
BGP router identifier 10.10.3.11, local AS number 329 vrf-id 0
BGP table version 1
RIB entries 1, using 192 bytes of memory
Peers 1, using 23 KiB of memory

Neighbor        V         AS   MsgRcvd   MsgSent   TblVer  InQ OutQ  Up/Down State/PfxRcd   PfxSnt
192.168.161.131 4      60000        24        27        0    0    0 00:01:05     (Policy)        1

Total number of neighbors 1
eva# show bgp ipv4 statistics
BGP IPv4 Unicast RIB statistics (VRF default)
Total Advertisements          :            1
Total Prefixes                :            1
Average prefix length         :        32.00
Unaggregateable prefixes      :            1
Maximum aggregateable prefixes:            0
BGP Aggregate advertisements  :            0
Address space advertised      :            1
                  % announced :         0.00
                /8 equivalent :         0.00
               /24 equivalent :         0.00

Advertisements with paths     :            1
Longest AS-Path (hops)        :            0
Average AS-Path length (hops) :         0.00
Largest AS-Path (bytes)       :            0
Average AS-Path size (bytes)  :         0.00
Highest public ASN            :            0
eva#

Fixes: #7422
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
4 years agobgpd: Multipath is always being allocated
Donald Sharp [Mon, 2 Nov 2020 15:14:48 +0000 (10:14 -0500)]
bgpd: Multipath is always being allocated

The multipath arrays are always being allocated, irrelevant
if we actually have multipath information for a prefix.

This is because the link bandwidth code was always adding the
data structure.  We should not be allocated multipath information
unless we actually have multipath information

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
4 years agodoc: fix code snippet for net-snmp
Pat Ruddy [Mon, 2 Nov 2020 16:47:58 +0000 (16:47 +0000)]
doc: fix code snippet for net-snmp

incorrect formatting in doc

Signed-off-by: Pat Ruddy <pat@voltanet.io>
4 years ago*: Correct spelling stuff
Donald Sharp [Thu, 29 Oct 2020 20:06:13 +0000 (16:06 -0400)]
*: Correct spelling stuff

Pretty obvious.  WE R SPELL GOOD

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
4 years agoisisd: fix segfault in the circuit p2p/bcast union
Emanuele Di Pascale [Thu, 29 Oct 2020 08:51:27 +0000 (09:51 +0100)]
isisd: fix segfault in the circuit p2p/bcast union

The fields in the broadcast/p2p union struct in an isis circuit are
initialized when the circuit goes up, but currently this step is
skipped if the interface is passive. This can create problems if the
circuit type (referred to as network type in the config) changes from
broadcast to point-to-point. We can end up with the p2p neighbor
pointer pointing at some garbage left by the broadcast struct in the
union, which would then cause a segfault the first time we would
dereference it - for example when building the lsp, or computing the
SPF tree.

compressed backtrace of a possible crash:
 #0  0x0000555555579a9c in lsp_build at frr/isisd/isis_lsp.c:1114
 #1  0x000055555557a516 in lsp_regenerate at frr/isisd/isis_lsp.c:1301
 #2  0x000055555557aa25 in lsp_refresh at frr/isisd/isis_lsp.c:1381
 #3  0x00007ffff7b2622c in thread_call at frr/lib/thread.c:1549
 #4  0x00007ffff7ad6df4 in frr_run at frr/lib/libfrr.c:1098
 #5  0x000055555556b67f in main at frr/isisd/isis_main.c:272

isis_lsp.c:
1112 case CIRCUIT_T_P2P: {
1113 struct isis_adjacency *nei = circuit->u.p2p.neighbor;
1114 if (nei && nei->adj_state == ISIS_ADJ_UP

Signed-off-by: Emanuele Di Pascale <emanuele@voltanet.io>
4 years agoMerge pull request #7537 from ton31337/fix/zebra_set_src_7.5
Russ White [Tue, 17 Nov 2020 12:09:48 +0000 (07:09 -0500)]
Merge pull request #7537 from ton31337/fix/zebra_set_src_7.5

zebra: [7.5] Allow `set src X` to work on startup

4 years agozebra: Allow `set src X` to work on startup
Donald Sharp [Fri, 13 Nov 2020 17:06:57 +0000 (12:06 -0500)]
zebra: Allow `set src X` to work on startup

If a route-map in zebra has `set src X` and the interface
X is on has not been configured yet, we are rejecting the command
outright.  This is a problem on boot up especially( and where I
found this issue ) in that interfaces *can* and *will* be slow
on startup and config can easily be read in *before* the
interface has an ip address.

Let's modify zebra to just warn to the user we may have a problem
and let the chips fall where they may.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
4 years agoMerge pull request #7516 from idryzhov/fix-changelog
Quentin Young [Fri, 13 Nov 2020 17:53:43 +0000 (12:53 -0500)]
Merge pull request #7516 from idryzhov/fix-changelog

[7.5] build: fix changelog indentation

4 years agobuild: fix changelog indentation
Igor Ryzhov [Fri, 13 Nov 2020 12:46:59 +0000 (15:46 +0300)]
build: fix changelog indentation

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
4 years agoMerge pull request #7451 from ton31337/fix/default-originate-match_7.5
Donald Sharp [Wed, 4 Nov 2020 17:32:35 +0000 (12:32 -0500)]
Merge pull request #7451 from ton31337/fix/default-originate-match_7.5

bgpd: [7.5] Handle route-maps properly for `default-originate route-map` command

4 years agobgpd: Handle route-maps properly for `default-originate route-map` command
Donatas Abraitis [Thu, 29 Oct 2020 19:41:12 +0000 (21:41 +0200)]
bgpd: Handle route-maps properly for `default-originate route-map` command

The problem is that only prefixes were handled and any other `match`
commands were ignored. Let's do not forget them as well.

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
4 years agotests: Add more tests for BGP default-originate command
Donatas Abraitis [Fri, 30 Oct 2020 10:47:44 +0000 (12:47 +0200)]
tests: Add more tests for BGP default-originate command

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
4 years agoFRRouting Release 7.5 frr-7.5
Martin Winter [Tue, 3 Nov 2020 22:47:40 +0000 (23:47 +0100)]
FRRouting Release 7.5

BFD
   Profile support
   Minimum ttl support
BGP
   rpki VRF support
   GR fixes
   Add wide option to display of routes
   Add `maximum-prefix <num> force`
   Add `bestpath-routes` to neighbor command
   Add `bgp shutdown message MSG...` command
   Add v6 Flowspec support
   Add `neighbor <neigh> shutdown rtt` command
   Allow update-delay to be applied globaly
EVPN
   Beginning of MultiHoming Support
ISIS
   Segment Routing Support
VRF Support
   Guard against adj timer display overflow
   Add support for Anycast-SIDs
   Add support for Topology Independent LFA (TI-LFA)
   Add `lsp-gen-interval 2` to isis configuration
OSPF
   Segment Routing support for ECMP
   Various LSA fixes
   Prevent crash if transferring config amongst instances
PBR
   Adding json support to commands
   DSCP/ECN based PBR Matching
PIM
   Add more json support to commands
   Fix missing mesh-group commands
   MSDP SA forwarding
   Clear (s,g,rpt) ifchannel on (*, G) prune received
   Fix igmp querier election and IP address mapping
   Crash fix when RP is removed
STATIC
   Northbound Support
YANG
   Filter and route-map Support
   OSPF model definition
   BGP model definition
VTYSH
   Speed up output across daemons
   Fix build-time errors for some --enable flags
   Speed up output of configuration across daemons
ZEBRA
   nexthop group support for FPM
   northbound support for rib model
   Backup nexthop support
   netlink batching support
   Allow upper level protocols to request ARP
   Add json output for zebra ES, ES-EVI and access vlan dumps

Upgrade to using libyang1.0.184

RPM
   Moved RPKI to subpackage
   Added SNMP subpackage

As always there are too many bugfixes to list individually.  This release
compromises just over 1k of commits by the community, with contributors from
70 people.

Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
4 years ago*: Fixup badly formated line
Donald Sharp [Tue, 3 Nov 2020 13:52:41 +0000 (08:52 -0500)]
*: Fixup badly formated line

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
4 years ago*: Update packaging/doc to version information
Donald Sharp [Tue, 3 Nov 2020 13:15:23 +0000 (08:15 -0500)]
*: Update packaging/doc to version information

Update the packaging to have correct version as well as
documentation for said packaging.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
4 years agoMerge pull request #7430 from opensourcerouting/rpm-subpkgs-75
Donald Sharp [Sat, 31 Oct 2020 11:09:01 +0000 (07:09 -0400)]
Merge pull request #7430 from opensourcerouting/rpm-subpkgs-75

[7.5] RPM Subpackages for RPKI and SNMP

4 years agoredhat: Update changelog in frr.spec.in
Martin Winter [Sat, 31 Oct 2020 01:19:18 +0000 (02:19 +0100)]
redhat: Update changelog in frr.spec.in

Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
4 years agoredhat: Add snmp as a subpackage
Martin Winter [Sat, 31 Oct 2020 01:11:45 +0000 (02:11 +0100)]
redhat: Add snmp as a subpackage

Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
4 years agoredhat: Move RPKI to subpackage instead of a RPM build option
Martin Winter [Sat, 31 Oct 2020 00:09:30 +0000 (01:09 +0100)]
redhat: Move RPKI to subpackage instead of a RPM build option

Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
4 years agoMerge pull request #7407 from idryzhov/7.5-backports
Donald Sharp [Wed, 28 Oct 2020 23:28:51 +0000 (19:28 -0400)]
Merge pull request #7407 from idryzhov/7.5-backports

[7.5] backport recent fixes

4 years agoospfd: remove all "ip ospf area" params when clearing instance
Igor Ryzhov [Tue, 13 Oct 2020 23:39:08 +0000 (02:39 +0300)]
ospfd: remove all "ip ospf area" params when clearing instance

Currently, only default area parameter is cleared, but we should do the
same for all area parameters with interface addresses.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
4 years agoospfd: use all "ip ospf area" params for ospf initialization
Igor Ryzhov [Tue, 13 Oct 2020 22:53:26 +0000 (01:53 +0300)]
ospfd: use all "ip ospf area" params for ospf initialization

Currently, only default area parameter is used for initialization, but
we should use area parameters with interfaces address as well.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
4 years agoospfd: don't initialize ospf every time "router ospf" is used
Igor Ryzhov [Tue, 13 Oct 2020 22:46:27 +0000 (01:46 +0300)]
ospfd: don't initialize ospf every time "router ospf" is used

Move ospf initialization to the actual place where it is created.
We don't need to do that every time "router ospf" is entered.
Also remove a couple of useless checks that can never be true.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
4 years agoospfd: correctly process interface creation/destruction
Igor Ryzhov [Tue, 13 Oct 2020 22:20:53 +0000 (01:20 +0300)]
ospfd: correctly process interface creation/destruction

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
4 years agoospfd: fix check for network configuration
Igor Ryzhov [Tue, 13 Oct 2020 21:25:35 +0000 (00:25 +0300)]
ospfd: fix check for network configuration

We should check for existing networks configuration before creating
if_params structure, or it leads to the memory leak.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
4 years agoospfd: remove dead code
Igor Ryzhov [Tue, 13 Oct 2020 21:02:48 +0000 (00:02 +0300)]
ospfd: remove dead code

ospf_router_id_update checks for ospf->oi_running, but it'll never be 1
right after creation by ospf_new.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
4 years agoospfd: don't remove interface config when removing router
Igor Ryzhov [Tue, 13 Oct 2020 20:11:10 +0000 (23:11 +0300)]
ospfd: don't remove interface config when removing router

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
4 years agoospfd: fix missing initialization and check for if_area param
Igor Ryzhov [Tue, 13 Oct 2020 19:53:02 +0000 (22:53 +0300)]
ospfd: fix missing initialization and check for if_area param

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
4 years agoospfd: fix freeing of if_params struct
Igor Ryzhov [Tue, 13 Oct 2020 19:52:12 +0000 (22:52 +0300)]
ospfd: fix freeing of if_params struct

Freeing of configuration structure should not depend on operational
variable.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
4 years agoospfd: fix missing newline
Igor Ryzhov [Tue, 13 Oct 2020 19:48:56 +0000 (22:48 +0300)]
ospfd: fix missing newline

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
4 years agoisisd: Fix usage of uninited memory
Donald Sharp [Tue, 27 Oct 2020 13:59:10 +0000 (09:59 -0400)]
isisd: Fix usage of uninited memory

valgrind is showing a usage of uninited memory:

==935465== Conditional jump or move depends on uninitialised value(s)
==935465==    at 0x159E17: tlvs_area_addresses_to_adj (isis_tlvs.c:4430)
==935465==    by 0x15A4BD: isis_tlvs_to_adj (isis_tlvs.c:4568)
==935465==    by 0x1377F0: process_p2p_hello (isis_pdu.c:203)
==935465==    by 0x1391FD: process_hello (isis_pdu.c:781)
==935465==    by 0x13BDBE: isis_handle_pdu (isis_pdu.c:1700)
==935465==    by 0x13BECD: isis_receive (isis_pdu.c:1744)
==935465==    by 0x49210FF: thread_call (thread.c:1585)
==935465==    by 0x48CFACB: frr_run (libfrr.c:1099)
==935465==    by 0x1218C9: main (isis_main.c:272)
==935465==
==935465== Conditional jump or move depends on uninitialised value(s)
==935465==    at 0x483EEC5: bcmp (vg_replace_strmem.c:1111)
==935465==    by 0x15A290: tlvs_ipv4_addresses_to_adj (isis_tlvs.c:4512)
==935465==    by 0x15A4EB: isis_tlvs_to_adj (isis_tlvs.c:4570)
==935465==    by 0x1377F0: process_p2p_hello (isis_pdu.c:203)
==935465==    by 0x1391FD: process_hello (isis_pdu.c:781)
==935465==    by 0x13BDBE: isis_handle_pdu (isis_pdu.c:1700)
==935465==    by 0x13BECD: isis_receive (isis_pdu.c:1744)
==935465==    by 0x49210FF: thread_call (thread.c:1585)
==935465==    by 0x48CFACB: frr_run (libfrr.c:1099)
==935465==    by 0x1218C9: main (isis_main.c:272)

Effectively we are reallocing memory to hold data.  realloc does not
set the new memory to anything.  So whatever happens to be in the memory
is what is there.  after the realloc happens we are iterating over the
memory just realloced and doing memcmp's to values in it causing these
use of uninitialized memory.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
4 years agobgpd: Prevent ecomm memory leak
Donald Sharp [Tue, 27 Oct 2020 19:16:32 +0000 (15:16 -0400)]
bgpd: Prevent ecomm memory leak

There are some situations where we create a ecommunity for
comparing to internal state when we are deleting, but in the
failure cases we would not free up the created memory.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
4 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>
4 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>
4 years agostaticd: remove redundant checks from vty
Igor Ryzhov [Thu, 22 Oct 2020 14:22:23 +0000 (17:22 +0300)]
staticd: remove redundant checks from vty

These checks are moved to NB layer.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
4 years agoospfd: fix lsa type-7 continuously refreshed
ckishimo [Thu, 24 Sep 2020 15:36:26 +0000 (08:36 -0700)]
ospfd: fix lsa type-7 continuously refreshed

Having an NSSA ABR redistributing statics, the type-7 LSA are being
continuously refreshed (every ~14 secs). The LSA Seq number keeps
incrementing and the LSA age is going back to 0 when reaching ~14s.

This PR fixes the issue by not forcing the LSA update

However I ignore if the "force" parameter was used in purpose. With this
PR updates are sent in case the metric or metric type are changed

Sep 24 08:54:48 r2 ospfd[7137]: ospf_flood_through: LOCAL NSSA FLOOD of Type-7.
Sep 24 08:55:02 r2 ospfd[7137]: ospf_flood_through: LOCAL NSSA FLOOD of Type-7.
Sep 24 08:55:16 r2 ospfd[7137]: ospf_flood_through: LOCAL NSSA FLOOD of Type-7.
Sep 24 08:55:30 r2 ospfd[7137]: ospf_flood_through: LOCAL NSSA FLOOD of Type-7.
Sep 24 08:55:44 r2 ospfd[7137]: ospf_flood_through: LOCAL NSSA FLOOD of Type-7.
Sep 24 08:55:58 r2 ospfd[7137]: ospf_flood_through: LOCAL NSSA FLOOD of Type-7.
Sep 24 08:56:12 r2 ospfd[7137]: ospf_flood_through: LOCAL NSSA FLOOD of Type-7.
Sep 24 08:56:26 r2 ospfd[7137]: ospf_flood_through: LOCAL NSSA FLOOD of Type-7.
Sep 24 08:56:40 r2 ospfd[7137]: ospf_flood_through: LOCAL NSSA FLOOD of Type-7.

ip route 2.2.2.2/32 blackhole
router ospf
 network 10.0.23.0/24 area 1
 area 1 nssa
!

r2# conf t
r2(config)# router ospf
r2(config-router)# redistribute static

r2# sh ip os da

                NSSA-external Link States (Area 0.0.0.1 [NSSA])

Link ID         ADV Router      Age  Seq#       CkSum  Route
2.2.2.2         10.0.25.2         13 0x8000000f 0x3f17 E2 2.2.2.2/32 [0x0]   <<< Seq: f, age 13

r2# sh ip os da

                NSSA-external Link States (Area 0.0.0.1 [NSSA])

Link ID         ADV Router      Age  Seq#       CkSum  Route
2.2.2.2         10.0.25.2          0 0x80000010 0x3d18 E2 2.2.2.2/32 [0x0]   <<< Seq: 10, age 0

r2# sh ip os da

                NSSA-external Link States (Area 0.0.0.1 [NSSA])

Link ID         ADV Router      Age  Seq#       CkSum  Route
2.2.2.2         10.0.25.2          3 0x8000001b 0x2723 E2 2.2.2.2/32 [0x0]   <<< Seq: 1b, age 3

Signed-off-by: ckishimo <carles.kishimoto@gmail.com>
4 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>
4 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>
4 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>
4 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>