Commit Graph

170 Commits

Author SHA1 Message Date
Donald Sharp
4223956546
Merge pull request #7033 from mjstapp/fix_pbr_nhg_sa
pbrd: fix SA warnings in nhg map
2020-09-02 08:20:21 -04:00
Mark Stapp
9d0b324d5f pbrd: fix SA warning in nhg map
Fix SA warnings in nhg map functions.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-09-01 14:23:40 -04:00
Wesley Coakley
4bf97ce180 pbrd: nh "valid" semantics in nexthop tracking
Signed-off-by: Wesley Coakley <wcoakley@nvidia.com>
2020-09-01 12:34:48 -04:00
Wesley Coakley
c59f754dd4 pbrd: be more selective about route updates
Given a received nexthop update, only send down an update to the
relevant nexthop group. Avoid sending down superfluous updates

Signed-off-by: Wesley Coakley <wcoakley@nvidia.com>
2020-09-01 11:11:43 -04:00
Donald Sharp
734bf907cb pbrd: Convert pnhc->nexthop to it's own data
The pnhc->nexthop was a pointer copy.  Causing issues
with the ability to move pointers around for the
different pnhc since the pnhc mirrored the nexthop
caches.  When we received a vrf change if we shared
pointers it was impossible to know if we had
already updated the code.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-08-28 07:51:06 -04:00
Donald Sharp
9d961247f5 pbrd: When multiple items share the pnhc do the right thing
We had multiple pnhc cache entries with the same nexthop
pointer.  This causes some large amount of confusion.
Fixup the code to handle this situation better.

Ticket: CM-31044
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-08-28 07:51:06 -04:00
Donald Sharp
7cbdabffb6 pbrd: Allow interfaces to be deleted then added back in
PBR needs the ability to allow ephermeal interfaces( bonds,
vrfs, dummy, bridges, etc ) to be destroyed and then
recreated and at the same time keep track of them and
rebuild state as appropriate when we get a change.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-08-28 07:51:06 -04:00
Donald Sharp
a251884bff lib: Allow nexthop simple display to take an alternate ifp name
The nexthop_group_write_nexthop_simple function outputs the
interface name, because we've stored the ifindex.  The problem
is that there are ephermeal interfaces in linux that can be
destroyed/recreated.  Allow us to keep that data and do something
a bit smarter to allow show run's and other show commands to continue
to work when the interface is deleted.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-08-28 07:51:06 -04:00
Donald Sharp
fcf29c6919 pbrd: Properly hook back up when vrf is destroyed than recreated
Currently when a vrf is deleted than added back in PBR was
not going through and touching up all the data structures
that needed to be massaged to allow it to start working again.

This includes:

a) Search through the nexthop groups to find any nexthop
that references the old nexthop id and set it right again.

b) Search through the nexthop cache for nht and reset
those nexthops to the right vrf as well as re-register

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-08-28 07:51:06 -04:00
Russ White
a90f46738a
Merge pull request #6730 from wesleycoakley/pbrd-dscp-ecn
DSCP / ECN-based PBR Matching
2020-07-23 12:08:38 -04:00
Wesley Coakley
d301f15320 pbrd: expose dscp & ecn to json for show pbr map
Signed-off-by: Wesley Coakley <wcoakley@nvidia.com>
2020-07-15 12:59:36 -04:00
Wesley Coakley
116b86bdb9 pbrd: dscp interpret standard codepoints
Matching by dscp may now also be specified by its standard codepoint
(provided it has one), such as `cf0` or `af11`.

Signed-off-by: Wesley Coakley <wcoakley@nvidia.com>
2020-07-15 12:59:36 -04:00
Wesley Coakley
01f23affdb pbrd, zebra, lib: DSCP / ECN-based PBR Matching
Extend PBR maps to discriminate by Differentiated Services Code Point and / or
Explicit Congestion Notification fields. These fields are used in the IP header
for classifying network traffic.

      0     1     2     3     4     5     6     7
    +-----+-----+-----+-----+-----+-----+-----+-----+
    |          DS FIELD, DSCP           | ECN FIELD |
    +-----+-----+-----+-----+-----+-----+-----+-----+
      DSCP: differentiated services codepoint
      ECN:  Explicit Congestion Notification

