Commit Graph

18714 Commits

Author SHA1 Message Date
Stephen Worley
eb5d458b3f lib: Add zapi_rule_notify_owner2str() function
Add a function for converting the zapi_rule_notify_owner enum
type to a string for ease of use.

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2019-12-03 16:14:34 -05:00
Stephen Worley
47f94d175a pbrd: Add newlines in set nexthop* vty output
We were missing some newlines in handling vty outputs
for the `set nexthop*` commands. Add them in there.

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2019-12-03 15:56:00 -05:00
Stephen Worley
6c4c9a6cc7 pbrd: use dst string in match dst-ip vty description
The vty description for the `set match dst-ip` command was
using "src ip" in its description. Change it to use "dst ip".

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2019-12-03 15:56:00 -05:00
Stephen Worley
46b0382056 pbrd: don't silently fail on atomic match MARK change attempts
Also don't silently fail when we attempt to atomically change
a match MARK to a new one.

We would overwrite the frist one but never actually install it.

Change it to explicitly fail if a config is already present for
now.

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2019-12-03 15:56:00 -05:00
Stephen Worley
0dcff6f463 pbrd: don't silently fail on atomic match IP change attempts
Currently pbrd does not support the abilitity to make atomic
changes to a config.

ex)
`match src-ip 1.1.1.1/32`
`match src-ip 1.1.1.0/24`

We would overwrite the first one but never actually install it.

In the `set nexthop commands` we explicitly fail if there is
already a `set nexthop` config present. This patch extends the
match src/dest-ip configs to do the same.

In the future we should make all these commands atomic but for
now its better to not fail silently at the very least.

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2019-12-03 15:56:00 -05:00
Stephen Worley
fde8af8d0b pbrd: don't set rule removed on fail
Don't treat a remove failure as a successful remove.

This can cause us to get out of sync with the kernel.
Pbrd makes decisions on rule handling based on its installed
state so this needs to be as close to accurate as possible.

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2019-12-03 15:56:00 -05:00
Juergen Werner
c3a61f3803 alpine: fix build on current 'edge' version of Alpine
The python2 packet py-sphinx was removed from the edge repository, so we
use pip to install it localy for the package build process.

Also abuild assumes it is executed in a git folder and fails if no .git
is found in the folder or its parent folders, so we work around this, by
initializing an empty git repo with `git init`.

