Commit Graph

336 Commits

Author SHA1 Message Date
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
Mark Stapp
ff8d3c2dd4 zebra: add validate function for zapi_labels message
Add a simple validation function for zapi_labels messages; it
checks for and validates backup nexthop indexes currently.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-07-21 08:04:00 -04:00
Mark Stapp
474aebd939 lib,sharpd,zebra: initial support for multiple backup nexthops
Initial changes to support a nexthop with multiple backups. Lib
changes to hold a small array in each primary, zapi message
changes to support sending multiple backups, and daemon
changes to show commands to support multiple backups. The config
input for multiple backup indices is not present here.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-07-17 13:12:33 -04:00
Sebastien Merle
98a3fb0ab9 zebra: add IPv6 router-id
* add a vrf sub-command `[no] ipv6 router-id X:X::X:X`.
 * add command `[no] ipv6 router-id X:X::X:X [vrf NAME]` for backward
   compatibility.
 * add a vrf sub-command `[no] ip router-id A.B.C.D` and make the old
   one without `ip` an alias for it.
 * add a  command `[no] ip router-id A.B.C.D [vrf NAME]` for backward
   comptibility and make the old one without `ip` an alias for it.
 * add command `show ip router-id [vrf NAME]` and make
   the old one without `ip` an alias for it.
 * add command `show ipv6 router-id [vrf NAME]`.
 * add ZAPI commands `ZEBRA_ROUTER_ID_V6_ADD`,
   `ZEBRA_ROUTER_ID_V6_DELETE` and `ZEBRA_ROUTER_ID_V6_UPDATE`
   for deamons to get notified of the IPv6 router-id.
 * update zebra documentation.

Signed-off-by: Sebastien Merle <sebastien@netdef.org>
2020-07-17 17:39:05 +02:00
Renato Westphal
2d1ddebc8b
Merge pull request #6706 from donaldsharp/router_id_bullshit
Router id vrf subnode configuration
2020-07-16 18:09:38 -03: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
David Lamparter
6cde4b4552 *: remove PRI[udx](8|16|32)
These are completely pointless and break coccinelle string replacements.

Scripted commit, idempotent to running:
```
python3 tools/stringmangle.py --pri8-16-32 `git ls-files | egrep '\.[ch]$'`
```

Signed-off-by: David Lamparter <equinox@diac24.net>
2020-07-14 10:43:40 +02:00
Donald Sharp
03fba42ebb zebra: Allow router-id to be part of the vrf sub node
Modify zebra to accept router-id's as part of the
vrf subnode.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-07-09 11:57:22 -04:00
Mark Stapp
cc1b974668 zebra: collapse some duplicate LSP nhlfe apis
Collapse some apis where primary and backup nhlfe code
was very similar, generally using a single common api
and using a bool to distinguish between primary and
backup.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-07-07 13:25:23 -04:00
Jakub Urbańczyk
f62e5480ec zebra: convert ip rule installation to use dplane thread
* Implement new dataplane operations
 * Convert existing code to use dataplane context object
 * Modify function preparing netlink message to use dataplane
   context object

Signed-off-by: Jakub Urbańczyk <xthaid@gmail.com>
2020-06-10 16:18:45 +02:00
Mark Stapp
79b3664a67 zebra: call zapi message handler with a batch
The zapi code processes a batch of incoming messages, using a
fifo. Hand the entire batch into the main zebra handling code,
and let it loop through the individual messages.

Divert the special OPAQUE messages from the normal processing
flow, and offer them to the new zebra_opaque module instead.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-06-02 08:20:54 -04:00
Renato Westphal
c5b9016eeb
Merge pull request #6266 from mjstapp/backup_nhgs
zebra: backup nexthops/nhlfes for LSPs
2020-06-01 20:54:51 -03:00
Mark Stapp
f2e7f4eba4 zebra: backup LSP zapi processing
Move some processing of zapi label messages so they can be
handled more efficiently. Handle zapi delete and replace
messages.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-06-01 14:46:32 -04:00
Mark Stapp
cd4bb96f9d zebra: support backup nhlfes in LSPs
Handle backup nhlfes in LSP zapi messages. Capture backup info
with LSPs, capture backup info in the dataplane LSP processing.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-06-01 14:46:32 -04:00
Donald Sharp
e748c7a42a zebra: Allow zebra to gracefully handle rtadv when not configured
Currently zebra when you compile without router advertisements
will just say something like `cannot handle message 42`.  Which
is not terribly useful to an end user.

Add some smarts to the zapi message handling to just do nothing
and output a debug if someone has it turned on.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-05-21 07:42:04 -04:00
vivek
12b4d77bab zebra: Trust onlink flag for nexthop active resolution
When checking if a nexthop is active, if it has been marked as onlink,
just check on the presence and status of the nexthop's interface. When
handling client request to create a route, if the client says that the
nexthop is onlink, trust it; when internally (in zebra) determining
that the nexthop is onlink, ensure it is only done in the case of an
interface with a /32 IP address which is the case for OSPF unnumbered.

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by:   Stephen Worley <sworley@cumulusnetworks.com>
2020-05-15 16:22:01 -07:00
Mark Stapp
4cebdb9bb8 zebra,ldpd: use zapi client session id in LM apis
Use the zapi client session id in the label manager apis;
use the client struct directly in some code. Assign a session
id to ldpd's sync LM zapi session.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-04-16 12:07:54 -04:00
Mark Stapp
4e0b5b31b7 lib,zebra: add a session id for zapi sessions
Distinguish zapi sessions, for daemons who use more than one,
by adding a session id. The tuple of proto + instance is not
adequate to support clients who use multiple zapi sessions.
Include the id in the client show output if it's present. Add
a bit of info about this to the developer doc.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-04-16 12:07:54 -04:00
Emanuele Di Pascale
1935832264 zebra: minor fix to label manager log
zebra should only check whether a get_chunk operation succeeded
when processing the response, rather than insde the get_chunk
call itself. Spllitting the request and response hooks was done
precisely to allow for asynchronous calls to an external label
manager; in this case, the requested chunk is not necessarily
going to be available at request time.

Signed-off-by: Emanuele Di Pascale <emanuele@voltanet.io>
2020-04-07 11:33:16 +02:00
Mark Stapp
377e29f7e7 zebra: handle backup nexthops in nhe/nhgs
Include backup nexthops in nhe processing; connect incoming
zapi route data with updated rib/nhg apis; add more debugs in
nhg processing.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-03-27 11:50:03 -04:00
Mark Stapp
1d48702ede zebra: add per-nexthop backup index
Use a backup index in a nexthop directly (if it has a backup
nexthop); revise the zebra nhe/nhg code; revise zapi route
decoding to match; revise the dataplane route datastructs.

Refactor some of the rib_add_multipath code to be prepared to
be called with an nhe, carrying nexthop and (possibly) backup
info together.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-03-27 11:50:03 -04:00
Mark Stapp
62e46303f4 zebra: support backup nexthops in zapi route messages
Initial support to decode backup nexthops in zapi route
messages.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-03-27 09:39:14 -04:00
Mark Stapp
018c648864 lib: add backup nexthops to zapi routes
Add backup nexthop info to zapi route messages.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-03-27 09:37:02 -04:00
Renato Westphal
4e9d40b8a1
Merge pull request #5925 from volta-networks/synchronous_client
zebra: synchronous client queues accumulate messages from zebra
2020-03-26 17:32:37 -03:00
David Lamparter
63efca0e95 *: remove line breaks from log messages
Line break at the end of the message is implicit for zlog_* and flog_*,
don't put it in the string.  Mid-message line breaks are currently
unsupported.  (LF is "end of message" in syslog.)

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2020-03-24 19:43:18 +01:00
Karen Schoener
17da84a49d zebra: Synchronous client queues accumulate messages from zebra.
Zebra is currently sending messages on interface add/delete/update,
VRF add/delete, and interface address change - regardless of whether
its clients had requested them.  This is problematic for lde and isis,
which only listens to label chunk messages, and only when it is
waiting for one (synchronous client). The effect is the that messages
accumulate on the lde synchronous message queue.