Signed-off-by: Wesley Coakley <wcoakley@nvidia.com>
Signed-off-by: Saurav Kumar Paul <saurav@cumulusnetworks.com>
2020-07-15 12:59:36 -04:00
Stephen Worley
09813729c7 pbrd: nhgc state improvements when installed/removed
Cleanup the marking of a nhc as installed/removed based on table
route installation.

We were not even handling the removal state at all.

We saw some timing issues with the routes being installed/removed
multiple times and then never resending the pbr map due to bad states
on the nhgc.

Dont worry about checking if its already marked installed before
scheduling the policy walk. We have a check in `pbr_send_map()`
to ensure we dont try to resend a map sequence already installed.

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2020-07-09 11:51:23 -04:00
Stephen Worley
6db1188f0e pbrd: uninstall NHG route if not valid anymore
Withdraw route from RIB if we detect the NHG is not valid
anymore. We were seeing an issue where we would leave a route
in zebra's RIB if it was recursive despite it being removed
from the kernel due to an interface going down.

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2020-07-09 11:51:13 -04:00
Donald Sharp
0189f7226f pbrd: Be a bit more lenient with set nexthop A.B.C.D <intf>
When specifying an interface in a pbr-map `set nexthop ..` command
be a bit more lenient about the interface.

a) If the interface does not exist bail on the command
    (this is the same)
b) If the interface exists but is in a different vrf
   than specified use the vrf it is actually in.
    (this is new behavior)

Ticket: CM-30187
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-07-01 20:01:24 -04:00
Wesley Coakley
20953065ff pbrd, lib: remember to free alloc'd qobj on delete
Signed-off-by: Wesley Coakley <wcoakley@nvidia.com>
2020-07-01 13:10:53 -04:00
Mark Stapp
41b21bfa60 *: have daemons call frr_fini() at termination
Fix a number of library and daemon issues so that daemons can
call frr_fini() during normal termination. Without this,
temporary logging files are left behind in /var/tmp/frr/.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-06-11 15:31:54 -04:00
Rafael Zalamena
fb7f5aa8d6 *: integrate remaining daemons with filter
Don't crash when trying to `show running-config` because of missing
filter northbound integration.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2020-06-05 14:36:54 -03:00
Wesley Coakley
3e81618d0c pbrd, lib, doc: fix new show json key semantics
Revise new `show pbr` keys to be consistent with existing
json in other daemons

target->nexthop
id->tableId (where relevant)
isValid->valid
isInstalled->installed

Signed-off-by: Wesley Coakley <wcoakley@cumulusnetworks.com>
2020-05-27 10:28:02 -04:00
Wesley Coakley
f9368f896b pbrd, doc: pbr map json sequences -> policies
Semantics

Signed-off-by: Wesley Coakley <wcoakley@cumulusnetworks.com>
2020-05-27 10:28:02 -04:00
Wesley Coakley
dadba1a23f pbrd: show directives give arrays where appropos
The new json output for the `show pbr` directives return arrays instead
of associative arrays, which are more meaningful in this context

Signed-off-by: Wesley Coakley <wcoakley@cumulusnetworks.com>
2020-05-27 10:28:02 -04:00
Wesley Coakley
81c0078ef4 pbrd, lib: verbosity++ for json show directives
Increased the verbosity of the json keys and flattened the returned
structure by removing superfluous keys.

Signed-off-by: Wesley Coakley <wcoakley@cumulusnetworks.com>
2020-05-27 10:28:02 -04:00
Wesley Coakley
010dd8edcb pbrd, lib: opt. json for show pbr nexthop-group
Signed-off-by: Wesley Coakley <wcoakley@cumulusnetworks.com>
2020-05-27 10:28:02 -04:00
Wesley Coakley
1a8cafe19c pbrd: optional json for show pbr map
Signed-off-by: Wesley Coakley <wcoakley@cumulusnetworks.com>
2020-05-27 10:28:02 -04:00
Wesley Coakley
7a7b0c13f9 pbrd: json added to show pbr interface [json]
Signed-off-by: Wesley Coakley <wcoakley@cumulusnetworks.com>
2020-05-27 10:28:02 -04:00
David Lamparter
94cfb0692e build: make clippy Makefile rules nicer
These are easy to get subtly wrong, and doing so can cause
nondeterministic failures when racing in parallel builds.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2020-04-27 09:52:41 +02:00
David Lamparter
2768748b88 build: use VPATH for vtysh_scan
No need to put $(top_srcdir) everywhere.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2020-04-27 09:30:01 +02:00
David Lamparter
f4b8291fcb *: move CLI node names to cmd_node->name
And again for the name.  Why on earth would we centralize this, just so
people can forget to update it?

