Commit Graph

3355 Commits

Author SHA1 Message Date
Renato Westphal
eada87a4ab
Merge pull request #5623 from qlyoung/fix-zebra-rtadv-interval-overflow
zebra: disallow negative rtadv intvl, fix overflow
2020-01-06 23:51:44 -03: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
Renato Westphal
2441dc0daa
Merge pull request #5580 from mjstapp/zebra_nhg_debug_category
zebra: add a debug category for nexthops
2020-01-06 23:44:23 -03:00
Donald Sharp
6cc75d2d4e
Merge pull request #5546 from mjstapp/fix_notify_nht
zebra: route changes via notify path should trigger nht
2020-01-06 20:34:24 -05:00
Donald Sharp
c4db327d82
Merge pull request #5553 from slankdev/slankdev-fix-kernel-route-deletion-on-vrf
zebra: fix kernel-route's deletion on vrf
2020-01-06 20:32:16 -05:00
Mark Stapp
193c7b4caf
Merge pull request #5626 from qlyoung/fix-zapi-pbr-foo
zebra: Fix zapi pbr foo, pseudowire ifname termination
2020-01-06 14:59:07 -05:00
Mark Stapp
9287b4c50f zebra: route changes via notify path trigger nht and mpls
Changes to a route via the dataplane notify path should
trigger nht and mpls lsp processing.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-01-06 10:09:47 -05:00
Quentin Young
67188ca253 zebra: fix undefined bitshifts in netlink stuff
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2020-01-04 14:12:46 -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
40441c3da9 zebra: disallow negative rtadv intvl, fix overflow
- Disallow RA interval < 0
- Fix integer overflow issue converting interval to seconds from
  milliseconds
- Add missing "m" to "ms"

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2020-01-03 20:26:09 -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
Quentin Young
bd2481c4e8 zebra: use correct attr size for netlink enc
a bool is not 4 bytes

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2020-01-03 02:14:36 -05:00
Philippe Guibert
d7cce42cc7
Merge pull request #5350 from sworleys/Fix-NS-Defualt-Info
zebra: Fix default ns->info should point to default zebra_ns
2019-12-26 17:46:08 +01:00
Mark Stapp
d4b4b70cdc zebra: add a debug category for nexthops
Add a category for nexthops and nh-groups, since we've got
quite a bit of code in there now.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2019-12-23 08:47:38 -05:00
Hiroki Shirokura
760f39dc08 zebra: fix kernel-route's deletion on vrf
zebra can catch the kernel's route deletion by netlink.
but current FRR can't delete kernel-route on vrf(l3mdev)
when kernel operator delete the route on out-side of FRR.
It looks problem about kernel-route deletion.

This problem is caused around _nexthop_cmp_no_labels(nh1,nh2)
that checks the each nexthop's member 'vrf_id'.
And _nexthop_cmp_no_labels's caller doesn't set the vrf_id
of nexthop structure. This commit fix that case.

Signed-off-by: Hiroki Shirokura <slank.dev@gmail.com>
2019-12-23 15:25:12 +09:00
Quentin Young
1e72835da9
Merge pull request #5563 from mjstapp/fix_nhg_depends_find
zebra: improve efficiency of depends_find()
2019-12-20 13:06:29 -05:00
Donatas Abraitis
25c4cecfcd
Merge pull request #5543 from Jafaral/routerid
zebra: add 'show router-id'
2019-12-19 11:26:18 +02:00
Mark Stapp
cb86eba3ab zebra: improve efficiency of depends_find()
Do less malloc and free in depends_find(), when looking for
a singleton nexthop in the nhg hash.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2019-12-18 15:34:37 -05:00
Jafar Al-Gharaibeh
13b01f2f0c zebra: add 'show router-id'
router-id is buried deep in "show running-config", this new
command makes it easy to retrieve the user configured router-id.
Example:

  # configure terminal
  (config)# router-id 1.2.3.4
  (config)# end

  # show router-id
  router-id 1.2.3.4

  # configure terminal
  (config)# no router-id 1.2.3.4
  (config)# end

  # show router-id
  #