With this change:
  - Zebra does not send unsolicited messages to synchronous clients.
  - Synchronous clients send a ZEBRA_HELLO to zebra.
    The ZEBRA_HELLO contains a new boolean field: sychronous.
  - LDP and PIM have been updated to send a ZEBRA_HELLO for their
    synchronous clients.

Signed-off-by: Karen Schoener <karen@voltanet.io>
2020-03-23 09:17:17 -04:00
Donatas Abraitis
cec72d492d zebra: Distinguish source/destination PBR IP in zlog_warn messages
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-03-14 14:23:40 +02:00
Donatas Abraitis
7d76c335d8
Merge pull request #5854 from qlyoung/fix-zapi-ipset-entry-bad-family
zebra: check for invalid family in ipset entry msg
2020-03-14 14:19:13 +02: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
Quentin Young
ca8a844cc5
Merge pull request #5850 from Spantik/gr_fix
Zebra: Zebra gr dynamic client handling
2020-03-04 23:40:26 -05:00
Mark Stapp
95a70b4315 zebra: allow multiple labels in LSP zapi message
The handlers for a couple of the main LSP-oriented zapi
messages explicitly limited themselves to a single out-label.
Allow multiple labels if the sender ... sends them.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-03-02 15:54:09 -05:00
Mark Stapp
c415d89528 zebra: Embed lib nexthop-group in zebra hash entry
Embed nexthop-group, which is just a pointer, in the zebra
nexthop-hash-entry object, rather than mallocing one.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-02-27 15:49:31 -05:00
Quentin Young
9863725ca7 zebra: check for invalid family in ipset entry msg
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2020-02-22 23:23:17 -05:00
Santosh P K
6f4aee61a2 Zebra: Zebra gr dynamic client handling.
When a client connects to zebra with GR capabilities and
then restarts, it might disconnect again even before hello is
sent leading zebra cores.

GR should be supported only for dynamic neighbor who are capable
of restarting.

Signed-off-by: Santosh P K <sapk@vmware.com>
2020-02-21 06:26:48 -08:00
Donatas Abraitis
be427cc88a
Merge pull request #5837 from qlyoung/fix-zapi-pbr-unsupported-ip-family-log-message-newline
zebra: remove \n in zapi pbr family log msg
2020-02-19 20:41:30 +01:00
Quentin Young
b7b05b462d zebra: remove \n in zapi pbr family log msg
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2020-02-19 11:24:43 -05:00
Donatas Abraitis
0bdcc3e3ef
Merge pull request #5809 from donaldsharp/vrf_name
Print out vrf name as well as id
2020-02-19 14:23:32 +01:00
Mark Stapp
4945002d71 *: encode zapi labels message using nexthops
Use the zapi_nexthop struct with the mpls_labels
zapi messages instead of the special-purpose (and
more limited) nexthop struct that was being used.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-02-14 16:16:21 -05:00
Donald Sharp
c479e75665 zebra: Add vrf name to debug output
The vrf id is insufficient of a discriminator in people's head
Give them what they need.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-02-14 08:41:42 -05:00
Donatas Abraitis
5ee080f00a zebra, lib: Remove return from void functions
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-02-04 20:05:21 +02:00
Donald Sharp
a6bb6a1fe9
Merge pull request #5207 from Spantik/ZERBA_GR
Zebra: Adding GR infrastructure for clients.
2020-02-04 10:57:29 -05:00
Santosh P K
b9e6727acd zebra: Capabality and stale route handling for GR client.
Handling capability received from client. It may contain
GR enable/disable, Stale time changes, RIB update complete
for given AFi, ASAFI and instance. It also has changes for
stale route handling.

Signed-off-by: Santosh P K <sapk@vmware.com>
2020-01-31 03:36:37 -08:00
Stephen Worley
c8b891b483 zebra: reset nexthop pointer in zread of nexthops
We were not resetting the nexthop pointer to NULL for each
new read of a nexthop from the zapi route. On the chance we
get a nexthop that does not have a proper type, we will not
create a new nexthop and update that pointer, thus it still
has the last valid one and will create a group with two
pointers to the same nexthop.

Then when it enters any code that iterates the group, it loops
endlessly.

This was found with zapi fuzzing.

```
0x00007f728891f1c3 in jhash2 (k=<optimized out>, length=<optimized out>, initval=12183506) at lib/jhash.c:138
0x00007f728896d92c in nexthop_hash (nexthop=<optimized out>) at lib/nexthop.c:563
0x00007f7288979ece in nexthop_group_hash (nhg=<optimized out>) at lib/nexthop_group.c:394
0x0000000000621036 in zebra_nhg_hash_key (arg=<optimized out>) at zebra/zebra_nhg.c:356
0x00007f72888ec0e1 in hash_get (hash=<optimized out>, data=0x7ffffb94aef0, alloc_func=0x0) at lib/hash.c:138
0x00007f72888ee118 in hash_lookup (hash=0x7f7288de2f10, data=0x7f728908e7fc) at lib/hash.c:183
0x0000000000626613 in zebra_nhg_find (nhe=0x7ffffb94b080, id=0, nhg=0x6020000032d0, nhg_depends=0x0, vrf_id=<optimized out>,
    afi=<optimized out>, type=<optimized out>) at zebra/zebra_nhg.c:541
0x0000000000625f39 in zebra_nhg_rib_find (id=0, nhg=<optimized out>, rt_afi=AFI_IP) at zebra/zebra_nhg.c:1126
0x000000000065f953 in rib_add_multipath (afi=AFI_IP, safi=<optimized out>, p=0x7ffffb94b370, src_p=0x0, re=0x6070000013d0,
    ng=0x7f728908e7fc) at zebra/zebra_rib.c:2616
0x0000000000768f90 in zread_route_add (client=0x61f000000080, hdr=<optimized out>, msg=<optimized out>, zvrf=<optimized out>)
    at zebra/zapi_msg.c:1596
0x000000000077c135 in zserv_handle_commands (client=<optimized out>, msg=0x61b000000780) at zebra/zapi_msg.c:2636
0x0000000000575e1f in main (argc=<optimized out>, argv=<optimized out>) at zebra/main.c:309
```

```
(gdb) p *nhg->nexthop
$4 = {next = 0x5488e0, prev = 0x5488e0, vrf_id = 16843009, ifindex = 16843009, type = NEXTHOP_TYPE_IFINDEX, flags = 8 '\b', {gate = {ipv4 = {s_addr = 0},
      ipv6 = {__in6_u = {__u6_addr8 = '\000' <repeats 15 times>, __u6_addr16 = {0, 0, 0, 0, 0, 0, 0, 0}, __u6_addr32 = {0, 0, 0, 0}}}},
    bh_type = BLACKHOLE_UNSPEC}, src = {ipv4 = {s_addr = 0}, ipv6 = {__in6_u = {__u6_addr8 = '\000' <repeats 15 times>, __u6_addr16 = {0, 0, 0, 0, 0, 0, 0,
          0}, __u6_addr32 = {0, 0, 0, 0}}}}, rmap_src = {ipv4 = {s_addr = 0}, ipv6 = {__in6_u = {__u6_addr8 = '\000' <repeats 15 times>, __u6_addr16 = {0, 0,
          0, 0, 0, 0, 0, 0}, __u6_addr32 = {0, 0, 0, 0}}}}, resolved = 0x0, rparent = 0x0, nh_label_type = ZEBRA_LSP_NONE, nh_label = 0x0, weight = 1 '\001'}
(gdb) quit

```

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2020-01-30 17:15:06 -05:00
Santosh P K
851140a7bb zebra: Handling of connection disconnect and connect with GR.
Zebra will have special handling for clients with GR enabled.
When client disconnects with GR enabled, then a stale client
will be created and its RIB will be retained till stale timer
or client comes up and updated its RIB.