Signed-off-by: Juergen Werner <juergen@opensourcerouting.org>
2019-12-03 21:36:30 +01:00
Quentin Young
3dbedfbda7 lib: fix heap buf overflow when adding prefix orf
Don't lose your way

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-12-03 13:12:25 -05:00
Russ White
e25ca4514f
Merge pull request #5442 from opensourcerouting/mpls-label-stacks
zebra: support LSPs with multiple outgoing labels
2019-12-03 11:25:53 -05:00
David Lamparter
410e167972
bgpd: Autocomplete neighbor for clear bgp (#5434)
bgpd: Autocomplete neighbor for clear bgp
2019-12-03 17:13:21 +01:00
Don Slice
d7fc0e677e zebra: send RA lifetime of 0 before ceasing to advertise RAs
Problem reported by testing agency that RFC4861 section 6.2.5
states that a router should send an RA with a lifetime of 0
before ceasing to send RAs on the interface, or when the interace
is shutdown, or the router is shutdown.  This fix adds that capability.

Ticket: CM-27061
Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
2019-12-03 15:46:34 +00:00
Donatas Abraitis
d79368d3a5
Merge pull request #5192 from donaldsharp/zebra_rejection
zebra: Dissallow a /32 or /128 through itself
2019-12-03 09:29:50 +02:00
Sri Mohana Singamsetty
da579bf9ff
Merge pull request #5432 from chiragshah6/evpn_dev2
bgpd: Handle possible non-selection of local route
2019-12-02 17:17:26 -08:00
Sri Mohana Singamsetty
96fda36733
Merge pull request #5450 from donaldsharp/rpki_node_issues
bgpd: Prevent crash in bgp_table_range_lookup
2019-12-02 17:15:35 -08:00
Stephen Worley
74a0ae1239 pbrd: only remove interface after all seq uninstalled
Only remove the interface from the pbr_map after we get
a callback from zapi that every sequence using that interface
has been removed.

Before, if we created a map with multiple sequences and put that on an interface,
then removed it from that interface, it would fail to mark the sequences after
the first one as uninstalled.

This was because we failed to lookup the other ones after we removed
the interface from the pbr_map.

This patch adds a conditional to only delete the interface from the pbr
map if all its sequneces using that interface have been uninstalled.

This patch extends the work done in 38e9ccde2f

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2019-12-02 17:22:29 -05:00
Donald Sharp
7a4429d1f1
Merge pull request #5444 from opensourcerouting/show-candidate-fix
lib: fix display of candidate configurations
2019-12-02 11:26:33 -05:00
Donald Sharp
8abe686a3e
Merge pull request #5389 from opensourcerouting/constify
*: constify ALL the things
2019-12-02 11:26:11 -05:00
Donald Sharp
5911f65c7b bgpd: Prevent crash in bgp_table_range_lookup
The function bgp_table_range_lookup attempts to walk down
the table node data structures to find a list of matching
nodes.  We need to guard against the current node from
not matching and not having anything in the child nodes.
Add a bit of code to guard against this.

Traceback that lead me down this path:

Nov 24 12:22:38 frr bgpd[20257]: Received signal 11 at 1574616158 (si_addr 0x2, PC 0x46cdc3); aborting...
Nov 24 12:22:38 frr bgpd[20257]: Backtrace for 11 stack frames:
Nov 24 12:22:38 frr bgpd[20257]: /lib64/libfrr.so.0(zlog_backtrace_sigsafe+0x67) [0x7fd1ad445957]
Nov 24 12:22:38 frr bgpd[20257]: /lib64/libfrr.so.0(zlog_signal+0x113) [0x7fd1ad445db3]1ad445957]
Nov 24 12:22:38 frr bgpd[20257]: /lib64/libfrr.so.0(+0x70e65) [0x7fd1ad465e65]ad445db3]1ad445957]
Nov 24 12:22:38 frr bgpd[20257]: /lib64/libpthread.so.0(+0xf5f0) [0x7fd1abd605f0]45db3]1ad445957]
Nov 24 12:22:38 frr bgpd[20257]: /usr/lib/frr/bgpd(bgp_table_range_lookup+0x63) [0x46cdc3]445957]
Nov 24 12:22:38 frr bgpd[20257]: /usr/lib64/frr/modules/bgpd_rpki.so(+0x4f0d) [0x7fd1a934ff0d]57]
Nov 24 12:22:38 frr bgpd[20257]: /lib64/libfrr.so.0(thread_call+0x60) [0x7fd1ad4736e0]934ff0d]57]
Nov 24 12:22:38 frr bgpd[20257]: /lib64/libfrr.so.0(frr_run+0x128) [0x7fd1ad443ab8]e0]934ff0d]57]
Nov 24 12:22:38 frr bgpd[20257]: /usr/lib/frr/bgpd(main+0x2e3) [0x41c043]1ad443ab8]e0]934ff0d]57]
Nov 24 12:22:38 frr bgpd[20257]: /lib64/libc.so.6(__libc_start_main+0xf5) [0x7fd1ab9a5505]f0d]57]
Nov 24 12:22:38 frr bgpd[20257]: /usr/lib/frr/bgpd() [0x41d9bb]main+0xf5) [0x7fd1ab9a5505]f0d]57]
Nov 24 12:22:38 frr bgpd[20257]: in thread bgpd_sync_callback scheduled from bgpd/bgp_rpki.c:351#012; aborting...
Nov 24 12:22:38 frr watchfrr[6779]: [EC 268435457] bgpd state -> down : read returned EOF
Nov 24 12:22:38 frr zebra[5952]: [EC 4043309116] Client 'bgp' encountered an error and is shutting down.
Nov 24 12:22:38 frr zebra[5952]: zebra/zebra_ptm.c:1345 failed to find process pid registration
Nov 24 12:22:38 frr zebra[5952]: client 15 disconnected. 0 bgp routes removed from the rib

I am not really 100% sure what we are really trying to do with this function, but we must
guard against child nodes not having any data.

Fixes: #5440
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-12-02 09:37:47 -05:00
David Lamparter
2b64873d24 *: generously apply const
const const const your boat, merrily down the stream...

Signed-off-by: David Lamparter <equinox@diac24.net>
2019-12-02 15:01:29 +01:00
Jafar Al-Gharaibeh
bb2d775cca
Merge pull request #5446 from donaldsharp/bgp_json_mem_leak
bgpd: Fix memory leak in json output of show commands
2019-12-01 12:39:14 -07:00
rbauduin
a690202f5e doc: mention allow-outbound-policy for route reflectors
Signed-off-by: Raphael Bauduin <rb@raphinou.com>
2019-12-01 19:43:26 +01:00
Donald Sharp
1f83ed0264 bgpd: Fix memory leak in json output of show commands
When dumping a large bit of table data via bgp_show_table
and if there is no information to display for a particular
`struct bgp_node *` the data allocated via json_object_new_array()
is leaked.  Not a big deal on small tables but if you have a full
bgp feed and issue a show command that does not match any of
the route nodes ( say `vtysh -c "show bgp ipv4 large-community-list FOO"`)
then we will leak memory.

