]> git.puffer.fish Git - mirror/frr.git/log
mirror/frr.git
3 years agozebra: set SELECTED before going into dplane code 9870/head
David Lamparter [Thu, 21 Oct 2021 15:54:42 +0000 (17:54 +0200)]
zebra: set SELECTED before going into dplane code

There is a bit of an impedance mismatch in the sequence of events here.
Depending on the dplane behavior, the `ROUTE_ENTRY_SELECTED` bit will be
inconsistent for rib_process_result().

With an asynchronous dataplane:
0. rib_process() is called
1. rib_install_kernel() is called, dplane action is queued
2. rib_install_kernel() returns
3. rib_process() sets the SELECTED bit appropriately, returns
4. dplane is done, triggers rib_process_result()
5. SELECTED bit is seen in "after" state
(5a. NHT code looks at the SELECTED bit, works correctly.)

With a synchronous dataplane:
0. rib_process() is called
1. rib_install_kernel() is called, dplane action is executed
2. dplane (should) trigger rib_process_result()
3. SELECTED bit is seen in "before" state
(3a. NHT code looks at the SELECTED bit, fails.)
4. rib_install_kernel() returns
5. rib_process() sets the SELECTED bit appropriately, too late.

Essentially, poking the dataplane is a sequencing point where control is
handed over to the dplane.  Control may or may not return immediately.
Doing /anything/ after triggering the dataplane is a recipe for odd race
conditions.