Co-authored-by: Santosh P K <sapk@vmware.com>
Co-authored-by: Soman K S <somanks@vmware.com>
Signed-off-by: Santosh P K <sapk@vmware.com>
2020-01-30 10:26:04 -08:00
Mark Stapp
be3a8fa8f8
Merge pull request #5620 from qlyoung/fix-zebra-vrf-label-afi-check
Fix zebra vrf label afi check
2020-01-23 10:59:19 -05:00
Donald Sharp
54bea4e537 zebra: Re-add onlink flag due to loss in earlier commit
commit: 0eb97b860d

Removed this chunk of code in zebra:
-       if (ifp)
-               if (connected_is_unnumbered(ifp))
-                       SET_FLAG(nexthop->flags, NEXTHOP_FLAG_ONLINK);

Effectively if we had a NEXTHOP_TYPE_IPV4_IFINDEX we would
auto set the onlink flag.  This commit dropped it for some reason.

Add it back in an intelligent manner.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-01-22 17:10:20 -05:00
Quentin Young
663d3a9115 zebra: check afi validity in vrf label message
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2020-01-22 14:12:15 -05:00
Quentin Young
cc815be71a zebra: print unknown rule family as number
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2020-01-16 20:53:10 -05:00
David Lamparter
ba16266644
zebra: Do not accept illegal safi's for route installation (#5679)
zebra: Do not accept illegal safi's for route installation
2020-01-16 10:12:44 +01:00
Donald Sharp
946de1b95a bgpd, ospfd, zebra: Do not use 0 as VRF_DEFAULT
Explicitly spell out what we are trying to do.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-01-15 08:29:36 -05:00
Donald Sharp
5e7939a561 zebra: Do not accept illegal safi's for route installation
The only two safi's that are usable for zebra for installation
of routes into the rib are SAFI_UNICAST and SAFI_MULTICAST.
The acceptance of other safi's is causing a memory leak:

Direct leak of 56 byte(s) in 1 object(s) allocated from:
    #0 0x5332f2 in calloc (/usr/lib/frr/zebra+0x5332f2)
    #1 0x7f594adc29db in qcalloc /opt/build/frr/lib/memory.c:110:27
    #2 0x686849 in zebra_vrf_get_table_with_table_id /opt/build/frr/zebra/zebra_vrf.c:390:11
    #3 0x65a245 in rib_add_multipath /opt/build/frr/zebra/zebra_rib.c:2591:10
    #4 0x7211bc in zread_route_add /opt/build/frr/zebra/zapi_msg.c:1616:8
    #5 0x73063c in zserv_handle_commands /opt/build/frr/zebra/zapi_msg.c:2682:2
Collapse

Sequence of events:

Upon vrf creation there is a zvrf->table[afi][safi] data structure
that tables are auto created for.  These tables only create SAFI_UNICAST
and SAFI_MULTICAST tables.  Since these are the only safi types that
are zebra can actually work on.  zvrf data structures also have a
zvrf->otable data structure that tracks in a RB tree other tables
that are created ( say you have routes stuck in any random table
in the 32bit route table space in linux ).  This data structure is
only used if the lookup in zvrf->table[afi][safi] fails.

After creation if we pass a route down from an upper level protocol
that has non unicast or multicast safi *but* has the actual
tableid of the vrf we are in, the initial lookup will always
return NULL leaving us to look in the otable.  This will create
a data structure to track this data.

If after this event you pass in a second route with the same
afi/safi/table_id, the otable will be created and attempted
to be stored, but the RB_TREE_UNIQ data structure when it sees
this will return the original otable returned and the lookup function
zebra_vrf_get_table_with_table_id will just drop the second otable.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-01-15 08:23:14 -05:00
Stephen Worley
9ab0b2a37a lib,zebra: add zapi msg top level error handling
Add error handling for top level failures (not able to
execute command, unable to find vrf for command, etc.)

With this error handling we add a new zapi message type
of ZEBRA_ERROR used when we are unable to properly handle
a zapi command and pass it down into the lower level code.

In the event of this, we reply with a message of type
enum zebra_error_types containing the error type.

The sent packet will look like so:

 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|             Length            |     Marker    |    Version    |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                             VRF ID                            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|            Command            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|            ERROR TYPE         |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

Also add appropriate hooks for clients to subscribe to for
handling these types of errors.

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2020-01-08 12:22:29 -05:00
Rafael Zalamena
6e882c5c55
Merge pull request #5624 from qlyoung/fix-zebra-ptm-buffer-overrun
Fix PTM ZAPI stream parsing
2020-01-07 17:02:07 -03:00
Mark Stapp
58700d822e
Merge pull request #5617 from donaldsharp/zebra_bites
zebra: misc zebra cleanups
2020-01-07 13:41:03 -05:00
Renato Westphal
cf84bf26cf
Merge pull request #5625 from qlyoung/fix-zapi-ipset-name-nullterm
zebra: ensure ipset name is null terminated
2020-01-06 23:47:41 -03:00
Renato Westphal
da0047f411
Merge pull request #5614 from qlyoung/fix-zebra-zapi-crashes
Fix zebra zapi crashes
2020-01-06 23:45:49 -03:00
Donald Sharp
f096bae46b zebra: Handle crash when backpointer does not exist
=================================================================
==3058==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000010 (pc 0x7f5bf3ef7477 bp 0x7ffdfaa20d40 sp 0x7ffdfaa204c8 T0)
==3058==The signal is caused by a READ memory access.
==3058==Hint: address points to the zero page.
    #0 0x7f5bf3ef7476 in memcpy /build/glibc-OTsEL5/glibc-2.27/string/../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S:134
    #1 0x4d158a in __asan_memcpy (/usr/lib/frr/zebra+0x4d158a)
    #2 0x7f5bf58da8ad in stream_put /home/qlyoung/frr/lib/stream.c:605:3
    #3 0x67d428 in zsend_ipset_entry_notify_owner /home/qlyoung/frr/zebra/zapi_msg.c:851:2
    #4 0x5c70b3 in zebra_pbr_add_ipset_entry /home/qlyoung/frr/zebra/zebra_pbr.c
    #5 0x68e1bb in zread_ipset_entry /home/qlyoung/frr/zebra/zapi_msg.c:2465:4
    #6 0x68f958 in zserv_handle_commands /home/qlyoung/frr/zebra/zapi_msg.c:2611:3
    #7 0x55666d in main /home/qlyoung/frr/zebra/main.c:309:2
    #8 0x7f5bf3e5db96 in __libc_start_main /build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:310
    #9 0x4311d9 in _start (/usr/lib/frr/zebra+0x4311d9)

the ipset->backpointer was NULL as that the hash lookup failed to find
anything.  Prevent this crash from happening.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-01-06 20:25:54 -05:00
Quentin Young
aa8cb96489 zebra: reject ingress packets that are too large
There may be logic to prevent this ever happening earlier in the network
read path, but it doesn't hurt to double check it here, because clearly
deeper paths rely on this being the case.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2020-01-03 22:33:56 -05:00
Quentin Young
f223b3d1d4 zebra: null terminate interface name from wire
We read an ifname from the wire but don't make sure its null terminated,
fix it

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2020-01-03 22:30:33 -05:00
Quentin Young
8b5c4dce07 zebra: fix iptable memleak, fix free funcs
- Fix iptable freeing code to free malloc'd list
- malloc iptable in zapi handler and use those functions to free it when
  done to fix a linked list memleak

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2020-01-03 22:30:20 -05:00
Quentin Young
261462c3aa zebra: ensure ipset name is null terminated
We copy a fixed length buffer from the wire but don't ensure it is null
terminated. Then print it as a c-string. Lul.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2020-01-03 21:40:30 -05:00
Quentin Young
4719fd7613 zebra: check pbr rule msg for correct afi
further down we hash the src & dst ip, which asserts that the afi is one
of the well known ones, given the field names i assume the correct afis
here are af_inet[6]

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2020-01-03 11:38:24 -05: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
Mark Stapp
68a02e06e5 *: revise zapi nexthop encoding
Use a per-nexthop flag to indicate the presence of labels; add
some utility zapi encode/decode apis for nexthops; use the zapi
apis more consistently.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2019-12-06 10:17:20 -05:00
Donald Sharp
e302caaa81
Merge pull request #5416 from mjstapp/re_nhe_pointer
lib,zebra: use shared nexthop-group in route_entry
2019-12-04 14:11:04 -05:00
Mark Stapp
0eb97b860d lib,zebra: use nhg_hash_entry pointer in route_entry
Replace the existing list of nexthops (via a nexthop_group
struct) in the route_entry with a direct pointer to zebra's
new shared group (from zebra_nhg.h). This allows more
direct access to that shared group and the info it carries.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2019-12-04 08:13:52 -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
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
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
Satheesh Kumar K
ee235396b9 Zebra: adding support for Zebra MLAG Functionality
This includes:
1. Processing client Registrations for MLAG
2. storing client Interests for MLAG updates
3. Opening communication channel to MLAG  with First client reg
4. Closing Communication channel with last client De-reg
5. Spawning a new thread for handling MLAG updates peocessing
6. adding Test code
7. advertising MLAG Updates to clients based on their interests