Before code change and issuing the above show bgp large-community-list command 15-20 times:
Memory statistics for bgpd:
System allocator statistics:
  Total heap allocated:  > 2GB
  Holding block headers: 0 bytes
  Used small blocks:     0 bytes
  Used ordinary blocks:  > 2GB
  Free small blocks:     31 MiB
  Free ordinary blocks:  616 KiB
  Ordinary blocks:       0
  Small blocks:          0
  Holding blocks:        0

After:

Memory statistics for bgpd:
System allocator statistics:
  Total heap allocated:  924 MiB
  Holding block headers: 0 bytes
  Used small blocks:     0 bytes
  Used ordinary blocks:  558 MiB
  Free small blocks:     26 MiB
  Free ordinary blocks:  340 MiB
  Ordinary blocks:       0
  Small blocks:          0
  Holding blocks:        0

Please note the 340mb of free ordinary blocks is from the fact I issued a
`show bgp ipv4 uni json` command and generated a large amount of data.

Fixes: #5445
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-12-01 09:29:32 -05:00
Renato Westphal
083be18cb8 lib: fix display of candidate configurations
Commit 5e6a9350c1 implemented an optimization where candidate
configurations are validated only before being displayed. The
validation is done only to create default child nodes (due to
how libyang works) and any possible error is ignored (candidate
configurations can be invalid/incomplete).

