Commit Graph

356 Commits

Author SHA1 Message Date
Donald Sharp
09924cffad zebra: Add pass up through zapi what zebra is capable of handling
Zebra is starting to have some run-time capabilites that would be
useful to pass up to the higher level protocols so that they
can act in an appropriate manner when needed.

Send the ecmp value zebra is being run with and whether or not
we believe mpls is enabled in the kernel or not.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-04-18 11:10:27 -04:00
Philippe Guibert
5dd0722dcf zebra: adapt zebra_pbr_rule based with pbr_rule
In order to avoid duplicates functions, the zebra_pbr_rule structure
used by zebra to decode the zapi message, and send netlink messages, is
slightly modified. the structure is derived from pbr_rule, but it also
includes sock identifier that is used to send back information to the
daemon that did the request. Also, the ifp pointer is stored in that
structure.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-04-16 14:40:43 +02:00
Philippe Guibert
7abd6c4fa0 zebra: add IPTABLE_ADD and IPTABLE_DEL commands in zapi
Those messages permit a remote daemon to configure an iptable entry. A
structure is defined that maps to an iptable entry. More specifically,
this structure proposes to associate fwmark, and a table ID.
Adding to the configuration, the initialisation of iptables hash list is
done into zebra netnamespace. Also a hook for notifying the sender that
the iptables has been correctly set is done.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-04-16 14:40:43 +02:00
Philippe Guibert
1907e4b80b zebra: pbr rule structure is being added fwmark tag
PBR rule is being added a 32 bit value that can be used to record a rule
in the kernel, by using a fwmark information.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-04-16 14:40:43 +02:00
Philippe Guibert
425bdd6bf1 zebra: handling notifications upon ipset creation/destruction done
Once ipset entries are injected in the kernel, the relevant daemon is
informed with a zebra message sent back.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-04-16 14:40:43 +02:00
Philippe Guibert
d59c13af5c lib: add ZEBRA IPSET defines
ZEBRA IPSET defines are added for creating/deleting ipset contexts.
Ans also create ipset hash sets.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-04-16 14:40:16 +02:00
Russ White
fdbbf02a05
Merge pull request #1987 from donaldsharp/zserv_read_fix
two zebra changes
2018-03-30 09:37:51 -04:00
Donald Sharp
c0079fc9ce zebra: Subtract header length in the right spot
The header length needs to be subtracted from the handling
side of the zapi in zebra.  This is because we refigure the
header data structure.  The receive side doesn't care
about the total header length so no need to subtract there.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-03-29 08:52:39 -04:00
Philippe Guibert
b98f77282b bgpd: add API to allocate a range of table identifiers
In BGP, doing policy-routing  requires to use table identifiers.
Flowspec protocol will need to have that. 1 API from bgp zebra has been
done to get the table chunk.
Internally, onec flowspec is enabled, the BGP engine will try to
connect smoothly to the table manager. If zebra is not connected, it
will try to connect 10 seconds later. If zebra is connected, and it is
success, then a polling mechanism each 60 seconds is put in place. All
the internal mechanism has no impact on the BGP process.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-03-29 09:20:01 +02:00
Philippe Guibert
8288a24fc1 zebra: add the handling of table ids from remote daemons
This commit is connecting the table manager with remote daemons by
handling the queries.
As the function is similar in many points with label allocator, a
function has been renamed.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-03-29 09:19:58 +02:00
Quentin Young
d7c0a89a3a
*: use C99 standard fixed-width integer types
The following types are nonstandard:
- u_char
- u_short
- u_int
- u_long
- u_int8_t
- u_int16_t
- u_int32_t

Replace them with the C99 standard types:
- uint8_t
- unsigned short
- unsigned int
- unsigned long
- uint8_t
- uint16_t
- uint32_t

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-03-27 15:13:34 -04:00
Donald Sharp
0528d946d5 zebra: Allow deletions from arbitrary tables
When a route_delete is received allow the deletion
to occur in the passed in tableid if the vrf is VRF_DEFAULT.