Signed-off-by: Satheesh Kumar K <sathk@cumulusnetworks.com>
2019-11-13 20:50:37 -08:00
Stephen Worley
d3a3513811 lib,pbrd,zebra: Use one api to delete nexthops/group
Reduce the api for deleting nexthops and the containing
group to just one call rather than having a special case
and handling it separately.

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2019-10-25 11:13:43 -04:00
Stephen Worley
bc541126e4 zebra: Use nexthop object id on route delete
When we receive a route delete from the kernel and it
contains a nexthop object id, use that to match against
route gateways with instead of explicit nexthops.

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2019-10-25 11:13:42 -04:00
Donald Sharp
9a0d4dd39b zebra: Remove nexthop_active_num from route entry
The nexthop_active_num data structure is a property of the
nexthop group.  Move the keeping of this data to that.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-10-25 11:13:36 -04:00
Donald Sharp
6b46851168 zebra: Replace nexthop_group with pointer in route entry
In the route_entry we are keeping a non pointer based
nexthop group, switch the code to use a pointer for all
operations here and ensure we create and delete the memory.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-10-25 11:13:36 -04:00
Stephen Worley
b19d55d048 zebra: Don't bother ref'ing ifp in zebra_pbr_rule
If we only really use the ifp for the name, then
don't bother referencing the ifp. If that ifp is
freed, we don't expect zebra to handle the rules that
use it (that's pbrd's job), so it is going to be
pointing to unintialized memory when we decide to remove
that rule later. Thus, just keep the name in the data
and dont mess with pointer refs.

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2019-10-15 15:39:49 -04:00
Stephen Worley
b77a69bdc6 zebra: Use the rule ifindex as a hash key, not ifp
Use the ifindex value as a primary hash key/identifier, not
the ifp pointer. It is possible for that data to be freed
and then we would not be able to hash and find the rule entry
anymore. Using the ifindex, we can still find the rule even
if the interface is removed.

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2019-10-15 15:03:46 -04:00
Quentin Young
6a597223d3 Revert "Merge pull request #4885 from satheeshkarra/pim_mlag"
This reverts commit d563896dad, reversing
changes made to 09ea1a4038.
2019-10-14 17:15:09 +00:00
Jafar Al-Gharaibeh
d563896dad
Merge pull request #4885 from satheeshkarra/pim_mlag
pimd, lib, Zebra: PIM MLAG Support
2019-10-14 01:07:24 -05:00
Philippe Guibert
60ca3cc27d zebra: entries can be pushed in tables, under vrf netns backend
initially, vrf backend if vrf-lite, and a specific table identifier is
associated to a vrf. here, with netns vrf backend, there is no specific
table assigned to except default routing table. use the passed table_id
parameter in zapi api, and apply it to the entry to be pushed in, or to
be removed.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2019-10-10 16:06:51 +02:00
Satheesh Kumar K
40d9d1cc44 Zebra: adding support for Zebra MLAG Functionality
This includes:
1. Processing client Registrations for MLAG
2. storing client Interests for MLAG updates
3. Opening communication channel to MLAG  with First client reg
4. Closing Communication channel with last client De-reg
5. Spawning a new thread for handling MLAG updates peocessing
6. adding Test code
7. advertising MLAG Updates to clients based on their interests

Signed-off-by: Satheesh Kumar K <sathk@cumulusnetworks.com>
2019-09-24 01:42:31 -07:00
Donald Sharp
16296beaa5
Merge pull request #4731 from mjstapp/fix_redist_update
zebra: redistribute deletes when updating selected route
2019-09-18 19:43:43 -04:00
Mark Stapp
40f321c000 zebra: revise redistribution delete to improve update case
When selecting a new best route, zebra sends a redist update
when the route is installed. There are cases where redist
clients may not see that redist add - clients who are not
subscribed to the new route type, e.g. In that case, attempt
to send a redist delete for the old/previous route type.

Revised the redist delete api to accomodate both cases;
also tightened up the const-ness of a few internal redist apis.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2019-09-12 08:51:05 -04:00
Renato Westphal
ea6b290bf6 lib, zebra: add new MPLS zapi message with route replace semantics
This new message makes it possible to install/reinstall LSPs with
multiple nexthops using a single ZAPI message.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2019-09-10 00:01:10 -03:00
Renato Westphal
b3c49d0e77 lib, zebra: enhance the MPLS zapi messages
* Add ability to specify the nexthop type;
* Add ability to install or not a FTN (in addition to an LSP).

These two additions will be useful to install local SR Prefix-SIDs
configured with the no-PHP option.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2019-09-06 21:06:11 -03:00
Renato Westphal
e132dea064 zebra: identify MPLS FTNs by route type and instance
Use the route type and instance instead of the route distance
to identify MPLS FTNs. This is a more robust approach since the
routing daemons can modify the distance of their announced routes
via configuration, which can cause inconsistencies.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2019-09-06 21:06:11 -03:00
Renato Westphal
bad6b0e72e lib: introduce encode/decode functions for the MPLS zapi messages
Do this for the following reasons:
* Improve modularity of the code by separating the decoding of the
  ZAPI messages from their processing;
* Create an API that is easier to use by the client daemons.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2019-09-06 21:06:11 -03:00
David Lamparter
0cf6db21ec *: frr_elevate_privs -> frr_with_privs
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2019-09-03 17:18:35 +02:00
Donald Sharp
8ba70c4e51 zebra: Print out client who sent us bad data
A client was sending zebra a route with no nexthops!  Update the
error message to tell us *Which* daemon is doing this.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-07-16 20:31:22 -04:00
Donald Sharp
8f86bb067e zebra: Guard debug messages
A bunch of debug code has snuck in that is unguarded.
Fix this.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-07-16 20:30:55 -04:00
Jafar Al-Gharaibeh
5f7faeb041
Merge pull request #4635 from AnuradhaKaruppiah/evpn-pim-replay
pimd, zebra: request for replay of VxLAN SG entries on pimd startup
2019-07-15 15:40:12 -05:00
Renato Westphal
07a4ddf2b6
Merge pull request #4660 from manuhalo/label_manager_fixes
Label manager improvements + refactor
2019-07-12 17:09:33 -03:00
Emanuele Di Pascale
e11d7c96d7 zebra: label manager refactor
in order to both streamline the code and allow users to
define their own specialized versions of the LM api handlers,
define hooks for the 4 main primitives offered by the label
manager (i.e. connect, disconnect, get_chunk and release_chunk),
and have the existing code be run in response to a hook_call.
Additionally, have the responses to the requesting daemon be
callable from an external API.

Note that the proxy version of the label manager was a source of
issues and hardly used in practice. With the new hooks, users with
more complex requirements can simply plug in their own code to
handle label distribution remotely, so there is no longer a reason
to maintain this code.

