Commit Graph

26761 Commits

Author SHA1 Message Date
Fredi Raspall
5403ff15db ospfd: remove unused macro
Signed-off-by: Fredi Raspall <fredi@voltanet.io>
2021-09-28 10:20:59 +02:00
Fredi Raspall
5bd62f051d ospfd: use existing macro on initialization of SR
Signed-off-by: Fredi Raspall <fredi@voltanet.io>
2021-09-28 10:20:58 +02:00
Fredi Raspall
2110d03e06 ospfd: remove unused enum case for state of SR ..
In addition, make the relationship among several macros more
explicit.

Signed-off-by: Fredi Raspall <fredi@voltanet.io>
2021-09-28 10:20:58 +02:00
Fredi Raspall
6f609c4980 ospfd: fix display of debug flags
* Some of the debug flags were not shown in show debugging.
* The check for TI-LFA debug was made against the wrong variable.
* Some of the debugs were not cleared with 'no debug ospf'

Signed-off-by: Fredi Raspall <fredi@voltanet.io>
2021-09-28 10:20:58 +02:00
Adriano Marto Reis
4687748973 pimd: fixing command "no ip msdp mesh-group member"
Deleting a mesh-group member no longer deletes the mesh-group.

Complete bug description at:
https://github.com/FRRouting/frr/issues/9664

Signed-off-by: Adriano Marto Reis <adrianomarto@gmail.com>
2021-09-28 12:43:52 +10:00
Chirag Shah
6ba578ef29 zebra: add resolver for nexthop in json
zebra rib 'show ip route json' lists all nexthops in a flat list.
To identify the recursively resolved
nexthops relation adding a flag "resolver" as delimiter
to identify recursively resolved nexthop in the list.

Testing Done:
{
  "1.1.1.0\/24":[
    {
      "prefix":"1.1.1.0\/24",
      "protocol":"static",
       ....
      "nexthops":[
        {
          "flags":5,
          "ip":"27.0.0.14",
          "afi":"ipv4",
          "active":true,
          "recursive":true,
          "weight":1
        },
        {
          "flags":3,
          "fib":true,
          "ip":"fe80::202:ff:fe00:11",
          "afi":"ipv6",
          "interfaceIndex":12,
          "interfaceName":"uplink-1",
          "resolver":true,  <-- Resolver for recursive true flag nh
          "active":true,
          "weight":1
        },
      ]
    }
  ]
}

Signed-off-by: Chirag Shah <chirag@nvidia.com>
2021-09-27 16:05:08 -07:00
Donald Sharp
027db46917 lib, zebra: Send safi for rnh resolution
Pass down the safi for when we need address
resolution.  At this point in time we are
hard coding the safi to SAFI_UNICAST.
Future commits will take advantage of this.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-09-27 15:26:05 -04:00
Donald Sharp
a4598b97d9 zebra: Create the SAFI_MULTICAST rnh tables
Actually create the SAFI_MULTICAST rnh tables.  No code
uses these yet.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-09-27 12:38:08 -04:00
Donald Sharp
d597533a9d zebra: Start carrying safi for rnh processing
PIM is going to need to be able to send down the address it is
trying to resolve in the multicast rib.  We need a way to signal
this to the end developer.  Start the conversion by adding the
ability to have a safi.  But only allow SAFI_UNICAST at the moment.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-09-27 12:38:08 -04:00
Donald Sharp
6cd9a93ddd zebra: Attempt to clarify variable names as they are used
Cleanup the poorly implemented variable names so that we can
understand what is going on a bit better.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-09-27 12:38:08 -04:00
Donald Sharp
93f533c308 zebra: remove zvrf->import_check_table
The import_check_table is no longer used, so let's remove it.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-09-27 12:38:08 -04:00
Donald Sharp
6071e5e96e zebra: remove 'enum rnh_type' from system
This code is now dead code since there are not two
nexthop resolution types.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-09-27 12:38:08 -04:00
Donald Sharp
7272e2a461 zebra: remove import check resolution from zebra
The entirety of the import checking no longer needs to be
in zebra as that no-one is calling it.  Remove the code.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-09-27 12:38:08 -04:00
Donald Sharp
3d174ce08d *: Remove the ZEBRA_IMPORT_ROUTE_XXX zapi messages
These are no longer really needed.  The client just needs
to call nexthop resolution instead.