(FWIW, I'm not sure rib_process_result() is called correctly in the
synchronous case, but that's a separate problem.)

Unfortunately, this change might have some unforeseen side effects.  I
haven't dug through the code to see if anything breaks.  There
/shouldn't/ be anything looking at the SELECTED bit here, but who knows.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
3 years agoMerge pull request #9843 from opensourcerouting/vtysh-startup-cost
Donald Sharp [Wed, 20 Oct 2021 22:52:00 +0000 (18:52 -0400)]
Merge pull request #9843 from opensourcerouting/vtysh-startup-cost

vtysh: improve startup time by ca. ×6

3 years agoMerge pull request #9783 from mjstapp/fix_bgp_lu_lsp
Russ White [Wed, 20 Oct 2021 22:22:01 +0000 (18:22 -0400)]
Merge pull request #9783 from mjstapp/fix_bgp_lu_lsp

bgpd, tests: BGP-labeled-unicast advertise implicit-null in more cases

3 years agoMerge pull request #9856 from donaldsharp/always_true
Igor Ryzhov [Wed, 20 Oct 2021 20:16:58 +0000 (23:16 +0300)]
Merge pull request #9856 from donaldsharp/always_true

zebra: Fix code paths that always resolve to true

3 years agoMerge pull request #9855 from donaldsharp/ospf_fini
David Lamparter [Wed, 20 Oct 2021 17:19:43 +0000 (19:19 +0200)]
Merge pull request #9855 from donaldsharp/ospf_fini

3 years agoMerge pull request #9811 from donaldsharp/rib_update_fix
Igor Ryzhov [Wed, 20 Oct 2021 16:44:45 +0000 (19:44 +0300)]
Merge pull request #9811 from donaldsharp/rib_update_fix

Various thread functional fixes

3 years agoMerge pull request #9847 from ton31337/feature/prefix-list_autocomplete
Igor Ryzhov [Wed, 20 Oct 2021 15:45:07 +0000 (18:45 +0300)]
Merge pull request #9847 from ton31337/feature/prefix-list_autocomplete

bgpd: Add autocomplete for set/match community/large/ext lists

3 years agozebra: Fix code paths that always resolve to true 9856/head
Donald Sharp [Wed, 20 Oct 2021 14:15:41 +0000 (10:15 -0400)]
zebra: Fix code paths that always resolve to true

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
3 years agozebra: modify rib_update to be a bit smarter about malloc 9811/head
Donald Sharp [Tue, 12 Oct 2021 17:23:40 +0000 (13:23 -0400)]
zebra: modify rib_update to be a bit smarter about malloc

rib_update() was mallocing memory then attempting to schedule
and if the schedule failed( it was already going to be run )
FRR would then free the memory.  Fix this memory usage pattern

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
3 years agolib: Add a thread_is_scheduled function
Donald Sharp [Tue, 12 Oct 2021 17:22:54 +0000 (13:22 -0400)]
lib: Add a thread_is_scheduled function

The function thread_is_scheduled allows us to know if
the particular thread is scheduled for execution or not.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
3 years agoMerge pull request #9766 from opensourcerouting/typesafe-member-nhrp-zap
Mark Stapp [Wed, 20 Oct 2021 12:13:17 +0000 (08:13 -0400)]
Merge pull request #9766 from opensourcerouting/typesafe-member-nhrp-zap

lib: add typesafe membership-test functions

3 years agotests: When heavily loaded do not send SIGBUS so fast 9855/head
Donald Sharp [Wed, 20 Oct 2021 12:02:10 +0000 (08:02 -0400)]
tests: When heavily loaded do not send SIGBUS so fast

Our topotests send SIGBUS 2 seconds after a SIGTERM is
initiated.  This is bad because under a heavily loaded
topotest system we may have a case where the system has
not had a chance to properly shut down the daemon.
Extend the time greatly before topotests send SIGBUS.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
3 years agopathd: Call frr_fini() before exit
Donald Sharp [Wed, 20 Oct 2021 12:00:57 +0000 (08:00 -0400)]
pathd: Call frr_fini() before exit

pathd was never calling frr_fini and as such the
proper shutdown was not happening for libfrr.
This includes logging.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
3 years agoospfd: Close log files before exiting
Donald Sharp [Wed, 20 Oct 2021 12:00:02 +0000 (08:00 -0400)]
ospfd: Close log files before exiting

When doing a normal exit from ospf we should close
the log file as that we are leaving a bunch of
unterminated logging processes by not doing so.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
3 years agobgpd: Add autocomplete for community/large/extcommunity stuff 9847/head
Donatas Abraitis [Tue, 19 Oct 2021 12:14:19 +0000 (15:14 +0300)]
bgpd: Add autocomplete for community/large/extcommunity stuff

```
exit1-debian-9(config)# route-map test1 permit 10
exit1-debian-9(config-route-map)# match community ?
  (1-99)               Community-list number (standard)
  (100-500)            Community-list number (expanded)
  COMMUNITY_LIST_NAME  Community-list name
     testas
exit1-debian-9(config-route-map)# match large-community ?
  (1-99)                Large Community-list number (standard)
  (100-500)             Large Community-list number (expanded)
  LCOMMUNITY_LIST_NAME  Large Community-list name
     LCL-ORIGINATED-ALL
exit1-debian-9(config-route-map)#
```

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
3 years agoMerge pull request #9848 from ton31337/feature/as-path_autocomplete
Russ White [Tue, 19 Oct 2021 23:18:28 +0000 (19:18 -0400)]
Merge pull request #9848 from ton31337/feature/as-path_autocomplete

bgpd: Add autocomplete for as-path filters

3 years agoMerge pull request #9839 from donaldsharp/test_ospf_summarization
Russ White [Tue, 19 Oct 2021 23:17:35 +0000 (19:17 -0400)]
Merge pull request #9839 from donaldsharp/test_ospf_summarization

Test ospf summarization

3 years agoMerge pull request #9656 from chiragshah6/mdev
Russ White [Tue, 19 Oct 2021 23:16:14 +0000 (19:16 -0400)]
Merge pull request #9656 from chiragshah6/mdev

zebra: add resolver flag for nexthop in json

3 years agoMerge pull request #9752 from opensourcerouting/ospf6d-nssa-ranges
Russ White [Tue, 19 Oct 2021 23:15:40 +0000 (19:15 -0400)]
Merge pull request #9752 from opensourcerouting/ospf6d-nssa-ranges

ospf6d: add support for NSSA Type-7 address ranges

3 years agoMerge pull request #9818 from idryzhov/lib-if-fixes
Mark Stapp [Tue, 19 Oct 2021 20:46:58 +0000 (16:46 -0400)]
Merge pull request #9818 from idryzhov/lib-if-fixes

lib: allow to create interfaces in non-existing VRFs

3 years agobgpd: Add autocomplete for filter-list 9848/head
Donatas Abraitis [Tue, 19 Oct 2021 15:02:36 +0000 (18:02 +0300)]
bgpd: Add autocomplete for filter-list

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
3 years agotools: remove Linux kernel bits from checkpatch 9766/head
David Lamparter [Tue, 12 Oct 2021 22:01:43 +0000 (00:01 +0200)]
tools: remove Linux kernel bits from checkpatch

These aren't appropriate for use in FRR.  Among other things, this
enables running checkpatch by calling it in a git working tree with
`tools/checkpatch.pl -g origin/master..`

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
3 years agotools: add iterators to checkpatch
David Lamparter [Tue, 12 Oct 2021 22:00:03 +0000 (00:00 +0200)]
tools: add iterators to checkpatch

For the purpose of allowing the space in `frr_each (`, copy the list of
iterators from .clang-format and wire it up appropriately.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
3 years agobuild: add tests missed in .gitignore
David Lamparter [Wed, 29 Sep 2021 21:37:10 +0000 (23:37 +0200)]
build: add tests missed in .gitignore

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
3 years agonhrpd: drop list.h
David Lamparter [Sat, 27 Mar 2021 21:47:28 +0000 (22:47 +0100)]
nhrpd: drop list.h

`number_of_linked_lists_in_frr--;`

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
3 years agonhrpd: convert zbuf queue to DLIST
David Lamparter [Sat, 27 Mar 2021 21:46:33 +0000 (22:46 +0100)]
nhrpd: convert zbuf queue to DLIST

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
3 years agonhrpd: convert SA list to DLIST
David Lamparter [Sat, 27 Mar 2021 21:41:44 +0000 (22:41 +0100)]
nhrpd: convert SA list to DLIST

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
3 years agonhrpd: convert reg list to DLIST
David Lamparter [Sat, 27 Mar 2021 21:37:25 +0000 (22:37 +0100)]
nhrpd: convert reg list to DLIST

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
3 years agonhrpd: convert mcast list to DLIST
David Lamparter [Wed, 29 Sep 2021 21:16:17 +0000 (23:16 +0200)]
nhrpd: convert mcast list to DLIST

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
3 years agonhrpd: convert nhs list to DLIST
David Lamparter [Sat, 27 Mar 2021 21:30:51 +0000 (22:30 +0100)]
nhrpd: convert nhs list to DLIST

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
3 years agonhrpd: convert notifier list to DLIST
David Lamparter [Sat, 27 Mar 2021 21:20:10 +0000 (22:20 +0100)]
nhrpd: convert notifier list to DLIST

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
3 years agodoc/developer: add _member and _anywhere
David Lamparter [Wed, 29 Sep 2021 20:39:59 +0000 (22:39 +0200)]
doc/developer: add _member and _anywhere

New members in the typesafe.h API club.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
3 years agolib: add unsorted typesafe_anywhere()
David Lamparter [Wed, 29 Sep 2021 17:59:27 +0000 (19:59 +0200)]
lib: add unsorted typesafe_anywhere()

*_anywhere(item) returns whether an item is on _any_ container.  Only
available for unsorted containers for now.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
3 years agolib: use sentinel for single-linked lists
David Lamparter [Wed, 29 Sep 2021 20:15:11 +0000 (22:15 +0200)]
lib: use sentinel for single-linked lists

Using a non-NULL sentinel allows distinguishing between "end of list"
and "item not on any list".  It's a compare either way, just the value
is different.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
3 years agolib: typesafe *_member()
David Lamparter [Sat, 27 Mar 2021 21:05:07 +0000 (22:05 +0100)]
lib: typesafe *_member()

This provides a "is this item on this list" check, which may or may not
be faster than using *_find() for the same purpose.  (If the container
has no faster way of doing it, it falls back to using *_find().)

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
3 years agolib: null out deleted pointers in typesafe containers
David Lamparter [Wed, 29 Sep 2021 18:45:34 +0000 (20:45 +0200)]
lib: null out deleted pointers in typesafe containers

Some of the typesafe containers didn't null out their innards of items
after an item was deleted or popped off the container.  This is both a
bit unsafe as well as hinders the upcoming _member() from working
efficiently.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
3 years agotests: fix leak in test code
David Lamparter [Wed, 29 Sep 2021 20:13:01 +0000 (22:13 +0200)]
tests: fix leak in test code

Even if it doesn't matter for an unit test in general, it hides actual
leaks in the code being tested.  Fix so any leaks will be actual bugs.
(Currently there aren't any, yay.)

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
3 years agobgpd: Add autocomplete for as-path filters
Donatas Abraitis [Tue, 19 Oct 2021 12:31:39 +0000 (15:31 +0300)]
bgpd: Add autocomplete for as-path filters

```
exit1-debian-9# show bgp as-path-access-list
  <cr>
  AS_PATH_FILTER_NAME  AS path access list name
     acl1 acl2
  json                 JavaScript Object Notation
exit1-debian-9(config)# route-map testas permit 10
exit1-debian-9(config-route-map)# match as-path ?
  AS_PATH_FILTER_NAME  AS path access-list name
     acl1 acl2
```

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
3 years agolib: allow to create interfaces in non-existing VRFs 9818/head
Igor Ryzhov [Wed, 13 Oct 2021 12:06:38 +0000 (15:06 +0300)]
lib: allow to create interfaces in non-existing VRFs

It allows FRR to read the interface config even when the necessary VRFs
are not yet created and interfaces are in "wrong" VRFs. Currently, such
config is rejected.

For VRF-lite backend, we don't care at all about the VRF of the inactive
interface. When the interface is created in the OS and becomes active,
we always use its actual VRF instead of the configured one. So there's
no need to reject the config.

For netns backend, we may have multiple interfaces with the same name in
different VRFs. So we care about the VRF of inactive interfaces. And we
must allow to preconfigure the interface in a VRF even before it is
moved to the corresponding netns. From now on, we allow to create
multiple configs for the same interface name in different VRFs and
the necessary config is applied once the OS interface is moved to the
corresponding netns.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
3 years agolib: keep element count in vector code 9843/head
David Lamparter [Mon, 18 Oct 2021 13:29:17 +0000 (15:29 +0200)]
lib: keep element count in vector code

... to speed up vector_empty_slot() among other things.

Behavior should be 100% identical to previous.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
3 years agovtysh: defer CLI tree building
David Lamparter [Mon, 18 Oct 2021 09:51:09 +0000 (11:51 +0200)]
vtysh: defer CLI tree building

We don't need the CLI tree until we actually enter the node.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
3 years agolib: assign CLI varnames while parsing
David Lamparter [Mon, 18 Oct 2021 12:30:01 +0000 (14:30 +0200)]
lib: assign CLI varnames while parsing

... rather than running a costly extra pass across the finished tree.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
3 years agoMerge pull request #9730 from AnuradhaKaruppiah/evpn-recv-lttng
Donatas Abraitis [Mon, 18 Oct 2021 07:17:19 +0000 (10:17 +0300)]
Merge pull request #9730 from AnuradhaKaruppiah/evpn-recv-lttng

bgp-evpn: lttng TPs for events received from zebra

3 years agoMerge pull request #9828 from idryzhov/if-lookup-optimize
Donatas Abraitis [Sat, 16 Oct 2021 08:17:57 +0000 (11:17 +0300)]
Merge pull request #9828 from idryzhov/if-lookup-optimize

lib: optimize if_lookup_by_name_all_vrf

3 years agotools: upstream linter is recommending double quotes 9730/head
Anuradha Karuppiah [Mon, 4 Oct 2021 17:53:50 +0000 (10:53 -0700)]
tools: upstream linter is recommending double quotes

Replaced single quotes with double quotes for strings in
the frr_babeltrace.py utility.

Signed-off-by: Anuradha Karuppiah <anuradhak@nvidia.com>
3 years agotools: add frr_babeltrace.py to /usr/lib/frr
Anuradha Karuppiah [Fri, 1 Oct 2021 16:52:24 +0000 (09:52 -0700)]
tools: add frr_babeltrace.py to /usr/lib/frr

Make the script available as a part of the FRR package install for
ease of use.

Signed-off-by: Anuradha Karuppiah <anuradhak@nvidia.com>
3 years agobgpd: lttng tracepoint for local events received from zebra
Anuradha Karuppiah [Mon, 4 Oct 2021 16:41:43 +0000 (09:41 -0700)]
bgpd: lttng tracepoint for local events received from zebra

TPs -
=====
root@ibm-2410a1-01:mgmt:~# lttng list --userspace |grep frr_bgp:evpn.*recv
      frr_bgp:evpn_local_l3vni_del_zrecv (loglevel: TRACE_INFO (6)) (type: tracepoint)
      frr_bgp:evpn_local_l3vni_add_zrecv (loglevel: TRACE_INFO (6)) (type: tracepoint)
      frr_bgp:evpn_local_macip_del_zrecv (loglevel: TRACE_INFO (6)) (type: tracepoint)
      frr_bgp:evpn_local_macip_add_zrecv (loglevel: TRACE_INFO (6)) (type: tracepoint)
      frr_bgp:evpn_local_vni_del_zrecv (loglevel: TRACE_INFO (6)) (type: tracepoint)
      frr_bgp:evpn_local_vni_add_zrecv (loglevel: TRACE_INFO (6)) (type: tracepoint)
      frr_bgp:evpn_mh_local_es_evi_del_zrecv (loglevel: TRACE_INFO (6)) (type: tracepoint)
      frr_bgp:evpn_mh_local_es_evi_add_zrecv (loglevel: TRACE_INFO (6)) (type: tracepoint)
      frr_bgp:evpn_mh_local_es_del_zrecv (loglevel: TRACE_INFO (6)) (type: tracepoint)
      frr_bgp:evpn_mh_local_es_add_zrecv (loglevel: TRACE_INFO (6)) (type: tracepoint)
root@ibm-2410a1-01:mgmt:~#

Sample output -
===============
1. ES
frr_bgp:evpn_mh_local_es_add_zrecv {'esi': '03:44:38:39:ff:ff:01:00:00:01', 'vtep': '27.0.0.15', 'active': 0, 'bypass': 0, 'df_pref': 50000}
frr_bgp:evpn_mh_local_es_del_zrecv {'esi': '03:44:38:39:ff:ff:01:00:00:01'}

2. ES-EVI
frr_bgp:evpn_mh_local_es_evi_add_zrecv {'esi': '03:44:38:39:ff:ff:01:00:00:01', 'vni': 1004}
frr_bgp:evpn_mh_local_es_evi_del_zrecv {'esi': '03:44:38:39:ff:ff:01:00:00:01', 'vni': 1001}

3. L2-VNI
frr_bgp:evpn_local_vni_add_zrecv {'vni': 1004, 'vtep': '27.0.0.15', 'mc_grp': '239.1.1.104', 'vrf': 97}

4. L3-VNI
frr_bgp:evpn_local_l3vni_add_zrecv {'vni': 4001, 'vrf': 87, 'svi_rmac': '24:8a:07:cc:aa:5f', 'vrr_rmac': '24:8a:07:cc:aa:5f', 'vtep': '27.0.0.15', 'filter': 0, 'svi_ifindex': 95, 'anycast_mac': 'n'
frr_bgp:evpn_local_l3vni_del_zrecv {'vni': 4003, 'vrf': 107}

5. MAC-IP
frr_bgp:evpn_local_macip_add_zrecv {'vni': 1003, 'mac': '00:02:00:00:00:04', 'ip': 'fe80::202:ff:fe00:4', 'flags': 4, 'seq': 0, 'esi': '03:44:38:39:ff:ff:01:00:00:02'}
frr_bgp:evpn_local_macip_del_zrecv {'vni': 1000, 'mac': '00:02:00:00:00:04', 'ip': '2001:fee1::4', 'state': 1}

Signed-off-by: Anuradha Karuppiah <anuradhak@nvidia.com>
3 years agotests: Fix ospf_asbr_summary_topo1.py 9839/head
Donald Sharp [Fri, 15 Oct 2021 15:43:44 +0000 (11:43 -0400)]
tests: Fix ospf_asbr_summary_topo1.py

This script is failing occassionally in our upstream topotests.
Where it was changing route-maps and attempting to see if
summarization was working correctly.  The problem was that
the code appeared to be attempting to add route-maps to
redistribution in ospf then modifying the route-maps behavior
to affect summarization as well as the metric type of that
summarization.

The problem is of course that ospf does not appear to modify
the summary routes metric-type when the components
of that summary change it's metric-type.  So the test
is testing nothing.  In addition the test had messed
up the usage of the route-map generation code and all
the generated config was in different sequence numbers
but route-map processing would never get to those
new sequence numbers because of how route-maps are processed.

Let's just remove this part of the test instead of trying
to unwind it into anything meaningfull

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
3 years agolib: Add `metric-type` to possible set operations
Donald Sharp [Fri, 15 Oct 2021 15:42:06 +0000 (11:42 -0400)]
lib: Add `metric-type` to possible set operations

Several tests used the route_map_create functionality
with `metric-type` but never bothered to add the
backend code to ensure it works correctly.
Add it in so it can be used.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
3 years agoMerge pull request #9813 from opensourcerouting/ospf-gr-fixes
Donald Sharp [Fri, 15 Oct 2021 13:21:40 +0000 (09:21 -0400)]
Merge pull request #9813 from opensourcerouting/ospf-gr-fixes

ospfd: more GR fixes

3 years agoMerge pull request #9836 from opensourcerouting/doc-developer-fixes
Donald Sharp [Fri, 15 Oct 2021 13:16:27 +0000 (09:16 -0400)]
Merge pull request #9836 from opensourcerouting/doc-developer-fixes

doc/developer: fix random sphinx warnings/typos/…

3 years agoMerge pull request #9826 from donaldsharp/isis_signed
Igor Ryzhov [Fri, 15 Oct 2021 09:51:04 +0000 (12:51 +0300)]
Merge pull request #9826 from donaldsharp/isis_signed

warnings that should be fixed in our compiles

3 years agoMerge pull request #9834 from idryzhov/pbr-null-deref
Donatas Abraitis [Fri, 15 Oct 2021 09:01:00 +0000 (12:01 +0300)]
Merge pull request #9834 from idryzhov/pbr-null-deref

pbrd: protect from a possible NULL dereference

3 years agoMerge pull request #9835 from idryzhov/ospf6-no-op
Donatas Abraitis [Fri, 15 Oct 2021 09:00:51 +0000 (12:00 +0300)]
Merge pull request #9835 from idryzhov/ospf6-no-op

ospf6d: remove no-op

3 years agodoc/developer: fix duplicate const prototypes 9836/head
David Lamparter [Thu, 14 Oct 2021 17:19:23 +0000 (19:19 +0200)]
doc/developer: fix duplicate const prototypes

The const ones have const in the name.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
3 years agodoc/developer: use :c:macro: where appropriate
David Lamparter [Thu, 14 Oct 2021 17:17:30 +0000 (19:17 +0200)]
doc/developer: use :c:macro: where appropriate

Sphinx tries to parse :c:function: as function prototype, which doesn't
quite work with macros.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
3 years agodoc/developer: fix warnings in topotests doc
David Lamparter [Thu, 14 Oct 2021 17:11:02 +0000 (19:11 +0200)]
doc/developer: fix warnings in topotests doc

Sphinx warns about a few nits here, just fix.  (Note :option:`-E` can't
be used without a "option:: -E" definition, it's intended as a cross
reference.)

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
3 years agodoc/developer: fix C struct references
David Lamparter [Thu, 14 Oct 2021 17:02:03 +0000 (19:02 +0200)]
doc/developer: fix C struct references

Sphinx wants `c:struct:: foo` rather than `c:type:: struct foo`.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
3 years agoospf6d: remove no-op 9835/head
Igor Ryzhov [Thu, 14 Oct 2021 16:47:02 +0000 (19:47 +0300)]
ospf6d: remove no-op

ospf6_route_create already sets route->ospf6.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
3 years agopbrd: protect from a possible NULL dereference 9834/head
Igor Ryzhov [Thu, 14 Oct 2021 16:45:43 +0000 (19:45 +0300)]
pbrd: protect from a possible NULL dereference

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
3 years agoMerge pull request #9817 from donaldsharp/link_type_ordering
Donatas Abraitis [Thu, 14 Oct 2021 13:25:02 +0000 (16:25 +0300)]
Merge pull request #9817 from donaldsharp/link_type_ordering

lib: Add missing enum values in switch statement for if_link_type_str

3 years agoMerge pull request #9825 from donaldsharp/one_sleep_twice_shy
Donatas Abraitis [Thu, 14 Oct 2021 12:31:23 +0000 (15:31 +0300)]
Merge pull request #9825 from donaldsharp/one_sleep_twice_shy

tests: BFD timing tests under system load need more leeway

3 years agoMerge pull request #9684 from opensourcerouting/printfrr-false-positive
Donald Sharp [Thu, 14 Oct 2021 11:34:20 +0000 (07:34 -0400)]
Merge pull request #9684 from opensourcerouting/printfrr-false-positive

*: `frr-format` with unmodified GCC

3 years agoMerge pull request #9759 from opensourcerouting/workflow-dev-tag
Donald Sharp [Thu, 14 Oct 2021 11:33:09 +0000 (07:33 -0400)]
Merge pull request #9759 from opensourcerouting/workflow-dev-tag

doc/developer: document dev tag on master

3 years agoMerge pull request #9822 from donaldsharp/ospf_testing
Renato Westphal [Thu, 14 Oct 2021 02:38:44 +0000 (23:38 -0300)]
Merge pull request #9822 from donaldsharp/ospf_testing

Ospf testing

3 years agoMerge pull request #9812 from donaldsharp/python_3_clippy_build
David Lamparter [Thu, 14 Oct 2021 00:40:38 +0000 (02:40 +0200)]
Merge pull request #9812 from donaldsharp/python_3_clippy_build

3 years agoMerge pull request #9751 from ewlumpkin/comment_spelling_fixes
Igor Ryzhov [Wed, 13 Oct 2021 23:05:44 +0000 (02:05 +0300)]
Merge pull request #9751 from ewlumpkin/comment_spelling_fixes

lib: fix spelling nits in more lib files' comments

3 years agoMerge pull request #9761 from mjstapp/fix_topo_debug_cli
Igor Ryzhov [Wed, 13 Oct 2021 22:48:41 +0000 (01:48 +0300)]
Merge pull request #9761 from mjstapp/fix_topo_debug_cli

tests: remove deprecated debug cli references

3 years agoMerge pull request #9796 from mjstapp/fix_topo_isis_vrf_cmds
Igor Ryzhov [Wed, 13 Oct 2021 22:44:03 +0000 (01:44 +0300)]
Merge pull request #9796 from mjstapp/fix_topo_isis_vrf_cmds

tests: in isis_topo1_vrf, only configure valid interfaces

3 years agoMerge pull request #9795 from opensourcerouting/ospf_get_name
Igor Ryzhov [Wed, 13 Oct 2021 22:42:29 +0000 (01:42 +0300)]
Merge pull request #9795 from opensourcerouting/ospf_get_name

ospfd: use ospf_get_name() wherever possible

3 years agoMerge pull request #9676 from donaldsharp/import_register
David Lamparter [Wed, 13 Oct 2021 20:28:03 +0000 (22:28 +0200)]
Merge pull request #9676 from donaldsharp/import_register

3 years agolib: optimize if_lookup_by_name_all_vrf 9828/head
Igor Ryzhov [Wed, 13 Oct 2021 20:23:41 +0000 (23:23 +0300)]
lib: optimize if_lookup_by_name_all_vrf

We already have a VRF pointer, no need to search for it again.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
3 years agoMerge pull request #9768 from ton31337/feature/catch_double_pointer_thread
Mark Stapp [Wed, 13 Oct 2021 20:19:33 +0000 (16:19 -0400)]
Merge pull request #9768 from ton31337/feature/catch_double_pointer_thread

tools: Catch double pointer of struct thread towards thread_add_*

3 years agobabeld: Prevent compiler warning about uninited value for n 9826/head
Donald Sharp [Wed, 13 Oct 2021 18:34:08 +0000 (14:34 -0400)]
babeld: Prevent compiler warning about uninited value for n

the variable n, when used must have been set via the find_route_slot
but the compiler in question is probably getting confused with the
multiple levels of indention.  Just get around the whole problem
by setting n = 0 and being done with it.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
3 years agoisisd: Convert signed to time_t for addition
Donald Sharp [Wed, 13 Oct 2021 18:32:52 +0000 (14:32 -0400)]
isisd: Convert signed to time_t for addition

Convert a signed value to a time_t before addition
so that we can compare unsigned (time_t) to unsigned.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
3 years agotests: BFD timing tests under system load need more leeway 9825/head
Donald Sharp [Wed, 13 Oct 2021 18:12:51 +0000 (14:12 -0400)]
tests: BFD timing tests under system load need more leeway

We have this pattern in this test:

    # Let's kill the interface on rt2 and see what happens with the RIB and BFD on rt1
    tgen.gears["rt2"].link_enable("eth-rt1", enabled=False)

    # By default BFD provides a recovery time of 900ms plus jitter, so let's wait
    # initial 2 seconds to let the CI not suffer.
    topotest.sleep(2, 'Wait for BFD down notification')

    router_compare_json_output(
        "rt1", "show ip route ospf json", "step3/show_ip_route_rt2_down.ref", 1, 0
    )

Under a heavy CI load, interface down events and then reacting to them may not actually
happen within 2 seconds.  Allow some more grace time in the test to ensure that we
react to it in an appropriate manner.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
3 years agoMerge pull request #9819 from donaldsharp/deprecation_python
Russ White [Wed, 13 Oct 2021 17:55:06 +0000 (13:55 -0400)]
Merge pull request #9819 from donaldsharp/deprecation_python

tests: Fix `Invalid escape sequence` warnings in test runs

3 years agotests: Convert over to using converged to test for ospf being converged 9822/head
Donald Sharp [Wed, 13 Oct 2021 16:46:22 +0000 (12:46 -0400)]
tests: Convert over to using converged to test for ospf being converged

OSPF when it is deciding on whom it should elect for DR and backup
has a process that prioritizes network stabilty over the exact
same results of who is the DR / Backups.

Essentially if we have r1 ----- r2

Let's say r1 has a higher priority, but r2 comes up first, starts
sending hello packets and then decides that it is the DR.  At some
point in time in the future, r1 comes up and then connects to r2
at that point it sees that r2 has elected itself DR and it keeps
it that way.

This is by design of the system.  With our tight ospf timers as
well as high load being experienced on our test systems.  There
exists a bunch of ospf tests that we cannot guarantee that a
consistent DR will be elected for the test.  As such let's not
even pretend that we care a bunch and just look for `Full`.
If we care about `ordering` we need to spend more time getting
the tests to actually start routers, ensure that htey are up and
running in the right order so that priority can take place.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
3 years agoospfd: Add `converged` and `role` json output for neighbor command
Donald Sharp [Wed, 13 Oct 2021 16:40:35 +0000 (12:40 -0400)]
ospfd: Add `converged` and `role` json output for neighbor command

The `show ip ospf neighbor json` command was displaying
state:`Full\/DR`

Where state was both the role and whether or not the neigbhor
was converged.  While from a OSPF perspective this is the state.
This state is a combination of two things.

This creates a problem in testing because we have no guarantee
that a particular ospf router will actually have a particular role
given how loaded our topotest systems are.  So add a bit of json
output to display both the converged status as well as the
role this router is playing on this neighbor/interface.

The above becomes:
state:`Full\/DR`
converged:`Full`
role:`DR`

Tests can now be modified to look for `Full` and allow it to
continue.  Most of the tests do not actually care if this
router is the DR or Backup.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
3 years agoMerge pull request #9806 from jonglezb/master
Donald Sharp [Wed, 13 Oct 2021 14:16:45 +0000 (10:16 -0400)]
Merge pull request #9806 from jonglezb/master

doc: Add missing static route options and clarify usage

3 years agotests: Fix `Invalid escape sequence` warnings in test runs 9819/head
Donald Sharp [Wed, 13 Oct 2021 13:03:27 +0000 (09:03 -0400)]
tests: Fix `Invalid escape sequence` warnings in test runs

Test runs are creating these warnings:
bgp_l3vpn_to_bgp_vrf/test_bgp_l3vpn_to_bgp_vrf.py::test_check_linux_mpls
  <string>:7: DeprecationWarning: invalid escape sequence \d

bgp_l3vpn_to_bgp_vrf/test_bgp_l3vpn_to_bgp_vrf.py::test_check_linux_mpls
  <string>:19: DeprecationWarning: invalid escape sequence \d

bgp_l3vpn_to_bgp_vrf/test_bgp_l3vpn_to_bgp_vrf.py::test_check_scale_up
  <string>:24: DeprecationWarning: invalid escape sequence \d

bgp_l3vpn_to_bgp_vrf/test_bgp_l3vpn_to_bgp_vrf.py::test_check_scale_up
  <string>:191: DeprecationWarning: invalid escape sequence \d

-- Docs: https://docs.pytest.org/en/stable/warnings.html

Find and destroy these warnings

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
3 years agolib: Add missing enum values in switch statement for if_link_type_str 9817/head
Donald Sharp [Wed, 13 Oct 2021 11:58:37 +0000 (07:58 -0400)]
lib: Add missing enum values in switch statement for if_link_type_str

The switch statement over `enum zebra_link_type` had a default
and FRR was missing a few of the pre-defined types we cared about.
Remove the default statement and add the missing values.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
3 years agoMerge pull request #9715 from idryzhov/cleanup-number-named-acl
Donatas Abraitis [Wed, 13 Oct 2021 07:00:43 +0000 (10:00 +0300)]
Merge pull request #9715 from idryzhov/cleanup-number-named-acl

*: cleanup number-named access-lists in CLI

3 years agoospfd: fix another DR election issue during graceful restart 9813/head
Renato Westphal [Tue, 12 Oct 2021 19:08:23 +0000 (16:08 -0300)]
ospfd: fix another DR election issue during graceful restart

Commit 3551ee9e90304 introduced a regression that causes GR to fail
under certain circumstances. In short, while ISM events should
be ignored while acting as a helper for a restarting router, the
DR/BDR fields of the neighbor structure should still be updated
while processing a Hello packet. If that isn't done, it can cause
the helper to elect the wrong DR while exiting from the helper mode,
leading to a situation where there are two DRs for the same network
segment (and a failed GR by consequence). Fix this.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
3 years agoospfd: introduce additional opaque capability check in the GR code
Renato Westphal [Sat, 9 Oct 2021 23:02:16 +0000 (20:02 -0300)]
ospfd: introduce additional opaque capability check in the GR code

Before starting the graceful restart procedures, ospf_gr_prepare()
verifies for each configured OSPF instance whether it has the opaque
capability enabled (a pre-requisite for GR). If not, a warning is
emitted and GR isn't performed on that instance.

This PR introduces an additional opaque capability check that will
return a CLI error when the opaque capability isn't enabled. The
idea is to make it easier for the user to identify when the GR
activation has failed, instead of requiring him or her to check
the logs for errors.

The original opaque capability check from ospf_gr_prepare() was
retaining as it's possible that that function might be called from
other contexts in the future.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
3 years agoospf6d: fix LSA name in debug message
Renato Westphal [Sat, 9 Oct 2021 21:59:58 +0000 (18:59 -0300)]
ospf6d: fix LSA name in debug message

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
3 years agoospfd: fix flushing of Grace-LSAs on broadcast interfaces
Renato Westphal [Fri, 8 Oct 2021 12:05:28 +0000 (09:05 -0300)]
ospfd: fix flushing of Grace-LSAs on broadcast interfaces

The ospfd opaque LSA infrastruture has an issue where it can't store
different versions of the same Type-9 LSA for different interfaces.

When flushing the self-originated Grace-LSAs upon exiting from the GR
mode, the code was looking up the single self-originated Grace-LSA
from the LSDB, setting its age to MaxAge and sending it out on all
interfaces.

The problem is that Grace-LSAs sent on broadcast interfaces have
their own unique "IP interface address" TLV that is used to identify
the restarting router. That way, just reusing the same Grace-LSA for
all interfaces doesn't work.

Fix this by generating a new Grace-LSA with its age manually set
to MaxAge whenever one needs to be flushed. This will allow the "IP
interface address" TLV to be set correctly and make GR work even in
the presence of multiple broadcast interfaces.

In the long term, the opaque LSA infrastructure should be updated
to support Type-9 link-local LSAs correctly so that we don't need to
resort to hacks like this.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
3 years ago*: If building clippy we must have python3 9812/head
Donald Sharp [Tue, 12 Oct 2021 19:41:07 +0000 (15:41 -0400)]
*: If building clippy we must have python3

When building clippy we must have python 3.  Let's
ensure that we test for it and stop the auto-make
if it is not installed on the system.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
3 years agoMerge pull request #9655 from yyuanam/first_commit
Jafar Al-Gharaibeh [Tue, 12 Oct 2021 16:15:39 +0000 (11:15 -0500)]
Merge pull request #9655 from yyuanam/first_commit

Zebra: Ignore the failure of startup intf lookup.

3 years agoMerge pull request #9686 from idryzhov/fix-nda-lladdr
Donald Sharp [Tue, 12 Oct 2021 16:04:00 +0000 (12:04 -0400)]
Merge pull request #9686 from idryzhov/fix-nda-lladdr

zebra: fix buffer overflow

3 years agoMerge pull request #9763 from ton31337/fix/more_thread_null
Russ White [Tue, 12 Oct 2021 15:49:46 +0000 (11:49 -0400)]
Merge pull request #9763 from ton31337/fix/more_thread_null

More struct thread null

3 years agodoc: Add missing static route options and clarify usage 9806/head
Baptiste Jonglez [Tue, 12 Oct 2021 15:20:08 +0000 (17:20 +0200)]
doc: Add missing static route options and clarify usage

* Add missing "blackhole" and "reject" options
* Add missing GATEWAY + IFNAME usage
* Add missing "onlink" option
* Explicit all possible usage patterns of static routes
* Clarify description of each option

Signed-off-by: Baptiste Jonglez <baptiste.jonglez@inria.fr>
3 years agoMerge pull request #9779 from donaldsharp/gr_repeated
Russ White [Tue, 12 Oct 2021 15:00:44 +0000 (11:00 -0400)]
Merge pull request #9779 from donaldsharp/gr_repeated

Some GR fixes

3 years agoMerge pull request #9781 from opensourcerouting/ospfd-gr-dr-fix
Russ White [Tue, 12 Oct 2021 14:58:39 +0000 (10:58 -0400)]
Merge pull request #9781 from opensourcerouting/ospfd-gr-dr-fix

ospfd: preserve DR status across graceful restarts

3 years agotests: in isis_topo1_vrf, only configure valid interfaces 9796/head
Mark Stapp [Mon, 11 Oct 2021 15:57:30 +0000 (11:57 -0400)]
tests: in isis_topo1_vrf, only configure valid interfaces

Fix a loop in the setup phase of isis_topo1_vrf: only configure
interfaces that each router actually has.

Signed-off-by: Mark Stapp <mstapp@nvidia.com>
3 years agoMerge pull request #9788 from idryzhov/ospf6-clear-interface-vrf
Renato Westphal [Mon, 11 Oct 2021 15:19:09 +0000 (12:19 -0300)]
Merge pull request #9788 from idryzhov/ospf6-clear-interface-vrf

ospf6d: add missing vrf parameter to "clear ipv6 ospf6 interface"

3 years agoMerge pull request #9789 from idryzhov/if-ll-type
Mark Stapp [Mon, 11 Oct 2021 12:57:26 +0000 (08:57 -0400)]
Merge pull request #9789 from idryzhov/if-ll-type

lib: set type for newly created interfaces

3 years agoMerge pull request #9780 from idryzhov/bgp-local-pointer
Donatas Abraitis [Mon, 11 Oct 2021 09:13:09 +0000 (12:13 +0300)]
Merge pull request #9780 from idryzhov/bgp-local-pointer

bgpd: don't return pointer to a local variable

3 years agoospfd: use ospf_get_name() wherever possible 9795/head
Renato Westphal [Sat, 9 Oct 2021 23:36:47 +0000 (20:36 -0300)]
ospfd: use ospf_get_name() wherever possible

Small cleanup to reduce code duplication.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
3 years agoospf6d: add missing vrf parameter to "clear ipv6 ospf6 interface" 9788/head
Igor Ryzhov [Fri, 8 Oct 2021 18:36:14 +0000 (21:36 +0300)]
ospf6d: add missing vrf parameter to "clear ipv6 ospf6 interface"

Currently, it's not possible to run this command in any VRF other than default.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>