The problem is that we were calling lyd_validate() only when the
CLI "with-defaults" option was used. But some cli_show() callbacks
assume that default nodes exist and can crash when displaying a
candidate configuration that isn't validated. To fix this, call
lyd_validate() before displaying candidate configuration even when
"with-defaults" is not used (that was a micro-optimization that
shouldn't have been done).

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2019-11-29 21:30:01 -03:00
David Lamparter
0d8c7a26a1 *: make frr_yang_module_info const
Signed-off-by: David Lamparter <equinox@diac24.net>
2019-11-30 00:38:32 +01:00
David Lamparter
364deb0487 *: make all route_map_rule_cmd const
Signed-off-by: David Lamparter <equinox@diac24.net>
2019-11-30 00:38:32 +01:00
David Lamparter
154e9ca142 lib: make cmd_element & qobj_type const
Signed-off-by: David Lamparter <equinox@diac24.net>
2019-11-30 00:38:32 +01:00
David Lamparter
fa751d15a0 lib: gcc 4.x workaround v2 for frr_interface_info
The previous workaround only works for -O0, at higher optimization
levels gcc reorders the statements in the file global scope which breaks
the asm statement :(.

Fixes: #4563
Fixes: #5074
Signed-off-by: David Lamparter <equinox@diac24.net>
2019-11-30 00:38:32 +01:00
Renato Westphal
5065db0aa6 zebra: support LSPs with multiple outgoing labels
For SR-TE we'll need to create Binding-SIDs which are essentially
LSPs that can push multiple outgoing labels. This commit sets the
groundwork for that. Luckily the netlink code didn't need to be
changed since it already supports pushing label stacks.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2019-11-29 11:50:07 -03:00
Donatas Abraitis
453c92f6e2 bgpd: Autocomplete neighbor for clear bgp
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2019-11-27 21:44:46 +02:00
David Lamparter
6fc3fed23c
Merge pull request #5409 from qlyoung/bgpd-lcom-ecom-parse-fixes
bgp large & extended community parse fixes
2019-11-27 18:35:03 +01:00
Quentin Young
6f84d25da4
Merge pull request #5435 from opensourcerouting/gcc4-vla-size
lib: add gcc 4.x workaround for frr_interface_info
2019-11-27 11:25:43 -05:00
Russ White
6b88cae109
Merge pull request #5437 from ton31337/fix/replace_magic_number_to_readable
bgpd: Replace magic number 1 for TTL to BGP_DEFAULT_TTL
2019-11-27 07:18:21 -05:00
Donatas Abraitis
bdd2a9315e
Merge pull request #5356 from v00lk/master
bgpd: IPv4 LU withdraw using 0x000000 label
2019-11-27 10:54:25 +02:00
Donatas Abraitis
c8d6f0d6c4 bgpd: Replace magic number 1 for TTL to BGP_DEFAULT_TTL
For readability and maintainability purposes.

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2019-11-27 10:48:17 +02:00
Donatas Abraitis
3e1cc63a5f
Merge pull request #5419 from adharkar/frr-master-nh_connected
bgpd: Do not perform "connected" check for EVPN nexthop
2019-11-27 10:37:11 +02:00
Philippe Guibert
0c16a06869
Merge pull request #5284 from sworleys/PBR-Add-NH-Table-2
pbrd: Add `set vrf NAME` and `set vrf unchanged`
2019-11-26 21:18:49 +01:00
Quentin Young
b6a171c7c0 bgpd: clean up attribute parsing state before ret
Early exits without appropriate cleanup were causing obscure double
frees and other issues later on in the attribute parsing code. If we
return anything except a hard attribute parse error, we have cleanup and
refcounts to manage.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-11-26 14:48:11 -05:00
Quentin Young
547357c4a5 bgpd: ensure transit ptr is nulled on free
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-11-26 14:48:02 -05:00
Toshiki Tsuchiya
46661cdc15 docker: Make docker image on CentOS 7
- Build rpm package from source on CentOS 7
- Use multi-stage builds to reduce docker image size

Signed-off-by: Toshiki Tsuchiya <taruta0811@gmail.com>
2019-11-26 19:29:30 +00:00
Donatas Abraitis
4378f57c3e bgpd: Allow deleting by no bgp large-community-list standard WORD
Without with fix we can't delete large-community-list using
no bgp large-community-list standard WORD, but no bgp large-community-list WORD

Let's keep this identical what we have with expanded lists as well.

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2019-11-26 21:20:05 +02:00
Donatas Abraitis
2f8cc0e565 bgpd: Use sequence numbers for community lists
This patch allows using sequence numbers for community lists. We already have
this for prefix-lists and access-lists.

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2019-11-26 21:20:02 +02:00
Philippe Guibert
dd90b4c86a
Merge pull request #4977 from chiragshah6/evpn_dev1
* evpn primary address advertisement
2019-11-26 17:56:59 +01:00
Russ White
a1ff097b5c
Merge pull request #5415 from dslicenc/ipv6-ra-fast-retrans
zebra: knob to make ra retransmit interval rfc compliant
2019-11-26 11:37:20 -05:00
David Lamparter
50db10a162 lib: add gcc 4.x workaround for frr_interface_info
gcc 4.x does not properly support structs with variable length array
members.  Specifically, for global variables, it completely ignores the
array, coming up with a size much smaller than what is correct.  This is
broken for both sizeof() as well as ELF object size.

This breaks for frr_interface_info since this variable is in some cases
copy relocated by the linker.  (The linker does this to make the address
of the variable a "constant" for the main program.)  This copying uses
the ELF object size, thereby copying only the non-array part of the
struct.

Breakage ensues...

(This fix is a bit ugly, but it's limited to very old gcc, and it's
better than changing the array to "nodes[1000]" and wasting memory...)

Fixes: #4563
Fixes: #5074
Signed-off-by: David Lamparter <equinox@diac24.net>
2019-11-26 17:14:03 +01:00
Russ White
2f7b0479e9
Merge pull request #5408 from donaldsharp/scan7
Scan7
2019-11-26 09:48:20 -05:00
Donatas Abraitis
d656cf7fd1
Merge pull request #5407 from lkrishnamoor/evpn_vni_json
zebra: "show evpn vni details json" prints incorrect JSON format
2019-11-26 08:49:54 +02:00
Chirag Shah
7ab604ab79 bgpd: Handle possible non-selection of local route
In rare situations, the local route in a VNI may not get selected as the
best route. One situation is during a race between bgp and zebra which
was addressed in a prior commit. This change addresses another situation
where due to a change of tunnel IP, it is possible that a received route
may be selected as the best route if the path selection needs to take
next hop IPs into consideration. This is a pretty convoluted scenario,
but the code should handle it and delete and withdraw the local route
as well as (re)install the received route.

Ticket: CM-24114
Reviewed By: CCR-9487
Testing Done:
1. Manual tests - note, problem is not readily reproducible
2. evpn-smoke - results documented in the ticket

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2019-11-25 21:41:14 -08:00
Donatas Abraitis
ee6e8c1cb0
Merge pull request #5420 from donaldsharp/zebra_client_summ_spacing
Zebra client summ spacing
2019-11-25 14:49:05 +02:00
Donatas Abraitis
4eeeaee80c
Merge pull request #5423 from qlyoung/fix-bgp-addpath-bad-boundscheck
bgpd: fix bad bounds check for addpath in nlri
2019-11-25 14:46:35 +02:00
Quentin Young
761ed66524 bgpd: fix bad bounds check for addpath in nlri
If a peer advertised capability addpath in their OPEN, but sent us an
UPDATE without an ADDPATH, we overflow a heap buffer.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-11-24 02:48:11 -05:00