So let's remove the zapi types.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-09-27 12:38:08 -04:00
Donald Sharp
ad5c8f67a8 ospf6d: Make ospfv3 use normal address resolution instead of import route
OSPFv3 recently introduced the usage of import route.  Switch it
back to using the normal ZEBRA_NEXTHOP_REGISTER command.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-09-27 12:38:08 -04:00
Donald Sharp
b8210849b8 bgpd: Make bgp ready to remove distinction between 2 nh tracking types
Allow bgp to figure out if it cares about address resolution instead
of having zebra care about it.  This will allow the removal of the
zapi type for import checking and just use nexthop resolution.

Effectively we just look up the route being returned and
if it is in either table we just handle it instead of
looking for clues from the zapi message type.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-09-27 12:38:08 -04:00
Donald Sharp
ed6cec97d7 *: Add resolve via default flag 2021-09-27 12:38:08 -04:00
Donald Sharp
4aabcba0f1 zebra: Being able to use the default route is a boolean not an int
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-09-27 12:38:08 -04:00
Donald Sharp
01236d7aa7
Merge pull request #9675 from opensourcerouting/pim-bsm-uaf
pimd: fix UAF/heap corruption in BSM code
2021-09-27 09:45:38 -04:00
David Lamparter
bd4aed8555
Merge pull request #9673 from donaldsharp/bgp_paf 2021-09-27 15:37:43 +02:00
Donatas Abraitis
94ca37e0a9 tools: Add coccinelle script to catch \n or \r at the end of zlog_*
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-09-27 15:21:52 +03:00
David Lamparter
46d7e17619
Merge pull request #9672 from donaldsharp/ospf6_newline 2021-09-27 10:45:17 +02:00
David Lamparter
200f56710a pimd: fix UAF/heap corruption in BSM code
This `XFREE()` call is in plainly in the wrong spot.  `rp_all` (the
224.0.0.0/4 entry) isn't supposed to be free'd ever, and the
conditional above makes quite clear that it remains in use.

It may be possible to exploit this as a heap corruption bug, maybe even
as RCE.  I haven't tried; I randomly noticed this while working on the
BSM code.  Luckily this code is only run by the CLI for the clear
command, so the surface is very small.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-09-27 10:37:23 +02:00
Donald Sharp
0e5cdd59eb bgpd: Don't lookup paf structure get straight to the point
The paf data structure is stored based upon an internal
bgp enum.  The code is looking over all AFI/SAFI's and
doing a paf_af_find which then calls afindex to find
the right paf structure.  Let's just loop over the
peer->peer_af_array[] and cut straight to the chase.
Under some loads the paf_af_find was taking up 6%
of the run time.  This removes it entirely.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-09-26 20:17:40 -04:00
Donald Sharp
e2874251ed ospf6d: Log messages cannot have newlines
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-09-26 19:16:10 -04:00
Christian Hopps
fe226e844a
doc: add sudo environment setup info for topotests
Signed-off-by: Christian Hopps <chopps@labn.net>
2021-09-26 19:14:49 -04:00
Quentin Young
83caa5e5c1
Merge pull request #9638 from proelbtn/fix-multipath-srv6-sid 2021-09-24 14:58:12 -04:00
Quentin Young
a3941e8126
Merge pull request #9659 from idryzhov/dev-doc-fix
doc: fix code block in grpc docs
2021-09-24 14:14:44 -04:00
Quentin Young
05c587b029
Merge pull request #9661 from ton31337/fix/bgp_frrtrace_for_lttng 2021-09-24 13:53:03 -04:00
Russ White
b8beb67ef5
Merge pull request #9585 from opensourcerouting/ospf6d-nssa-dflt-originate
ospf6d: add a knob to generate Type-7 default routes
2021-09-24 13:42:49 -04:00
Donatas Abraitis
d2e4107754
Merge pull request #9660 from pguibert6WIND/bgp_error_swap
bgpd: swap bgp error value with file descriptor value
2021-09-23 20:04:24 +03:00
Donatas Abraitis
63836a9647 bgpd: Make sure bgp_dest lock/unlock tracepoints works for LTTng as well
Tested with both UDST and LTTng, both are OK.