Signed-off-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
2019-12-17 15:05:56 -06:00
Stephen Worley
62d2ecb2f2 zebra: set RTNH_F_ONLINK in nexthop creation
We were not setting the RTNH_F_ONLINK flag where appropriate
when creating nexthop objects in the kernel.

Set it on the nhmsg.nh_flags netlink message.

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2019-12-17 14:24:22 -05:00
Quentin Young
6498fc458d
Merge pull request #5508 from ton31337/feature/show_ip_route_summary_json
zebra: Print json output for show_route_summary_cmd
2019-12-17 10:05:13 -05:00
Stephen Worley
b10d6b0744 zebra: pass type when finding individual nexthop
When we are doing a lookup on an individual nexthop,
we should still be passing along the type that gets passed
via the arguments. Otherwise, we will always think we own that
NHE when in reality anyone could have put that into the
kernel.

Before this patch, nexthops in the kernel will get swepped
out even if we didn't create them.

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2019-12-16 16:46:30 -05:00
Stephen Worley
84a89a8d2e zebra: null check re->nhe not re->nhe->nhg on attach
We should be NULL checking the entire re->nhe struct, not
the group inside of it. When we get routes from the kernel
using a nexthop group (and future protocols) they will only
pass us an ID to use. Hence, this struct can (and will be)
NULL on first attach when only passed an ID.

There shouldn't be a situation where we have an re->nhe
and don't have an re->nhe->nhg anyway.

Before this patch you can easily make zebra crash by creating a
route in the kernel using a nexthop group and starting zebra.

`ip next add dev lo id 111`
`ip route add 1.1.1.1/32 nhid 111`

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2019-12-16 16:37:14 -05:00
Donald Sharp
fd193241e9 zebra: Do not build mlag protobuf support if version 3 is not avail
Older versions of protobuf-c do not support version 3 of the
protocol.  Add a check into the system to see if we have
version 3 available and if so, compile it in.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-12-15 09:37:51 -05:00
Donald Sharp
14d9bbbe5c zebra: Allow zebra_mlag to compile with no j factor
If you compile FRR with no j factor zebra_mlag.c fails to
build because the vtysh extraction methodology runs first
before the protobuf compiler runs and that compilation does
not have the proper dependancy chain built for the inclusions
that zebra_mlag.c had.  Moving the DEF* code into a zebra_mlag_vty.c
which can be included in the vtysh extraction code and has
no mlag.proto dependancies makes the compilation work better.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-12-15 09:36:23 -05:00
Donald Sharp
f4d7bc0820
Merge pull request #5452 from mjstapp/fix_notify_nhg
zebra: align dplane notify processing with nhg work
2019-12-13 14:11:34 -05:00
Mark Stapp
1f6a5aca26 zebra: handle route notification with no nexthops
Handle the special case where a route update contains
no installed nexthops - that means the route is not
installed.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2019-12-12 12:55:51 -05:00
Donatas Abraitis
e7deb7e791 zebra: Print json output for show_route_summary_cmd
```
spine1-debian-9# sh ip route summary json
{
  "routes":[
    {
      "fib":1,
      "rib":1,
      "type":"kernel"
    },
    {
      "fib":11,
      "rib":11,
      "type":"connected"
    },
    {
      "fib":2,
      "rib":2,
      "type":"ebgp"
    },
    {
      "fib":1,
      "rib":1,
      "type":"ibgp"
    }
  ],
  "routesTotal":15,
  "routesTotalFib":15
}
spine1-debian-9# sh ipv6 route summary json
{
  "routes":[
    {
      "fib":7,
      "rib":7,
      "type":"connected"
    }
  ],
  "routesTotal":7,
  "routesTotalFib":7
}
```

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2019-12-12 17:20:11 +02:00
Donald Sharp
37f4c2fb02
Merge pull request #5494 from opensourcerouting/mlag-module
zebra: create zebra_cumulus_mlag module
2019-12-11 13:14:02 -05:00
Mark Stapp
4c0b5436f9 zebra: accept async notification for un-install
Handle an async notification when a route-update operation
uninstalls one route in favor of another.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2019-12-11 11:22:53 -05:00
Mark Stapp
c81c2303e6
Merge pull request #5497 from donaldsharp/unequality_ecmp
Unequality ecmp
2019-12-11 11:02:15 -05:00
David Lamparter
668b6011b3 zebra: fix sign-compare warning in cumulus mlag
This trips up the CI on Ubuntu 16.04.  (I guess the code wasn't getting
built there before...)