Signed-off-by: Emanuele Di Pascale <emanuele@voltanet.io>
2019-07-10 15:20:27 +02:00
Emanuele Di Pascale
f004f7c3ce lib, zebra: handle failure in get chunk
when requesting a specific label chunk (e.g. for the SRGB),
it might happen that we cannot get what we want. In this
event, we must be prepared to receive a response with no
label chunk. Without this fix, if the remote label manager
was not able to alloate the chunk we requested, we would
hang indefinitely trying to read data from the stream which
was not there.

Signed-off-by: Emanuele Di Pascale <emanuele@voltanet.io>
2019-07-10 15:20:27 +02:00
Emanuele Di Pascale
0e3b6a926a lib, zebra: support label chunk requests for SRGB
For SRGB, we need to support chunk requests starting at a
specific point in the label space, rather than just asking
for any sufficiently large chunk. To this purpose, we extend
the label manager api to request a chunk with a base value;
if the base is set to 0, the label manager will behave as it
currently does, i.e. fetching the first free chunk big enough
to satisfy the request.

update all the existing calls to get chunks from the label
manager so that they use MPLS_LABEL_BASE_ANY as the base
for the requested chunk

Signed-off-by: Emanuele Di Pascale <emanuele@voltanet.io>
2019-07-10 15:20:27 +02:00
Philippe Guibert
f449d22396 bgp, zebra, lib: add protocol support for iptables
in addition to support for tcpflags, it is possible to filter on any
protocol. the filtering can then be based with iptables.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2019-07-08 08:36:45 +02:00
Anuradha Karuppiah
ecbbc3a750 pimd, zebra: request for replay of SG entries on startup
zvni setup in zebra is controlled via bgpd i.e. advertise_all_vni
from bgpd triggers this setup. As a part of zvni creation we may need
to setup BUM mcast SG entries which are propagated to pimd for MDT setup.

Now pimd may not be present at the time of zvni creation or may restart
post zvni creation so we need a mechanism to replay (on pimd startup) and
to cleanup (on pimd stop). This is addressed via zebra_vxlan_sg_replay and
zebra_evpn_pim_cfg_clean_up.

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2019-07-03 10:11:53 -07:00
Donald Sharp
a36898e755
Revert "Ospf missing interface handling 2" 2019-06-23 19:46:39 -04:00
Philippe Guibert
a41c4e1b1f *: change interface structure, from vrf_id to vrf
Field vrf_id is replaced by the pointer of the struct vrf *.
For that all other code referencing to (interface)->vrf_id is replaced.
This work should not change the behaviour.
It is just a continuation work toward having an interface API handling
vrf pointer only.

some new generic functions are created in vrf:
vrf_to_id, vrf_to_name,

a zebra function is also created:
zvrf_info_lookup

an ospf function is also created:
ospf_lookup_by_vrf

it is to be noted that now that interface has a vrf pointer, some more
optimisations could be thought through all the rest of the code. as
example, many structure store the vrf_id. those structures could get
the exact vrf structure if inherited from an interface vrf context.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2019-06-12 14:10:28 +02:00
Philippe Guibert
f11e98eca3 *: change if_lookup_by_name() api with vrf
the vrf_id parameter is replaced by struct vrf * parameter.
this impacts most of the daemons that look for an interface based on the
name and the vrf identifier.
Also, it fixes 2 lookup calls in zebra and sharpd, where the vrf_id was
ignored until now.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2019-06-12 08:37:54 +02:00
Donald Sharp
3c649c719f *: Convert to using frr_vtydir instead of DAEMON_VTY_DIR
In a variety of places we are using DAEMON_VTY_DIR, convert
to use frr_vtydir.  This will allow us in a future commit
to have the -N namespace option be automatically used.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-06-04 10:37:19 -04:00
Donald Sharp
f3f4562612 lib, zebra: Ensure route encoding has enough space
When you have compiled FRR with a large multipath number
then encoding large ecmp routes between zebra and the
routing daemons.  There exists a theoritical size
of multipath that will cause the encoding to be larger
than the ZEBRA_MAX_PACKET_SIZ.  In the cases where
we have allocated streams that will encode routes
then let's ensure that whatever size we have will
auto-fit what we say we can send.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-05-31 10:25:18 -04:00
Quentin Young
19c3825004 vrrpd, zebra: fix checkpatch warnings
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-05-17 00:27:08 +00:00
Quentin Young
65dc7dd387 zebra: don't protodown a NULL interface
We were running into some problems where VRRP is trying to protodown
interfaces that no longer exist. While this is a minor bug in its own
right, this was crashing Zebra because Zebra was not doing a null check
after its ifindex lookup.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-05-17 00:27:08 +00:00
Quentin Young
53e60e5c58 vrrpd: autoconfig support
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-05-17 00:27:08 +00:00
Quentin Young
c3bd894e4d vrrpd: protodown macvlan in backup state
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-05-17 00:27:08 +00:00
Russ White
cc25952f2a
Merge pull request #4327 from sworleys/Move-Multipath-Num
zebra: Move multipath_num into zrouter
2019-05-16 10:04:14 -04:00
Donald Sharp
b3f2b59020 zebra: Move multipath_num into zrouter
The multipath_num variable is a property of zebra_router,
so move it there.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-05-14 14:15:18 -07:00
Donald Sharp
98572489ea zebra: Switch to using monotime(NULL) for re->uptime
The re->uptime usage of time(NULL) leaves it open to
timing changes from outside influence.  Switching
to monotime allows us to ensure that we have a timestamp
that is always increasing.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-05-11 01:44:42 -04:00
Quentin Young
49b3b01f4c zebra: fix zapi msg debugging dumps
When we switched to a pthread per client, we lost the ability to
correlate zapi message debugs with their handlers in zlog, because the
message was logged when it was read off the zapi socket and not right
before it was processed. Move the zapi msg hexdump to happen right
before we call the message handler.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-05-03 19:55:44 +00:00
Donald Sharp
dd25a6b3a3 zebra: Make rnh only send response once on first registration
The current code path of registration does this:

a) Lookup or create the rnh
b) register the client with the rnh for callback
   If this is a new rnh send a response to the client that
   only includes the rnh data that it has (nothing so no path)
   If this is a existing rnh send the actual path to the client,
     if it exists.
c) If a new client or a flag has changed refigure and send result
   to all clients.

This is problematic in that suppose the rnh is new.  Clients
will receive two answers:
  1) A call back with no nexthops
  2) A call back with the resolved # of nexthops

Imagine pim who depends on nht to handle this, pim will create
a mroute( because it does a hard lookup of the rpf as it is registering
the nexthop ), then it will receive the first callback causing
it to tear down the mroute and then receive the second callback
causing it to put it right back.. This is obviously not very
good for mroutes.

This code moves the send to the new client till after the new
client has connected, thus only allowing one callback to the new
client with the actual answer.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-04-04 08:45:20 -04:00
Donald Sharp
906b54ddba zebra: Re-evaluate the nexthop tracking if flags changed
Routing protocols are allowed ( and even encouraged ) to modify
the flags that influence the nexthop tracking.  As such when
we modify the tracking of a nexthop to go from, say, connected force
or not we must re-evaluate the nexthop and send the results
up to the interested parties.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-03-27 16:22:22 -04:00
Sri Mohana Singamsetty
f05d888049
Merge pull request #3892 from vivek-cumulus/evpn_vrf_route_leak
Leaking of EVPN-based IPv4 and IPv6 routes between VRFs
2019-03-15 10:27:13 -07:00
vivek
744c63be13 zebra: Use next hop's VRF for EVPN-based routes
Ensure that the next hop's VRF is used for IPv4 and IPv6 unicast routes
sourced from EVPN routes, for next hop and Router MAC tracking and
install. This way, leaked routes from other instances are handled properly.

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Reviewed-by:   Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>
2019-03-01 07:10:53 +00:00
vivek
2b83602b24 *: Explicitly mark nexthop of EVPN-sourced routes as onlink
In the case of EVPN symmetric routing, the tenant VRF is associated with
a VNI that is used for routing and commonly referred to as the L3 VNI or
VRF VNI. Corresponding to this VNI is a VLAN and its associated L3 (IP)
interface (SVI). Overlay next hops (i.e., next hops for routes in the
tenant VRF) are reachable over this interface. Howver, in the model that
is supported in the implementation and commonly deployed, there is no
explicit Overlay IP address associated with the next hop in the tenant
VRF; the underlay IP is used if (since) the forwarding plane requires
a next hop IP. Therefore, the next hop has to be explicit flagged as
onlink to cause any next hop reachability checks in the forwarding plane
to be skipped.