```
[13:57:31.346131253] (+?.?????????) home-spine1.donatas.net frr_bgp:bgp_dest_lock: { cpu_id = 1 }, { prefix = "10.0.2.0/24", count = 3 }
[13:57:31.346154756] (+0.000023503) home-spine1.donatas.net frr_bgp:bgp_dest_lock: { cpu_id = 1 }, { prefix = "192.168.0.0/24", count = 3 }
[13:57:31.346156699] (+0.000001943) home-spine1.donatas.net frr_bgp:bgp_dest_lock: { cpu_id = 1 }, { prefix = "192.168.10.0/24", count = 2 }
[13:57:31.346157570] (+0.000000871) home-spine1.donatas.net frr_bgp:bgp_dest_lock: { cpu_id = 1 }, { prefix = "192.168.100.1/32", count = 2 }
[13:57:31.346158521] (+0.000000951) home-spine1.donatas.net frr_bgp:bgp_dest_lock: { cpu_id = 1 }, { prefix = "192.168.100.2/32", count = 2 }
[13:57:31.356149109] (+0.009990588) home-spine1.donatas.net frr_bgp:bgp_dest_lock: { cpu_id = 1 }, { prefix = "10.0.2.0/24", count = 3 }
[13:57:31.356155889] (+0.000006780) home-spine1.donatas.net frr_bgp:bgp_dest_lock: { cpu_id = 1 }, { prefix = "192.168.0.0/24", count = 3 }
[13:57:31.356156840] (+0.000000951) home-spine1.donatas.net frr_bgp:bgp_dest_lock: { cpu_id = 1 }, { prefix = "192.168.10.0/24", count = 2 }
[13:57:31.356157751] (+0.000000911) home-spine1.donatas.net frr_bgp:bgp_dest_lock: { cpu_id = 1 }, { prefix = "192.168.100.1/32", count = 2 }
[13:57:31.356158683] (+0.000000932) home-spine1.donatas.net frr_bgp:bgp_dest_lock: { cpu_id = 1 }, { prefix = "192.168.100.2/32", count = 2 }
[13:57:34.508252238] (+3.152093555) home-spine1.donatas.net frr_bgp:bgp_dest_lock: { cpu_id = 2 }, { prefix = "172.16.16.1/32", count = 2 }
[13:57:34.508289549] (+0.000037311) home-spine1.donatas.net frr_bgp:bgp_dest_lock: { cpu_id = 2 }, { prefix = "172.16.16.2/32", count = 2 }
[13:57:34.508307544] (+0.000017995) home-spine1.donatas.net frr_bgp:bgp_dest_lock: { cpu_id = 2 }, { prefix = "172.16.16.3/32", count = 2 }
[13:57:34.508433878] (+0.000126334) home-spine1.donatas.net frr_bgp:bgp_dest_lock: { cpu_id = 2 }, { prefix = "10.0.2.0/24", count = 2 }
[13:57:34.508435891] (+0.000002013) home-spine1.donatas.net frr_bgp:bgp_dest_lock: { cpu_id = 2 }, { prefix = "10.0.2.0/24", count = 2 }
[13:57:34.508458182] (+0.000022291) home-spine1.donatas.net frr_bgp:bgp_dest_lock: { cpu_id = 2 }, { prefix = "192.168.0.0/24", count = 2 }
[13:57:34.508458852] (+0.000000670) home-spine1.donatas.net frr_bgp:bgp_dest_lock: { cpu_id = 2 }, { prefix = "192.168.0.0/24", count = 2 }
[13:57:34.508472821] (+0.000013969) home-spine1.donatas.net frr_bgp:bgp_dest_lock: { cpu_id = 2 }, { prefix = "192.168.10.0/24", count = 1 }
[13:57:34.508473482] (+0.000000661) home-spine1.donatas.net frr_bgp:bgp_dest_lock: { cpu_id = 2 }, { prefix = "192.168.10.0/24", count = 1 }
[13:57:34.508487041] (+0.000013559) home-spine1.donatas.net frr_bgp:bgp_dest_lock: { cpu_id = 2 }, { prefix = "192.168.100.1/32", count = 1 }
[13:57:34.508487792] (+0.000000751) home-spine1.donatas.net frr_bgp:bgp_dest_lock: { cpu_id = 2 }, { prefix = "192.168.100.1/32", count = 1 }
```