This now matches route_add behavior in rib_add_multipath

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-03-21 13:49:51 -04:00
Donald Sharp
98a217f0d0 zebra: Ensure that we properly decode the zapi_route sent to us
Ensure that we have properly decoded the zapi_route sent to us
and if we cannot decode, log and move on.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-03-20 18:48:12 -04:00
Renato Westphal
b49dc9f301
Merge pull request #1909 from donaldsharp/zebra_rule
Zebra rule
2018-03-20 09:45:57 -03:00
Donald Sharp
978caa0c88 zebra: Free memory leak
Free the memory leaked stream in failure cases.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-03-19 09:18:10 -04:00
Donald Sharp
149a38a313 zebra: Compare to the number of elements not size of array
When figuring out whom to call and if we actually can legally
call into the handler array actually use the number of elements
in the array instead of the size of the array.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-03-19 09:18:10 -04:00
Donald Sharp
e69aa08419 zebra: Allow for deletion of rules when the originator goes away
When zebra detects that the originator has dissapeared
delete all rules associated with that client.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-03-16 10:17:41 -04:00
Donald Sharp
010c5efac0
Merge pull request #1739 from LabNConsulting/working/master/bgp-vpn-vrf-leaking
bgpd: vpn - vrf route leaking
2018-03-15 09:01:27 -04:00
paulzlabn
9891fa4cb1
zserv.c: delete unused zsend_write_nexthop 2018-03-14 22:17:53 -07:00
paulzlabn
4ea6c38bf4
zserv.c: zebra_server_send_message() second parameter 2018-03-14 21:42:09 -07:00
Donald Sharp
32391affcc zebra: Add some additional vrf info to debugs
There were several places where when I am attempting
to debug zebra functionality that I would really
like to have the ability to know what vrf I think
I am operating on.

Add the vrf_id to a bunch of zlog_debug messages
to help figure out issues when they happen.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-03-14 20:14:36 -04:00
paulzlabn
3f1224cd1a
Merge branch 'master' into working/master/bgp-vpn-vrf-leaking 2018-03-14 13:31:58 -07:00
Philippe Guibert
c1a0038782
Merge pull request #1806 from vivek-cumulus/evpn-ipv6-tenant-routing
*: EVPN symmetric routing for IPv6 tenant routes
2018-03-13 10:20:29 +01:00
Quentin Young
41903a4074
lib, zebra: slight cleanup after rebase
Rebased zapi-cleanup, needs a bit of poking.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-03-12 14:57:06 -04:00
Quentin Young
107afcd10b
lib, zebra: clean up zapi nits
* Get correct data size when parsing VRF ids
* Move some vars into smaller scope

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-03-12 14:57:06 -04:00
Quentin Young
1002497af5
zebra: reorganize zserv, batch i/o
Group send and receive functions together, change handlers to take a
message instead of looking at ->ibuf and ->obuf, allow zebra to read
multiple packets off the wire at a time.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-03-12 14:57:05 -04:00
Quentin Young
89f4e5077b
zebra: standardize ZAPI message handler args
A lot of the handler functions that are called directly from the ZAPI
input processing code take different argument sets where they don't need
to. These functions are called from only one place and all have the same
fundamental information available to them to do their work. There is no
need to specialize what information is passed to them; it is cleaner and
easier to understand when they all accept the same base set of
information and extract what they need inline.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-03-12 14:57:05 -04:00
Quentin Young
9bcbcae2e4
zebra: add struct zmsghdr
Formalize the ZAPI header by documenting it in code and providing it to
message handlers free of charge to reduce complexity.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-03-12 14:57:05 -04:00
Quentin Young
8068a649a7
zebra: dont return a status code in zapi handlers
All of the ZAPI message handlers return an integer that means different
things to each of them, but nobody ever reads these integers, so this is
technical debt that we can just eliminate outright.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-03-12 14:57:05 -04:00
vivek
4e262455a2 Merge branch 'master' of https://github.com/frrouting/frr into evpn-ipv6-tenant-routing
Conflicts:
	bgpd/bgp_evpn.c
2018-03-10 04:03:41 +00:00
G. Paul Ziemba
1b6e575b2a zebra: debug additional detail for route announce/redist
alos add a comment