https://tools.ietf.org/html/draft-ietf-bess-evpn-prefix-advertisement
section 4.4 provides additional description of the above constructs.

Use existing mechanism to specify the nexthops as onlink when installing
these routes from bgpd to zebra and get rid of a special flag that was
introduced for EVPN-sourced routes. Also, use the onlink flag during next
hop validation in zebra and eliminate other special checks.

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Reviewed-by:   Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>
2019-02-27 12:54:24 +00:00
vivek
e1e71450a0 zebra, bgpd: Use L3 interface for VRF's VNI in route install
In the case of EVPN symmetric routing, the tenant VRF is associated with
a VNI that is used for routing and commonly referred to as the L3 VNI or
VRF VNI. Corresponding to this VNI is a VLAN and its associated L3 (IP)
interface (SVI). Overlay next hops (i.e., next hops for routes in the
tenant VRF) are reachable over this interface.

https://tools.ietf.org/html/draft-ietf-bess-evpn-prefix-advertisement
section 4.4 provides additional description of the above constructs.

Use the L3 interface exchanged between zebra and bgp in route install.
This patch in conjunction with the earlier one helps to eliminate some
special code in zebra to derive the next hop's interface.

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Reviewed-by:   Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>
2019-02-27 12:25:53 +00:00
Chirag Shah
278e26de8e zebra: advertise svi ip as macip route changes
In Asymmetric and symetric routing scenario in EVPN
where each VTEP pair having different set of addresses
for the SVIs.
This knob allows reachability (ping connectivity) of
SVI IPs and resolve ARP resoultion VTEPs across racks.

This knob should not be used when same SVI IPs configured
on VTEPs across racks or when advertise default gateway
is configured.

Ticket:CM-23782
Testing Done:
Bring up EVPN symmetric routing topology with different
SVI IPs on different VTEPs. Enable advertise svi ip
at each VTEP, remote VTEPs installs arp entry for
SVI IPs via EVPN type-2 route exchange.

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2019-02-06 19:57:53 -08:00
Donald Sharp
a8a20c4e3c zebra: Remove zclient->idinfo restrictions
The restricting of data about interfaces was both inconsistent
in application and allowed protocol developers to get into states where
they did not have the expected data about an interface that they
thought that they would.  These restrictions and inconsistencies
keep causing bugs that have to be sorted through.

The latest iteration of this bug was that commit:
f20b478ef3

Has caused pim to not receive interface up notifications( but
it knows the interface is back in the vrf and it knows the
relevant ip addresses on the interface as they were changed
as part of an ifdown/ifup cycle ).

Remove this restriction and allow the interface events to
be propagated to all clients.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-02-05 09:13:30 -05:00
Donald Sharp
b120fe3b69 zebra: Add ability to send to all clients updated capability information
When capability information changes, allow for resending of data.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-01-31 09:28:39 -05:00
Donald Sharp
161e9ab7e2 zebra: Move client_list to the zebra_router data structure
The client_list should be owned by the zebra_router data structure
as that it is part of global state information.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-01-31 09:20:46 -05:00
Donald Sharp
fe85601c96 *: The onlink attribute should be owned by the nexthop not the route.
The onlink attribute was being passed from upper level protocols
as an attribute of the route *not* the individual nexthop.  When
we pass this data to the kernel, we treat the onlink as a attribute
of the nexthop.  This commit modifies the code base to allow
us to pass the ONLINK attribute as an attribute of the nexthop.

This commit also fixes static routes that have multiple nexthops
some onlink and some not.

ip route 4.5.6.7/32 192.168.41.1 eveth1 onlink
ip route 4.5.6.7/32 192.168.42.2

S>* 4.5.6.7/32 [1/0] via 192.168.41.1, eveth1 onlink, 00:03:04
  *                  via 192.168.42.2, eveth2, 00:03:04

sharpd@robot ~/frr2> sudo ip netns exec EVA ip route show
4.5.6.7 proto 196 metric 20
	nexthop via 192.168.41.1 dev eveth1 weight 1 onlink
	nexthop via 192.168.42.2 dev eveth2 weight 1

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-01-26 21:02:26 -05:00
Donald Sharp
313731ac92
Merge pull request #3630 from opensourcerouting/fix-show-import-check
zebra: fix the "show ip import-check" command
2019-01-22 20:10:56 -05:00
Quentin Young
b9c25a2a90
Merge pull request #3559 from opensourcerouting/zapi-sanity-checks
add a few moar sanity checks when encoding/decoding zapi routes
2019-01-22 13:53:08 -05:00
Donald Sharp
b3cfe1e2da
Merge pull request #3633 from opensourcerouting/send-vrf-backend
Send VRF backend to the client daemons
2019-01-22 09:11:58 -05:00
Renato Westphal
73bf60a06b zebra: consolidate how we indentify address-families in the NHT code
Favor usage of the afi_t enumeration to identify address-families
over using the classic AF_INET[6] constants for that. The choice to
use either of the two seems to be mostly arbitrary throughout our
code base, which leads to confusion and bugs like the one fixed by
commit 6f95d11a1. To address this problem, favor usage of the afi_t
enumeration whenever possible, since 1) it's an enumeration (helps
the compilers to catch some bugs), 2) has a safi_t sibling and 3)
can be used to index static arrays. AF_INET[6] should then be used
only when interfacing with the kernel or external libraries like
libc. The family2afi() and afi2family() functions can be used to
convert between the two different representations back and forth.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2019-01-21 13:26:36 -02:00
Renato Westphal
bb6b7f79be zebra, lib: send VRF backend to the client daemons
Add a new field in the ZEBRA_CAPABILITIES zapi message specifying
the VRF backend in use.

For simplicity, make the zclient code call vrf_configure_backend()
to apply the received value automatically instead of requiring
the daemons to do that themselves in their zebra_capabilities()
callbacks.

Additionally, call zebra_vrf_update_all() only after sending the
capabilities message to the client, so that it will know which VRF
backend is in use when processing the VRF messages.

This commit fixes a couple of bugs in the "interface" CLI command and
associated northbound callbacks, which behave differently depending
on the VRF backend in use. Before this commit, the vrf_backend
variable would always be set to VRF_BACKEND_NETNS in the client
daemons, even when zebra was started without the --vrfwnetns option.
This could lead to inconsistent behavior and subtle bugs under
specific circumstances.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2019-01-19 22:46:37 -02:00
Renato Westphal
27ecbea30b zebra: send link parameters to zclients once they request interface info
We were sending ZEBRA_INTERFACE_LINK_PARAMS messages under the
following circumstances:
* New interface was created (via kernel or config);
* Interface went from down to up;
* Update in the link-params configuration.

Now also send ZEBRA_INTERFACE_LINK_PARAMS messages whenever a zclient
connects and sends a ZEBRA_INTERFACE_ADD request. Without this fix,
the client daemons don't receive interface link parameters if they
are configured in the zebra startup configuration.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2019-01-18 16:06:00 -02:00
Renato Westphal
f20b478ef3 zebra: fix checking of clients subscribed to receive interface info
client->ifinfo is a VRF bitmap, hence we need to use
vrf_bitmap_check() to check if a client is subscribed to receive
interface information for a particular VRF. Just checking if
the client->ifinfo value is set will always succeed since it's
a pointer initialized by zserv_client_create(). With this fix,
we'll stop sending interface messages from all VRFs to all clients,
even those that didn't subscribe to it.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2019-01-18 16:06:00 -02:00
Renato Westphal
7fcb24bbaa zebra: reject routes without nexthops
Routes without nexthops don't make any sense, so we need to reject
them otherwise weird things can happen.