Converting bgp_dest_lock_node/bgp_dest_unlock_node to non-inlined function
because LTTng can't work properly with inlined and the compiler does not like
it.

Not sure how it would be with the performance, but let's see.

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-09-23 20:00:54 +03:00
Donatas Abraitis
d03c8a8e06 tools: Require a lower LTTng version to compile
Debian 9 has 2.9.x, only Ubuntu >= 18 has 2.10.x.

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-09-23 20:00:53 +03:00
Igor Ryzhov
d5cd3fd1e0
Merge pull request #9084 from louis-oui/fix-ospf6-router-id
ospf6d: fix LSAs remain in LSDB with an old router-id value
2021-09-23 19:03:35 +03:00
Philippe Guibert
046bb34781 bgpd: swap bgp error value with file descriptor value
the values were swapped by mistake. fix it.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2021-09-23 14:23:30 +02:00
Igor Ryzhov
98059bbca6 doc: fix code block in grpc docs
The code block after the :: is not displayed correctly without an empty
line in between.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-09-23 12:08:12 +03:00
Louis Scalbert
078f609212 ospf6d: reset areas and redistribution at router-id modification
The ospf6 router-id is provided by order of preference by:

 ospf6d itself if the "ospf6 router-id X.X.X.X" command is set.
- zebra. If the "ip router-id X.X.X.X" zebra command is set, the
  configured IP is provided as the ID or alternatively the highest
  loopback IPv4 address or else the highest interface IPv4 address.

The running ospf6 router-id is stored in ospf6->router-id.

ospf6->router-id can change in the following conditions:

- A configuration change provides a new router-id value according to
  the above rules. ospf6->router-id is updated to the new value if
  there is no adjacency in FULL state. Otherwise, the ospf6d process
  must be restarted to take the new router-id into account.
- On startup of both zebra and ospf6d, if ospf6d has not yet received a
  valid router-id, ospf6d->router-id is set to 0 (i.e. 0.0.0.0). Then,
  zebra notifies ospf6d that the router-id is available.

At ospf6->router-id, the current behavior of ospf6d is the following:

- The self generated LSAs that refer to the previous router-id as the
  advertising router are kept.
- Self generated LSAs are created with router-id value.
- LSAs from the redistribution that refer to the previous router-id are
  kept and no new redistribution LSAs are created.

As a consequence, the routers in the ospf6 areas will get incorrect
LSAs and might not be able to install prefixes of those LSAs into their
RIB.