Signed-off-by: David Lamparter <equinox@diac24.net>
2020-04-16 12:53:59 +02:00
David Lamparter
243895805a *: move CLI parent data to cmd_node->parent_node
Same as before, instead of shoving this into a big central list we can
just put the parent node in cmd_node.

Signed-off-by: David Lamparter <equinox@diac24.net>
2020-04-16 12:53:00 +02:00
David Lamparter
612c2c15d8 *: remove second parameter on install_node()
There is really no reason to not put this in the cmd_node.

And while we're add it, rename from pointless ".func" to ".config_write".

[v2: fix forgotten ldpd config_write]

Signed-off-by: David Lamparter <equinox@diac24.net>
2020-04-16 12:53:00 +02:00
David Lamparter
249a771b63 *: remove cmd_node->vtysh
The only nodes that have this as 0 don't have a "->func" anyway, so the
entire thing is really just pointless.

Signed-off-by: David Lamparter <equinox@diac24.net>
2020-04-16 12:53:00 +02:00
David Lamparter
62b346eefa *: clean up cmd_node initializers
... and use named assignments everywhere (so I can change the struct.)

Signed-off-by: David Lamparter <equinox@diac24.net>
2020-04-16 12:53:00 +02:00
Stephen Worley
f732636d70 pbrd: fix wording in pbr_send_pbr_map comment
Fix some bad wording in a comment when deciding whether
to send a pbr map sequence to zebra.

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2020-04-14 11:09:54 -04:00
Stephen Worley
bce03323a8 pbrd: separate set * and no set * commands
Separate out the `set *` and `no set *` commands into
different DEFPYs to make the logic of the code easier to
read.

Further, allow non-exlpicit no commands.

So `no set nexthop`, `no set nexthop-group`, and
`no set vrf` will now work without having to specify
anymore data. Before you had to match what was already
there explicitly.

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2020-04-09 13:45:22 -04:00
Stephen Worley
f143cffac2 pbrd: implement set * and match * config replacement
Implement the ability to replace any existing `set *` or
`match` with another one or adding more config without having
to first delete the original config already there.

Before, we needed to constantly execute a `no` command for everything
to remove the rule before making changes to it. With this
patch, you can replace configs on individual sequences much
easier.

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2020-04-09 13:45:14 -04:00
Stephen Worley
10fcd2a2a6 pbrd: free nexthop_group name on no set nexthop-group
Properly free the string pointed to by `pbrms->nhgrp_name`
when we are removiing the config for a nexthop group
on a pbr map sequence.

Found via memleak:
==3152214== 4 bytes in 1 blocks are definitely lost in loss record 308 of 8,814
==3152214==    at 0x483980B: malloc (vg_replace_malloc.c:309)
==3152214==    by 0x4DC9F7E: strdup (in /usr/lib64/libc-2.30.so)
==3152214==    by 0x48E373E: qstrdup (memory.c:122)
==3152214==    by 0x408FE7: pbr_map_nexthop_group_magic (pbr_vty.c:264)
==3152214==    by 0x408E04: pbr_map_nexthop_group (pbr_vty_clippy.c:347)
==3152214==    by 0x48ACF72: cmd_execute_command_real (command.c:1073)
==3152214==    by 0x48ACB3B: cmd_execute_command (command.c:1133)
==3152214==    by 0x48AD063: cmd_execute (command.c:1288)
==3152214==    by 0x493D8EE: vty_command (vty.c:526)
==3152214==    by 0x493D397: vty_execute (vty.c:1293)
==3152214==    by 0x493C4EC: vtysh_read (vty.c:2126)
==3152214==    by 0x49319DC: thread_call (thread.c:1548)

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2020-04-09 13:37:55 -04:00
Stephen Worley
1f375577f6 pbrd: delete pbr nhg cache after rlease from hash
Actually delete the allocated pbr_nhg_cache object we just
released.

