Commit Graph

2092 Commits

Author SHA1 Message Date
Don Slice
fc132690b4 zebra: remove default vrf output for kernel vrf ipv6 blackhole default
It was reported that "show ipv6 route vrf <vrfname>", "show ipv6 route
vrf <vrfname> ::/0 " or "show ipv6 route vrf <vrfname> json" all
displayed that the nexthop was in the default vrf.  This was because
the kernel netlink messages would supply the RTA_OIF of the loopback
interface for the kernel-created default route for the vrf, where ipv4
did not supply any RTA_OIF.  This fix suppresses the display if the
nexthop and route entry are in different vrfs and the nexthop is
NEXTHOP_TYPE_BLACKHOLE.

Ticket: CM-21722
Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
2018-07-17 14:35:33 +00:00
Donald Sharp
8c85e8ea92 zebra: Remove need for ACK for netlink messages
Kernel requests via netlink are synchronous.

Therefore we do not need to specify a need for a ACK and
we can make the netlink_cmd NONBLOCKING

1) If the netlink message is going to cause an error
we will still get one.  Since results from the kernel
are synchronous we will get the error message on the
netlink_cmd socket and handle it

2) If the netlink message is going to send more than
one packet we will still get them all.  Since the results
from the kernel are synchronous we will receive all data.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-07-12 22:43:06 -04:00
Donald Sharp
19d5a4fead zebra: Listen to error codes from netlink_socket
When creating a netlink_socket, listen to error
codes and abandon ship if it crashes and burns.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-07-12 22:43:06 -04:00
Donald Sharp
51034b787f
Merge pull request #2595 from pguibert6WIND/fix_netlink_rx_route_vrfnetns
zebra: upon RTM_NEWROUTE/DELROUTE, find appropriate interface
2018-07-12 22:22:34 -04:00
Stephen Worley
24f8f9791e zebra: Fix function call in fuzzing code
The fuzzing code was calling zebra_client_create which was refactored to zserv_client_create.

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2018-07-12 12:39:13 -04:00
Mark Stapp
86391e5659 zebra, libs: use const prefix ptrs in apis
Add 'const' to prefix args to several zebra route update,
redistribution, and route owner notification apis.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2018-07-11 09:22:49 -04:00
Philippe Guibert
86f07f44c1 zebra: mpls entry interface lookup adaptation for vrf backend
The search algorithm for interface based on ifindex only is adapted to
vrf netns based too. Only the default netns will be used to search the
interface index.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-07-10 17:32:36 +02:00
Philippe Guibert
06432d4e4f zebra: pbr rule lookup index adaptation for vrf netns
the interface lookup based on ifindex in the case the target vrf is
unknown is using the generic vrf api. Like that, in the case of vrf
based netns, the search across different netns other than the default
one are not searched.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-07-10 17:32:23 +02:00
Philippe Guibert
fac4d51eea zebra: upon RTM_NEWROUTE/DELROUTE, find appropriate interface
The interface lookup algorithm is different according to if we are on
netns vrf or not. If we are on the former case, then we only have to
parse the interfaces of the netns, while if we are on the other case, we
have to parse all the interfaces of all the vrfs ( since index is not
overlapping in the latter case).

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-07-10 17:32:23 +02:00
Quentin Young
32ec4bc474
Merge pull request #2602 from pacovn/PVS-Studio_element_overflow
bgpd zebra: element overflow (PVS-Studio)
2018-07-05 17:49:49 -04:00
Jafar Al-Gharaibeh
94adf8d33e
Merge pull request #2610 from qlyoung/fix-zebra-pthread-crash-shutdown-min
zebra: remove asserts on task nullity
2018-07-03 15:47:23 -05:00
Lou Berger
b0b3080e0f
Merge pull request #2598 from dslicenc/cm21429-vrf-dup
zebra: duplicate nexthops for cross-vrf static routes on vrf bounce
2018-07-03 11:39:38 -04:00
F. Aragon
e1fa928d22
ospfd zebra: array overrun fixes (PVS-Studio)
Signed-off-by: F. Aragon <paco@voltanet.io>
2018-07-03 11:34:40 +02:00
Quentin Young
7012f1a38c zebra: remove asserts on task nullity
While ZAPI I/O threads make a best effort to kill any scheduled tasks on
their threadmasters, after death another pthread can continue to
schedule onto the threadmaster. This isn't a problem per se since the
tasks will never run, but it also means that asserting that it hasn't
happened is pointless.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-07-02 18:07:28 +00:00
F. Aragon
a85297a7c9
bgpd zebra: element overflow (PVS-Studio)
The warning given by PVS-Studio is related to per-element overflow (there is
no real overflow, because of how elements are mapped in the union). This
same warning is typically reported by Coverity, too.