NOTE: blackhole routes aren't nexthop-less, they do have a single
nexthop of type NEXTHOP_TYPE_BLACKHOLE.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2019-01-14 15:58:26 -02:00
Renato Westphal
e4081c0e0b lib: add a few more sanity checks when encoding/decoding routes
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2019-01-14 15:58:26 -02:00
Renato Westphal
49db7a7b05 lib, zebra: add AFI parameter to the ZEBRA_REDISTRIBUTE_DEFAULT_* messages
Some daemons like ospfd and isisd have the ability to advertise a
default route to their peers only if one exists in the RIB. This
is what the "default-information originate" commands do when used
without the "always" parameter.

For that to work, these daemons use the ZEBRA_REDISTRIBUTE_DEFAULT_ADD
message to request default route information to zebra. The problem
is that this message didn't have an AFI parameter, so a default route
from any address-family would satisfy the requests from both daemons
(e.g. ::/0 would trigger ospfd to advertise a default route to its
peers, and 0.0.0.0/0 would trigger isisd to advertise a default route
to its IPv6 peers).

Fix this by adding an AFI parameter to the
ZEBRA_REDISTRIBUTE_DEFAULT_{ADD,DELETE} messages and making the
corresponding code changes.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2019-01-14 11:41:33 -02:00
Donald Sharp
02c0866dbe lib, zebra: On startup send mlag role as part of the capabilities
On startup send the mlag role as part of the capabilities to
the end protocol.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-01-04 12:21:00 -05:00
Renato Westphal
91d227b7e3 zebra, lib: fix the ZEBRA_INTERFACE_VRF_UPDATE zapi message
Unlike the other interface zapi messages, ZEBRA_INTERFACE_VRF_UPDATE
identifies interfaces using ifindexes and not interface names. This
is a problem because zebra always sends ZEBRA_INTERFACE_DOWN
and ZEBRA_INTERFACE_DELETE messages before sending
ZEBRA_INTERFACE_VRF_UPDATE, and the ZEBRA_INTERFACE_DELETE callback
from all daemons set the interface index to IFINDEX_INTERNAL. Hence,
when decoding a ZEBRA_INTERFACE_VRF_UPDATE message, the interface
lookup would always fail since the corresponding interface lost
its ifindex. Example (ospfd):

OSPF: Zebra: Interface[rt1-eth2] state change to down.
OSPF: Zebra: interface delete rt1-eth2 vrf default[0] index 8 flags 11143 metric 0 mtu 1500
OSPF: [EC 100663301] INTERFACE_VRF_UPDATE: Cannot find IF 8 in VRF 0

To fix this problem, use interface names instead of ifindexes to
indentify interfaces like the other interface zapi messages do.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2019-01-02 13:32:31 -02:00
Anton Degtyarev
57592a53b5 bgpd, zebra: auto assign labels from label pool to regular prefixes in BGP labeled unicast
This commit is the last missing piece to complete BGP LU support in bgpd. To this moment, bgpd (and zebra) supported auto label assignment only for prefixes leaked from VRFs to vpn and for MPLS SR prefixes. This adds auto label assignment to other routes types in bgpd. The following enhancements have been made:
* bgp_route.c:bgp_process_main_one() now sets implicit-null local_label to all local, aggregate and redistributed routes.
* bgp_route.c:bgp_process_main_one() now will request a label from the label pool for any prefix that loses the label for some reason (for example, when the static label assignment config is removed)
* bgp_label.c:bgp_reg_dereg_for_label() now requests labels from label pool for routes which have no associated label index
* zebra_mpls.c:zebra_mpls_fec_register() now expects both label and label_index from the calling function, one of which must be set to MPLS_INVALID_LABEL or MPLS_INVALID_LABEL_INDEX, based on this it will decide how to register the provided FEC.

Signed-off-by: Anton Degtyarev <anton@cumulusnetworks.com>
2018-12-20 15:28:52 +03:00
Chirag Shah
3950b52c54 zebra: dup addr detect zapi changes
EVPN Duplicate Address Detection (DAD)
zapi information

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2018-11-17 19:22:16 -08:00
Quentin Young
b1bd101570 zebra: cleanup some leftovers from removed cmds
* Remove vestigial 'secondary' option for v6 address installation
  functions
* Update comments mentioning it

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-10-28 07:19:59 +00:00
Donald Sharp
a756969dc6 pimd, zebra: Encode nexthop vrf in message
Encode the nexthop vrf in the message sent about mrib lookups.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-11-01 19:24:59 -04:00
Donald Sharp
ab5990d8b9 zebra: Add counting to nexthop register/unregister events
Add a bit of code to note how many register/unregister nht
events we have had.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-10-31 06:25:51 -04:00
Donald Sharp
69c19e1def
Merge pull request #2946 from mjstapp/dplane_2
Zebra: async dataplane, phase 1
2018-10-28 16:10:45 -04:00
Mark Stapp
2577906481 zebra: revise struct names to resolve review comments
Use standard type naming and remove use of typedef to resolve
some review comments.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2018-10-25 08:57:04 -04:00
Mark Stapp
7cdb1a8445 zebra: start dataplane layer work
Reduce or eliminate use of global zebra_ns structs in
a couple of netlink/kernel code paths, so that those paths
can potentially be made asynch eventually.

Slide netlink_talk_info into place to remove dependency on core
zebra structs; add accessors for dplane context block

Start init of route context from zebra core re and rn structs;
start queueing and event handling for incoming route updates.

Expose netlink apis that don't rely on zebra core structs;
add parallel route-update code path using the dplane ctx;
simplest possible event loop to process queued route'
updates.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2018-10-25 08:34:30 -04:00
Donald Sharp
62f20a52ab zebra: Move ipset_hash, ipset_entry_hash and iptable_hash into zrouter
These three data structures belong in the `zebra_router` structure
as that they do not belong in `struct zebra_ns`.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-10-24 06:54:29 -04:00
Donald Sharp
7f0ea8a4a2 zebra: Move rules_hash to zrouter
Move the rules_hash to the zrouter data structure and provide
the additional bit of work needed to lookup the rule based upon
the namespace id as well.  Make the callers of functions not
care about what namespace id we are in.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-10-24 06:53:09 -04:00
Donald Sharp
fbac9605a7 lib, zebra: Allow the specification of BUM flooding
Allow the modification of whether or not we will allow
BUM flooding on the vxlan bridge.  To do this allow
the upper level protocol to specify via the ZEBRA_VXLAN_FLOOD_CONTROL
zapi message.

If flooding is disabled then BUM traffic will not be forwarded
to other VTEP's.

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-10-11 20:22:19 -04:00
vishaldhingra
6d53d7b1af zebra: vrf aware routmap is missing in Zebra #2802(Part 2 of 4)
Function parameter replacement of using zvrf instead of vrf_id

Signed-off-by: vishaldhingra vdhingra@vmware.com
2018-10-11 10:46:55 -07:00
paco
f533be73f6
bgpd, doc, ldpd, lib, tests, zebra: LM fixes
Corrections so that the BGP daemon can work with the label manager properly
through a label-manager proxy. Details:

- Correction so the BGP daemon behind a proxy label manager gets the range
  correctly (-I added to the BGP daemon, to set the daemon instance id)
- For the BGP case, added an asynchronous label manager connect command so
  the labels get recycled in case of a BGP daemon reconnection. With this,
  BGPd and LDPd would behave similarly.

Signed-off-by: F. Aragon <paco@voltanet.io>
2018-09-18 17:39:16 +02:00
Quentin Young
1c50c1c0d6 *: style for EC replacements
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-09-13 19:38:57 +00:00
Quentin Young
e914ccbe9c zebra: ZEBRA_[ERR|WARN] -> EC_ZEBRA
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-09-13 19:23:29 +00:00
Quentin Young
364fed6b07 zebra: fix includes
Add and remove error related includes as necessary.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-09-06 20:56:41 +00:00
Quentin Young
9df414feeb zebra: flog_warn conversion
Convert Zebra to user error subsystem.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-09-06 20:56:38 +00:00
Donald Sharp
1d30d1f4a8 zebra: When registering a nexthop, we do not always need to re-eval
The code prior to this change, was allowing clients to register
for nexthop tracking.  Then zebra would look up the rnh and
send to that particular client any known data.  Additionally
zebra was blindly re-evaluating the rnh for every registration.