Found via memory leak:

==3078405== 136 bytes in 1 blocks are definitely lost in loss record 8,282 of 8,802
==3078405==    at 0x483BB1A: calloc (vg_replace_malloc.c:762)
==3078405==    by 0x48E35E8: qcalloc (memory.c:110)
==3078405==    by 0x40EBA7: pbr_nhgc_alloc (pbr_nht.c:194)
==3078405==    by 0x48CC0EB: hash_get (hash.c:148)
==3078405==    by 0x40F825: pbr_nht_add_individual_nexthop (pbr_nht.c:534)
==3078405==    by 0x409853: pbr_map_nexthop_magic (pbr_vty.c:400)
==3078405==    by 0x4093F1: pbr_map_nexthop (pbr_vty_clippy.c:417)
==3078405==    by 0x48ACF72: cmd_execute_command_real (command.c:1073)
==3078405==    by 0x48ACB3B: cmd_execute_command (command.c:1133)
==3078405==    by 0x48AD063: cmd_execute (command.c:1288)
==3078405==    by 0x493D8EE: vty_command (vty.c:526)
==3078405==    by 0x493D397: vty_execute (vty.c:1293)

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2020-04-09 13:37:55 -04:00
Stephen Worley
b21d304247 pbrd: add seqno to debug in pbr_send_pbr_map
Add some more debug info for the sequence number we are
sending to zebra in pbr_send_pbr_map().

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2020-04-09 13:37:55 -04:00
Stephen Worley
f3f2c78add pbrd: convert gotos in set vrf command to returns
We were doing a bunch of gotos in the set vrf configcode.
The code got complex enough that just returning is easier to read.

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2020-03-19 14:30:42 -04:00
Stephen Worley
9bf1b0f74a pbrd: properly handle duplicate set vrf XX configs
Properly handle the case where we are sent the same `set vrf`
configs for a pbr map repeatedly. If we are sent the same
config, we return successfully without doing anyting.

If the config is different and its not a [no], then return failure
as we did before since we don't support atomic replace yet.

Before, we would fail anytime even if the config sent was the same
as is already there. This would cause frr-reload to mark as a
failure when it tried to re-apply the same config.

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2020-03-19 12:32:13 -04:00
Donald Sharp
5e81f5dd1a *: Finish off the __PRETTY_FUNCTION__ to __func__
FINISH IT

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-03-06 09:23:22 -05:00
Donatas Abraitis
15569c58f8 *: Replace __PRETTY_FUNCTION__/__FUNCTION__ to __func__
Just keep the code cool.

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-03-05 20:23:23 +02:00
Donatas Abraitis
a8f58eb6a5 *: Use short version of bool expressions
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-03-04 15:04:23 +02:00
Donald Sharp
7f5818fbd6 *: change hash_backet to hash_bucket
It's been a year search and destroy.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2020-02-28 13:59:13 -05:00
Stephen Worley
b246eb8a8d pbrd: unconfigure table range
Implement the [no] version of `pbr table range`. We had the command
but were doing nothing with it.

This just calls the set_table_range API again using the defaults.

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2020-02-25 12:53:45 -05:00
David Lamparter
429576883e doc: rename man pages to frr-*
The vrrpd one conflicts with the standalone vrrpd package; also we're
installing daemons to /usr/lib/frr on some systems so they're not on
PATH.

Signed-off-by: David Lamparter <equinox@diac24.net>
2020-01-15 14:05:11 +01:00
Donald Sharp
bd054c1aa2 lib, zebra: Allow for encode/decode of nexthop weight in pass down
Add code to encode/decode the nexthop weight when we pass it down
into zebra.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-12-09 13:37:37 -05:00
Jafar Al-Gharaibeh
73373085bc
Merge pull request #5499 from sworleys/Pbr-Detail
pbrd: make the show pbr map output better
2019-12-06 18:02:08 -06:00
Jafar Al-Gharaibeh
5bc47da6b5
Merge pull request #5421 from sworleys/PBR-Del-Mark-All-Seq
pbrd: only remove interface after all seq uninstalled
2019-12-06 17:49:56 -06:00