Signed-off-by: G. Paul Ziemba <paulz@labn.net>
2018-03-09 16:42:40 -05:00
Donald Sharp
b6c5d34354 lib, zebra: Add Rule insertion success/failure messages
Add code to allow rule insertion notifications to be
sent back up the stack.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-03-09 11:11:40 -05:00
Donald Sharp
a03219780f zebra: Make the ifp part of the rule structure
Every place we need to pass around the rule structure
we need to pass around the ifp as well.  Move it into
the structure.  This will also allow us to notify up
to higher level protocols that this worked properly
or not better too.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-03-09 11:07:41 -05:00
Donald Sharp
43fe6a2a73 zebra: Keep track of rules written
Keep track of rules written into the kernel.  This will
allow us to delete them on shutdown if we are not cleaned
up properly.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-03-09 11:07:41 -05:00
Donald Sharp
1fbfe5a572 zebra: Cleanup api
Allow the add/delete to go through a intermediary function in
zebra_pbr.c instead of directly to the underlying os call.  This
will allow future refinements to track the data a bit better
so that on shutdown we can delete the rules.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-03-09 11:07:41 -05:00
Donald Sharp
fd71d73eb3 zebra: Cleanup a couple of api issues
1) use uint32_t instead of u_int32_t as we are supposed to
2) Consolidate priority into the rule.
3) Cleanup the api from this.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-03-09 11:07:41 -05:00
Donald Sharp
e16abbb303 lib, zebra: Add rule encoding
Add some code to pass the rule we want installed into
the kernel.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-03-09 11:07:41 -05:00
Donald Sharp
7ee30f288e lib: Isolate nexthop_group functions to nexthop_group.c
Also modify `struct route_entry` to use nexthop_groups.
Move ALL_NEXTHOPS loop to nexthop_group.h

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-03-09 11:07:41 -05:00
Donald Sharp
ba1849ef8c lib, zebra: Allow zapi to send down the tableid
Allow the calling daemon to pass down what table-id we
want to use to install the route.  Useful for PBR.

The vrf id passed must be the VRF_DEFAULT else this
value is ignored.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-03-09 11:07:41 -05:00
vivek
bfd498f0da Merge branch 'master' of https://github.com/frrouting/frr into evpn-ipv6-tenant-routing
Conflicts:
	zebra/zserv.c
2018-03-06 22:19:24 +00:00
Lou Berger
996c93142d *: conform with COMMUNITY.md formatting rules, via 'make indent'
Signed-off-by: Lou Berger <lberger@labn.net>
2018-03-06 14:04:32 -05:00
vivek
558283638b lib, zebra: Fix warnings
Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
2018-03-01 19:50:46 +00:00
Donald Sharp
c7bacffe46 zebra: Use the passed in nexthops vrf
When decoding and creating the appropriate data structures
for a nexthop, use the passed in vrf.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-02-28 18:55:10 -05:00
vivek
1ec31309bb *: EVPN symmetric routing for IPv6 tenant routes
Implement support for EVPN symmetric routing for IPv6 routes. The next hop
for EVPN routes is the IP address of the remote VTEP which is only an IPv4
address. This means that for IPv6 symmetric routing, there will be IPv6
destinations with IPv4 next hops. To make this work, the IPv4 next hops are
converted into IPv4-mapped IPv6 addresses.

As part of support, ensure that "L3" route-targets are not announced with
IPv6 link-local addresses so that they won't be installed in the routing
table.

Signed-off-by: Vivek Venkatraman vivek@cumulusnetworks.com
Reviewed-by: Mitesh Kanjariya mitesh@cumulusnetworks.com
Reviewed-by: Donald Sharp sharpd@cumulusnetworks.com
2018-02-28 02:07:23 +00:00
Russ White
8bc92a3ec7
Merge pull request #1799 from donaldsharp/route_notify_owner
Route notify owner
2018-02-27 08:32:42 -05:00
Philippe Guibert
4691b65ae4 lib: add namespace name structure in zebra message
The addition of the name of the netns in the vrf message introduces also
a limitation when the size of the netns is bigger than 15 bytes. Then
the netns are ignored by the library.
In addition to this, some sanity checks have been introduced. some
functions to create the netns from a call not coming from the vty is
being added with traces.
Also, the ns vty function is reentrant, if the context is already
created.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2018-02-27 11:11:24 +01:00
Donald Sharp
eaa23e020f zebra: Add some useful debugs for notifying the owner
Add a bit more detail to tell us what we are sending
up to a protocol so we can debug it better in the
future.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-02-23 14:45:57 -05:00
Donald Sharp
28610f7e44 *: Add tableid the route entry was sent to
Add for the southbound pass back the route entries tableid
used for installation.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-02-23 14:45:57 -05:00
Donald Sharp
8fd9db586f zebra: Ensure unconfiguration works properly for vrf labels
If you were to configure a v4 and v6 vrf pop and forward label
that both happened to be the same, unconfiguring one would
remove them both.

This fixes that issue by noticing if we should remove it or
not based upon v4 or v6 having the same label or not.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-02-15 13:52:57 -05:00
Donald Sharp
7d061b3cb1 lib, sharpd, zebra: Update the zapi_vrf_label call to add afi
Add the ability to pass in an afi to zebra.  zebra_vrf keeps
track of the afi/label tuple and then does the right thing
before we call down.  AF_MPLS does not care about v4 or v6
it just knows label and what device to use for lookup.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-02-14 01:11:09 -05:00