Signed-off-by: F. Aragon <paco@voltanet.io>
2018-07-02 19:06:54 +02:00
Don Slice
3b88f2e60a zebra: duplicate nexthops for cross-vrf static routes on vrf bounce
Problem created by the fix for cm-21306 (inactive cross-vrf static routes
when vrfs were bounced.)  Determined that in another case, that fix would
cause duplicate nexthops to appear in the table. Resolved the problem by
removing the vrf static route process from the zebra "add" process leaving
it in the zebra " if up" process as added in cm-21306 since that's the point
that the vrf device is now functional.

Ticket: CM-21429
Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
2018-07-02 14:01:33 +00:00
Russ White
1ad26882cb
Merge pull request #2517 from pguibert6WIND/flowspec_other_options
Flowspec support other options
2018-06-29 13:45:44 -04:00
Jafar Al-Gharaibeh
20e5fd7ab5
Merge pull request #2532 from donaldsharp/various_stuff
Redistribution and some extra developer debug code
2018-06-29 12:41:02 -05:00
Russ White
b46f306ed5
Merge pull request #2583 from donaldsharp/more_warnings
zebra: Fix use of uninited variable
2018-06-29 13:39:42 -04:00
Russ White
42edc48606
Merge pull request #2514 from pacovn/Coverity_1462467_1465497_Control_flow_issues
zebra: control flow issues (Coverity 1462467 1465497)
2018-06-29 13:24:42 -04:00
F. Aragon
e36e5b569c
isisd zebra: dead code (Clang scan)
This correction fixes two bugs detected by Clang scan:

Bug Group: Dead store

Bug Type: Dead assignment
File: zebra/kernel_netlink.c
Function: netlink_parse_extended_ack
Line: 548

Bug Type: Dead increment
File: isisd/isis_lsp.c
Function: lsp_bits2string
Line: 625

Signed-off-by: F. Aragon <paco@voltanet.io>
2018-06-29 17:47:05 +02:00
Donald Sharp
ce4f1050ca zebra: Fix use of uninited variable
Allow compiler to think the value is actually set to
something useful in an impossible case.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-06-28 21:06:23 -04:00
Philippe Guibert
5ac5b7cc7e zebra: handle policy routing fragment handling
incoming iptable entries with fragment parameter is handled.
An iptable context is created for each fragment value received from BGP.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-06-28 11:08:58 +02:00
Philippe Guibert
69214c57c3 zebra: add show pbr iptable dscp information
The iptable configured with dscp displays the dscp value configured.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-06-28 11:08:58 +02:00
Philippe Guibert
4977bd6c19 *: add flowspec dscp handling
Only one dscp value is accepted as filtering option.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-06-28 11:08:55 +02:00
Philippe Guibert
dc993e76e3 zebra: handling of policy routing iptable tcpflags
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-06-28 08:52:15 +02:00
Philippe Guibert
e7f7dad4a8 zebra: add packet length into pbr support
The packet length is added to iptable zapi message.
Then the iptable structure is taking into account the pkt_len field.
The show pbr iptable command displays the packet length used if any.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-06-28 08:52:15 +02:00
Philippe Guibert
3b0c3697a3 bgpd: add comment to inform that icmp can be stored in that struct
Generic ipset entry structure will be reused to host icmp information.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-06-28 08:52:15 +02:00
Philippe Guibert
be729dd7a5 zebra: improve show zebra ipset output for icmp
The icmp type/code is displayed.
Also, the flags are correctly set in case ICMP protocol is elected.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-06-28 08:52:15 +02:00
Philippe Guibert
5b0d92b8d5 zebra: pbr ipset_type2_str command is externalised
The API of that function that converts ipset types is externalised.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-06-28 08:52:15 +02:00
Donald Sharp
03ed85a6c0 lib, zebra: Add a bit of code to look at fifo
When in a dev build add a bit of code to track max
depth of a fifo and to allow zebra to report on it.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-06-27 20:01:22 -04:00
Donald Sharp
34fa087036 zebra: Re-add tracking of redistribution events
Somewhere along the way we lost the tracking of
redistribution events.  Put them back in.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-06-27 19:49:55 -04:00
paco
b6312ad185
lib zebra: str-z check (2) (Coverity 1465494)
This is an additional correction after  45981fda06 / PR #2462. I hope
this fixes the Coverity warning (I've added an additional check for ensuring
the string provided by the inotify read is zero-terminated).