This fix solves this issue by resetting the areas and the redistribution
when ospf6->router-id updated.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2021-09-23 10:04:36 +02:00
Sri Mohana Singamsetty
4ab65e0983
Merge pull request #9650 from mjstapp/fix_dup_lookup_netlink
zebra: stop asking for AF_BRIDGE interface info twice
2021-09-22 16:18:19 -07:00
Sri Mohana Singamsetty
eb4738eb8f
Merge pull request #9653 from pguibert6WIND/carriage_return
bgpd: add carriage return when dumping tags from all evpn rds
2021-09-22 16:17:50 -07:00
Igor Ryzhov
a8a5b21514
Merge pull request #9429 from yar-fed/vtysh-err-not-running
vtysh: Add error code if daemon is not running
2021-09-22 22:52:52 +03:00
Donald Sharp
e39ea73486
Merge pull request #9647 from opensourcerouting/ospf-gr-cmd-rename
ospfd, ospf6d: rename the "graceful-restart helper-only" command
2021-09-22 14:53:40 -04:00
Mark Stapp
13d043922a
Merge pull request #9654 from opensourcerouting/workflow-typesafe-containers
doc/workflow: prefer typesafe containers
2021-09-22 10:12:09 -04:00
David Lamparter
16c3485e74
Merge pull request #9635 from donaldsharp/ospf6_unit 2021-09-22 14:25:46 +02:00
Donald Sharp
86b2043033
Merge pull request #9646 from LabNConsulting/ziemba/skiplist-level-counters-int
lib: skiplist: clean up level counter implementation
2021-09-22 07:21:14 -04:00
Donald Sharp
2b7da4cb31
Merge pull request #9651 from proelbtn/refactor-9638
bgpd: fix mpls nexthop announce in bgp_zebra_announce
2021-09-22 07:19:31 -04:00
David Lamparter
161ed8a690 doc/workflow: prefer typesafe containers
The typesafe containers have been around for quite a while now and
haven't gone up in a blaze of flames, so let's add a "strong
recommendation" to use them for new code and refactors.

For the nhrpd custom lists I'm already working to remove them; meanwhile
the old skiplists are primarily used in RFAPI (4 users outside of that),
so those could be next.

What remains are the old `list_*` and `hash_*`, which have >300 and >100
users respectively, making them a much harder problem to tackle.  And
the new hash implementation doesn't have the same level of
debug/introspection yet (it's on my TODO.)

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-09-22 12:09:47 +02:00
Philippe Guibert
700ddfed69 bgpd: add carriage return when dumping tags from all evpn rds
following command: show bgp l2vpn evpn rd all tags
does not append rd contexts one after the other

before:
dut-vm# show bgp l2vpn evpn rd all tags
   Network          Next Hop      In tag/Out tag
Route Distinguisher: 65000:999
*> [5]:[0]:[24]:[10.40.1.0]
                    10.209.36.1     Route Distinguisher: 65000:1000
*> [5]:[0]:[24]:[10.40.1.0]
                    10.209.36.1
Displayed 2 out of 2 total prefixes

after:
dut-vm# show bgp l2vpn evpn rd all tags
   Network          Next Hop      In tag/Out tag
Route Distinguisher: 65000:999
*> [5]:[0]:[24]:[10.40.1.0]
                    10.209.36.1
Route Distinguisher: 65000:1000
*> [5]:[0]:[24]:[10.40.1.0]
                    10.209.36.1

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2021-09-22 10:01:06 +02:00
Donatas Abraitis
d24f4b7d84
Merge pull request #9645 from mjstapp/fix_show_bgp_lu
bgpd: make show bgp labeled-unicast work
2021-09-22 09:52:09 +03:00
Ryoga Saito
cd18af00c8 bgpd: fix mpls nexthop announce to zebra
currently, has_valid_label is only used to check need to print debug,
but if route has normal nexthops and mpls nexthops, label information
will be printed even for normal nexthops.

Signed-off-by: Ryoga Saito <ryoga.saito@linecorp.com>
2021-09-22 04:58:59 +00:00
G. Paul Ziemba
c324b10f28 lib: skiplist: clean up level counter implementation
Signed-off-by: G. Paul Ziemba <paulz@labn.net>
2021-09-21 17:03:53 -07:00