Signed-off-by: David Lamparter <equinox@diac24.net>
2019-12-11 11:41:54 +01:00
David Lamparter
d621815a0e zebra: create zebra_cumulus_mlag module
This is pretty much just to get rid of the HAVE_CUMULUS.  The
hook/module API is as "wtf" as it was before...

Signed-off-by: David Lamparter <equinox@diac24.net>
2019-12-11 11:40:47 +01:00
Donald Sharp
659a3e4288
Merge pull request #5517 from mjstapp/fix_evpn_state
zebra: use correct state when installing evpn macs
2019-12-10 17:14:34 -05:00
Mark Stapp
e1f3a8eb19 lib,zebra: add api to enforce nexthop sort order when copying
Add an api that creates a copy of a list of nexthops and
enforces the canonical sort ordering; consolidate some nhg
code to avoid copy-and-paste. The zebra dplane uses
that api when a plugin sets up a list of nexthops, ensuring
that the plugin's list is ordered when it's processed in
zebra.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2019-12-09 16:25:53 -05:00
Mark Stapp
1c30d64bb6 zebra: align dplane notify processing with nhg work
The processing of dataplane route notifications was a little
off-target after the nexthop-group re-work. This should allow
notifications to work better.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2019-12-09 16:19:14 -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
Donald Sharp
df7fb5800b lib, zebra: Allow for installation of a weighted nexthop
Linux has the idea of allowing a weight to be sent
down as part of a nexthop group to allow the kernel
to weight particular nexthop paths a bit more or less
than others.

See:
http://tldp.org/HOWTO/Adv-Routing-HOWTO/lartc.rpdb.multiple-links.html

Allow for installation into the kernel using the weight attribute
associated with the nexthop.

This code is foundational in that it just sets up the ability
to do this, we do not use it yet.  Further commits will
allow for the pass through of this data from upper level protocols.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-12-09 13:37:37 -05:00
Donald Sharp
4f63093247
Merge pull request #4765 from opensourcerouting/defaults-v2
lib/*: new config defaults system, v2
2019-12-06 14:07:42 -05:00
Donald Sharp
a44dcdee55
Merge pull request #5332 from mjstapp/remove_zapi_label_flag
*: revise zapi nexthop encoding
2019-12-06 13:19:34 -05:00
David Lamparter
0d26af1203
Merge pull request #5462 from dslicenc/ipv6-ra-lifetime-0
zebra: send RA lifetime of 0 before ceasing to advertise RAs
2019-12-06 18:23:39 +01: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
David Lamparter
1c0d880814 lib: rename memory_vty.c to lib_vty.c
And memory_init() to lib_cmd_init().

Signed-off-by: David Lamparter <equinox@diac24.net>
2019-12-06 15:13:29 +01:00
Mark Stapp
4dd9d11c87 zebra: use correct state when installing evpn macs
Use correct state/flags when installing EVPN macs; when we
converted from raw netlink to the zebra dataplane, a state value
got lost.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2019-12-05 14:27:17 -05:00
Mark Stapp
932dbb4deb zebra: capture dplane plugin flags
The flags can be important - like "threaded" - so we need to
actually capture them when plugins are registered.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2019-12-04 14:54:38 -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