Signed-off-by: F. Aragon <paco@voltanet.io>
2018-06-27 14:22:01 +02:00
Russ White
8394a34484
Merge pull request #2534 from pacovn/Coverity_1470113_Untrusted_array_index_write
zebra: untrusted array index (2) (Coverity 1470113)
2018-06-26 11:18:38 -04:00
Donald Sharp
6ca7b664b5 zebra: Log how we got to this failure.
When a filter function fails to work correctly, we get an
error message that something has gone wrong.  Unfortunately
we may not have any clues as to where the decode failure
happened.  Add a backtrace to give us a clue.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-06-25 10:02:48 -04:00
Donald Sharp
9bdf861803 zebra: Add error messages in places where we have a decode problem
When we receive a netlink message from the kernel we have
handler functions for when we send a netlink command, if these
return a failure ( < 0 ) then we output that we had a parse
issue.  But if all we get is:

2018-06-21T23:47:45.298156+00:00 qct-ix1-08 zebra[1484]: netlink-cmd (NS 0) filter function error

Then it is not very useful to figure out *where* the error happened.

Add more error code when in a decode path to hopefully allow us
to figure out where this message is coming from.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-06-25 10:02:48 -04:00
paco
45981fda06
zebra: untrusted array index (2) (Coverity 1470113)
This is a correction over 7f61ea7bd4 in order
to avoid the TAINTED_SCALAR Coverity warning (ending in "Untrusted array
index read"). This is equivalent to the previous commit, but avoiding
pointer arithmetic with tainted variables.

Signed-off-by: F. Aragon <paco@voltanet.io>
2018-06-22 21:10:50 +02:00
Renato Westphal
aa74131957
Merge pull request #2510 from donaldsharp/extended_ack
zebra: Add extended Ack error parsing to FRR
2018-06-21 12:16:53 -03:00
paco
0cfbff749e
zebra: flow control (Coverity 1462467 1465497)
Signed-off-by: F. Aragon <paco@voltanet.io>
2018-06-21 17:09:04 +02:00
Donald Sharp
5d307d5d3a zebra: Add extended Ack error parsing to FRR
Add code to request and read in extended ack information
to provide a bit more context of what went wrong when
a failure is detected in the kernel.

Example of a failed delete:
Jun 20 21:19:25 robot zebra[11878]: Extended Error: Invalid prefix for given prefix length
Jun 20 21:19:25 robot zebra[11878]: netlink-cmd (NS 0) error: Invalid argument, type=RTM_DELROUTE(25), seq=8, pid=4078403400
Jun 20 21:19:25 robot zebra[11878]: 0:4.3.2.0/24: Route Deletion failure

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-06-21 08:07:30 -04:00
paco
7f61ea7bd4
zebra: untrusted array index (Coverity 1470113)
This is a correction over 32ac96b2ba, so
removing the forced string null termination doesn't involve a worse situation
than before (the underflow check should protect for the case of receiving
an incomplete buffer, which would be the cause of non-zero terminated string)

Signed-off-by: F. Aragon <paco@voltanet.io>
2018-06-20 19:25:06 +02:00
Russ White
0c748602f2
Merge pull request #2462 from pacovn/Coverity_1465494_String_not_null_terminated
zebra: string null termination (Coverity 1465494)
2018-06-20 07:55:08 -04:00
Russ White
96be948bcd
Merge pull request #2495 from pacovn/fixme_all_digit
bgpd, lib, ospfd, zebra: all_digit moved to frrstr
2018-06-20 07:38:19 -04:00
Russ White
edc5b3e52e
Merge pull request #2496 from pacovn/fixme_group1
isisd, zebra: FIXME fixes (grouped)
2018-06-20 07:37:27 -04:00
Donald Sharp
46a69f10c0 bgpd, lib, zebra: Remove unnecessary return
The route_map_walk_update_list callback function
never uses the return code, so just remove it.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-06-19 21:22:46 -04:00
Donald Sharp
75a2b29dd6 zebra: Add initial framework to keep track of changed route-maps
Add some basic code for zebra to start to keep track
of route-maps that have changed.  At this point we
are not doing anything.  As we fix code to handle
route-maps better, code will be shifted around.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-06-19 21:22:46 -04:00
paco
36228974c2
isisd, zebra: FIXME fixes
Signed-off-by: F. Aragon <paco@voltanet.io>
2018-06-19 19:22:13 +02:00
paco
5d5ba0185d
bgpd, lib, ospfd, zebra: all_digit moved to frrstr
This solves a pending FIXME

Signed-off-by: F. Aragon <paco@voltanet.io>
2018-06-19 17:59:53 +02:00
paco
32ac96b2ba
zebra: string null termination (Coverity 1465494)
Signed-off-by: F. Aragon <paco@voltanet.io>
2018-06-19 14:53:31 +02:00
Russ White
fc89ac9846
Merge pull request #2470 from chiragshah6/mdev
zebra: Hide default vrf instance of l3vni cmd
2018-06-19 07:29:13 -04:00