This leads to interesting behavior in that all people registered
for that nexthop will get callbacks even if nothing changes.

Modify the code to know if we have evaluated the rnh or not
and if so limit the re-evaluation to when absolutely necessary

This is of particular importance to do because of nht callbacks
for protocols cause those protocols to do not insignificant
work and as more protocols are registering for nht callbacks
we will cause more work than is necessary.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-08-25 08:11:01 -04:00
Donald Sharp
0477276088 doc, lib, zebra: Remove deprecated encode and decode functionality
The ZEBRA_IPV4_ROUTE_[ADD|DELETE] and ZEBRA_IPV6_ROUTE_[ADD|DELETE] functionality
has been deprecated for a year now, let's remove this code from the system.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-08-24 10:56:15 -04:00
David Lamparter
6bb30c2cba *: use frr_elevate_privs() (2/2: manual)
Signed-off-by: David Lamparter <equinox@diac24.net>
2018-08-14 20:02:05 +00:00
Quentin Young
af4c27286d *: rename zlog_fer -> flog_err
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-08-14 20:02:05 +00:00
Quentin Young
43e52561b4 zebra, lib: error references for zebra
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-08-14 20:02:05 +00:00
Rafael Zalamena
d3af6147a1 bfdd: re-route PTM-BFD daemon messages
When `bfdd` is enabled - which it is by default - re-route the PTM-BFD
messages to the FRR's internal BFD daemon instead of the external
PTM daemon.

This will help the migration of BFD implementations and avoid
duplicating code.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2018-08-08 18:25:04 -03:00
Donald Sharp
40ecd8e46d lib, zebra: Allow protocols to use Distance as part of RR semantics
Allow protocols to specify to zebra that they would like zebra
to use the distance passed down as part of determine sameness for
Route Replace semantics.

This will be used by the static daemon to allow it to have
backup static routes with greater distances.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-07-29 12:43:23 -04:00
Donald Sharp
f23cbcda59 zebra: Allow a static daemon to connect
As part of moving the static route handling to it's own daemon
allow zebra to accept static route types from upper level
protocols.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-07-29 12:27:48 -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
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
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
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
Russ White
1ad26882cb
Merge pull request #2517 from pguibert6WIND/flowspec_other_options
Flowspec support other options
2018-06-29 13:45:44 -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
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
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
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
aa360de7a3
zebra: Out-of-bounds read (Coverity 1465495)
Signed-off-by: F. Aragon <paco@voltanet.io>
2018-06-12 15:27:44 +02:00
Quentin Young
727c9b9961 zebra: handle label manager & fuzzing growths
Label manager reaches its hands into session / IO code for zserv for
whatever reason, gotta handle that.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-05-29 19:06:16 +00:00
Quentin Young
904e0d8830 zebra: optimize zserv_process_messages
* Simplify zapi_msg <-> zserv interaction
* Remove header validity checks, as they're already performed before the
  packet ever makes it here
* Perform the same kind of batch processing done in zserv_write by
  copying multiple inbound packets under lock instead of doing serial
  locking
* Perform self-scheduling under the same lock

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-05-29 19:06:16 +00:00
Quentin Young
21ccc0cf24 zebra: refactor zserv names, consolidate events
* Add centralized thread scheduling dispatchers for client threads and
  the main thread

* Rename everything in zserv.c to stop using a combination of:
  - zebra_server_*
  - zebra_*
  - zserv_*

  Everything in zserv.c now begins with zserv_*.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-05-29 19:06:16 +00:00
Philippe Guibert
f80ec7e3d6 zebra: handle iptable list of interfaces
Upon reception of an iptable_add or iptable_del, a list of interface
indexes may be passed in the zapi interface. The list is converted in
interface name so that it is ready to be passed to be programmed to the
underlying system.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-05-25 15:49:38 +02:00
Philippe Guibert
25d760c551 zebra: add 3 fields to ipset_entry : src,dst port, and proto
Those 3 fields are read and written between zebra and bgpd.
This permits extending the ipset_entry structure.
Combinatories will be possible:
- filtering with one of the src/dst port.
- filtering with one of the range src/ range dst port
usage of src or dst is exclusive in a FS entry.
- filtering a port or a port range based on either src or dst port.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-05-25 15:49:38 +02:00
Philippe Guibert
be2028d19b zebra: rework pbr ipset entry
Add ns_id into zebra_pbr ipset
This is important so that each ipset entry knows on which NETNS the
ipset entry must be inkected

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-05-25 15:49:38 +02:00
Renato Westphal
f403d10280
Merge pull request #2133 from Fredi-raspall/fix_label_manager
Fix broken label manager (proxy-mode) and improve of proxy function
2018-05-15 10:00:12 -03:00
Fredi Raspall
0313523d77 lib, zebra: fix formatting and style
Signed-off-by: Fredi Raspall <fredi@voltanet.io>
2018-05-08 18:37:05 +02:00
Fredi Raspall
9c61000765 zebra: LM temporally ignore id/proto mismatch error
Since BGPd is not currently setting ID and PROTOCOL in label
requests, temporally disable mismatch error propagation.

This commit will be reverted once fixes for BGPd and label
manager are integrated.

Signed-off-by: Fredi Raspall <fredi@voltanet.io>
2018-05-01 21:43:18 +02:00
Fredi Raspall
5dffb0e9aa zebra, lib: Add client proto & instance in zserv
Add client proto and instance number in all msg (request and
responses) to/form a label manager. This is required for a
label manager acting as 'proxy' (i.e. relaying messages towards
another label manager) to correctly deliver responses to the
requesting clients.

Signed-off-by: Fredi Raspall <fredi@voltanet.io>
2018-05-01 21:43:10 +02:00
Fredi Raspall
881999e64f zebra: fix broken label manager proxy mode.
In a prior refactor, label manager proxy functionality
was broken in two places:

1) in function relay_response_back(), "dst" stream was
accidentally  replaced by "src".

2) in zread_relay_label_manager_request(), src was set to point
to a global struct stream *ibuf that was not used/initialized
anywhere.

Signed-off-by: Fredi Raspall <fredi@voltanet.io>
2018-04-27 20:10:39 +02:00
vivek
a317a9b9a4 bgpd, zebra: Handle EVPN router MAC per next hop
Ensure that when EVPN routes are installed into zebra, the router MAC
is passed per next hop and appropriately handled. This is required for
proper multipath operation.

Ticket: CM-18999
Reviewed By:
Testing Done: Verified failed scenario, other manual tests
Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
2018-04-26 07:50:34 -04:00
Quentin Young
8b1766b148 zebra: style last 3 changes
Fixup latent style issues in copied code.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-04-22 22:50:25 -04:00
Quentin Young
d864709552 zebra: cleanup for zapi_msg.c split
* Rename client_connect and client_close hooks to zapi_client_connect
  and zapi_client_close
* Remove some more unnecessary headers
* Fix a copy-paste error in zapi_msg.[ch] header comments
* Fix an inclusion comment in zserv.c

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-04-22 22:50:25 -04:00
Quentin Young
453844abd7 zebra: use hooks for client lifecycle callbacks
zserv.c was using hardcoded callbacks to clean up various components
when a client disconnected. Ergo zserv.c had to know about all these
unrelated components that it should not care about. We have hooks now,
let's use the proper thing instead.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-04-22 22:50:24 -04:00
Quentin Young
bf094f6975 zebra: clean up zapi organization
zserv.c has become something of a dumping ground for everything vaguely
related to ZAPI and really needs some love. This change splits out the
code fo building and consuming ZAPI messages into a separate source
file, leaving the actual session and client lifecycle code in zserv.c.

Unfortunately since the #include situation in Zebra has not been paid
much attention I was forced to fix the headers in a lot of other source
files. This is a net improvement overall though.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-04-22 22:50:24 -04:00