Commit Graph

387 Commits

Author SHA1 Message Date
Donatas Abraitis
2dbe669bdf :* Convert prefix2str to %pFX
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-10-22 09:07:41 +03:00
Donald Sharp
cae8bc967c *: Remove solaris from FRR
The Solaris code has gone through a deprecation cycle.  No-one
has said anything to us and worse of all we don't have any test
systems running Solaris to know if we are making changes that
are breaking on Solaris.  Remove it from the system so
we can clean up a bit.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2020-09-21 10:02:20 -04:00
Philippe Guibert
d0738ba2bb zebra: display interface slave type
interface slave type is displayed.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2020-08-18 09:25:06 -07:00
Anuradha Karuppiah
ce5160c081 zebra: Ethernet segment management and support for MAC-ECMP
1. Local ethernet segments are configured in zebra by attaching a
local-es-id and sys-mac to a access interface -
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
!
interface hostbond1
 evpn mh es-id 1
 evpn mh es-sys-mac 00:00:00:00:01:11
!
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
This info is then sent to BGP and used for the generation of EAD-per-ES
routes.

2. Access VLANs associated with an (ES) access port are translated into
ES-EVI objects and sent to BGP. This is used by BGP for the
generation of EAD-EVI routes.

3. Remote ESs are imported by BGP and sent to zebra. A list of VTEPs
is maintained per-remote ES in zebra. This list is used for the creation
of the L2-NHG that is used for forwarding traffic.

4. MAC entries with a non-zero ESI destination use the L2-NHG associated
with the ESI for forwarding traffic over the VxLAN overlay.

Please see zebra_evpn_mh.h for the datastruct organization details.

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-08-05 06:46:12 -07:00
Pat Ruddy
bd23c84036 evpn-netns: Revert PR5077, has been re-worked post-refactor
Revert "zebra: support for macvlan interfaces"

This reverts commit bf69e212fd.

Revert "doc: add some documentation about bgp evpn netns support"

This reverts commit 89b97c33d7.

Revert "zebra: dynamically detect vxlan link interfaces in other netns"

This reverts commit de0ebb2540.

Revert "bgpd: sanity check when updating nexthop from bgp to zebra"

This reverts commit ee9633ed87.

Revert "lib, zebra: reuse and adapt ns_list walk functionality"

This reverts commit c4d466c830.

Revert "zebra: local mac entries populated in correct netnamespace"

This reverts commit 4042454891.

Revert "zebra: when parsing local entry against dad, retrieve config"

This reverts commit 3acc394bc5.

Revert "bgpd: evpn nexthop can be changed by default"

This reverts commit a2342a2412.

Revert "zebra: zvni_map_to_vlan() adaptation for all namespaces"

This reverts commit db81d18647.

Revert "zebra: add ns_id attribute to mac structure"

This reverts commit 388d5b438e.

Revert "zebra: bridge layer2 information records ns_id where bridge is"

This reverts commit b5b453a2d6.

Revert "zebra, lib: new API to get absolute netns val from relative netns val"

This reverts commit b6ebab34f6.

Revert "zebra, lib: store relative default ns id in each namespace"

This reverts commit 9d3555e06c.

Revert "zebra, lib: add an internal API to get relative default nsid in other ns"

This reverts commit 97c9e7533b.

Revert "zebra: map vxlan interface to bridge interface with correct ns id"

This reverts commit 7c990878f2.

Revert "zebra: fdb and neighbor table are read for all zns"

This reverts commit f8ed2c5420.

Revert "zebra: zvni_map_to_svi() adaptation for other network namespaces"

This reverts commit 2a9dccb647.

Revert "zebra: display interface slave type"

This reverts commit fc3141393a.

Revert "zebra: zvni_from_svi() adaptation for other network namespaces"

This reverts commit 6fe516bd4b.

Revert "zebra: importation of bgp evpn rt5 from vni with other netns"

This reverts commit 28254125d0.

Revert "lib, zebra: update interface name at netlink creation"

This reverts commit 1f7a68a2ff.

Signed-off-by: Pat Ruddy <pat@voltanet.io>
2020-08-05 06:46:12 -07:00
David Lamparter
3efd0893d0 *: un-split strings across lines
Remove mid-string line breaks, cf. workflow doc:

  .. [#tool_style_conflicts] For example, lines over 80 characters are allowed
     for text strings to make it possible to search the code for them: please
     see `Linux kernel style (breaking long lines and strings)
     <https://www.kernel.org/doc/html/v4.10/process/coding-style.html#breaking-long-lines-and-strings>`_
     and `Issue #1794 <https://github.com/FRRouting/frr/issues/1794>`_.

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

Signed-off-by: David Lamparter <equinox@diac24.net>
2020-07-14 10:37:25 +02:00
Igor Ryzhov
a2719d0e88 zebra: show interfaces from all VRFs in "show interface ..." commands
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2020-06-22 10:09:35 +03:00
Philippe Guibert
fc3141393a zebra: display interface slave type
interface slave type is displayed.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2020-05-18 14:11:03 +02:00
Philippe Guibert
14ddb3d9c4 zebra: across network namespace, vxlan remembers the link information
the link information of vxlan interface is populated in layer 2
information, as well as in layer 2 vxlan information. This information
will be used later to collect vnis that are in other network namespaces,
but where bgp evpn is enabled on main network namespaces, and those vnis
have the link information in that namespace.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2020-05-18 14:11:03 +02:00
Donatas Abraitis
b34b48cb3a
Merge pull request #6231 from dslicenc/v6-ra-hoplimit
zebra: add ability to set hoplimit for IPv6 RAs
2020-04-18 22:48:20 +03:00
Donald Sharp
a83014ccd6
Merge pull request #6247 from FRRouting/nb_conversions
Merge nb_converions branch to master
2020-04-16 19:39:14 -04:00
Chirag Shah
09268680bb zebra: add northbound support for zebra interface
Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2020-04-16 08:51:38 -07:00
David Lamparter
f4b8291fcb *: move CLI node names to cmd_node->name
And again for the name.  Why on earth would we centralize this, just so
people can forget to update it?

Signed-off-by: David Lamparter <equinox@diac24.net>
2020-04-16 12:53:59 +02:00
David Lamparter
243895805a *: move CLI parent data to cmd_node->parent_node
Same as before, instead of shoving this into a big central list we can
just put the parent node in cmd_node.

Signed-off-by: David Lamparter <equinox@diac24.net>
2020-04-16 12:53:00 +02:00
David Lamparter
612c2c15d8 *: remove second parameter on install_node()
There is really no reason to not put this in the cmd_node.

And while we're add it, rename from pointless ".func" to ".config_write".

[v2: fix forgotten ldpd config_write]

Signed-off-by: David Lamparter <equinox@diac24.net>
2020-04-16 12:53:00 +02:00
David Lamparter
249a771b63 *: remove cmd_node->vtysh
The only nodes that have this as 0 don't have a "->func" anyway, so the
entire thing is really just pointless.

Signed-off-by: David Lamparter <equinox@diac24.net>
2020-04-16 12:53:00 +02:00
David Lamparter
62b346eefa *: clean up cmd_node initializers
... and use named assignments everywhere (so I can change the struct.)

Signed-off-by: David Lamparter <equinox@diac24.net>
2020-04-16 12:53:00 +02:00
Don Slice
fae01935bb zebra: add ability to set hoplimit for IPv6 RAs
Reported by testing agency that rfc 4861 section 6.2.1 states
that all implementations must have a configuration knob to change
the setting of the advertised hop limit.  This fix adds that
capability.

Ticket: CM-29200
Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
2020-04-15 17:56:57 +00: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
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
752022670a *: Remove break after return
Just a deadcode.

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-02-13 15:39:54 +02:00
Don Slice
d7fc0e677e zebra: send RA lifetime of 0 before ceasing to advertise RAs
Problem reported by testing agency that RFC4861 section 6.2.5
states that a router should send an RA with a lifetime of 0
before ceasing to send RAs on the interface, or when the interace
is shutdown, or the router is shutdown.  This fix adds that capability.

Ticket: CM-27061
Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
2019-12-03 15:46:34 +00:00
Philippe Guibert
dd90b4c86a
Merge pull request #4977 from chiragshah6/evpn_dev1
* evpn primary address advertisement
2019-11-26 17:56:59 +01:00
Don Slice
adee8f2164 zebra: knob to make ra retransmit interval rfc compliant
Problem reported by testing facility that our sending of Router
Advertisements more frequently than once very three seconds is not
compliant with rfc4861. Added a knob to turn off fast retransmits
in order to meet the requirement of the RFC.

Ticket: CM-27063
Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
2019-11-22 18:40:20 +00:00
Chirag Shah
0056f687d7 zebra: evpn pip mac vlan up-down event
macvlan interface up/down event triggers
bgp to send updates for evpn routes
with changed RMAC and nexthop IP values.

Ticket:CM-26190
Reviewed By:
Testing Done:

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2019-11-22 07:53:33 -08:00
Donald Sharp
f609709a58 lib, ospfd, zebra: Convert interface_delete to take double pointer
When free'ing the interface pointer, set it to NULL.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-11-02 16:13:44 -04:00
Donald Sharp
721c08573a *: Convert connected_free to a double pointer
Set the connected pointer to set the pointer to NULL.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-11-02 16:13:44 -04:00
Stephen Worley
80286aa564 zebra: Re-work zebra_nhg_*_valid APIs
Re-work the validity setting and checking APIs
for nhg_hash_entry's to make them clearer.

Further, they were originally only beings set
on ifdown and install. Extended their use into
releasing entries and to account for setting
the validity of a recursive dependent.

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2019-10-25 11:13:44 -04:00
Stephen Worley
fec211ad95 zebra: Zebra nexthop group re-work checkpatch fixes
Checkpatch fixes for the zebra nexthop group re-work.

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2019-10-25 11:13:43 -04:00
Stephen Worley
37c6708b93 zebra: Switch nhg_connected to use new RB tree
Switch the nhg_connected tree structures to use the new
RB tree API in `lib/typerb.h`. We were using the openbsd-tree
implementation before.

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2019-10-25 11:13:41 -04:00
Stephen Worley
1e9aad82ba zebra: Add cli show NHE by ID and interface groups
Add cli to show nhg_hash_entry's by ID.

Add cli to show nhg_hash_entry info for interfaces and remove
just listing ID's in `show interface *`

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2019-10-25 11:13:40 -04:00
Stephen Worley
e22e80010e zebra: Use a nhe context dataplane and rib metaq
We will use a nhe context for dataplane interaction with
nextho group hash entries.

New nhe's from the kernel will be put into a group array
if they are a group and queued on the rib metaq to be processed
later.

New nhe's sent to the kernel will be set on the dataplane context
with approprate ID's in the group array if needed.

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2019-10-25 11:13:40 -04:00
Stephen Worley
f862383fc9 zebra: Add interface down marking to NHE's
Add functionality to allow an interface down event to mark
any dependent NHE's as invalid.

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2019-10-25 11:13:39 -04:00
Stephen Worley
fe593b781d zebra: Re-organize/expose nhg_connected
Re-organize and expose the nhg_connected functions so that
it can be used outside zebra_nhg.c. And then abstract those
into zebra_nhg_depends_* and zebra_nhg_depenents_* functons.

Switch the ifp struct to use an RB tree for its dependents,
making use of the nhg_connected functions.

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2019-10-25 11:13:39 -04:00
Stephen Worley
2614bf8764 zebra: Add ifp to zebra-side rib_add
Add an interface pointer for an nexthop group hash entry
when we are getting a rib_add for a new route.

Also, add the interface index to the `show nexthop-group` command.

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2019-10-25 11:13:37 -04:00
Stephen Worley
602fea614f zebra: Add nexthop hash entry list to zebra interface info
Add a nexthop hash entry list to the local zebra
interface info for each interface. This will allow
us to modify nexthops on link events.

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2019-10-25 11:13:37 -04:00
Russ White
9898a2fb34
Merge pull request #5009 from donaldsharp/interface_deletion
lib, zebra: Allow for interface deletion when kernel event happens
2019-09-30 07:46:19 -04:00
Donald Sharp
75a5d867a1
Merge pull request #5051 from idryzhov/fix-vrf-autocomplete
*: fix missing VRF autocompletions
2019-09-25 15:27:55 -04:00
Mark Stapp
dd38ed3502
Merge pull request #5055 from pguibert6WIND/fix_memory_leak_with_delete_interface
zebra: fix memory leak
2019-09-25 10:03:26 -04:00
Philippe Guibert
fc341a9791 zebra: fix memory leak
the if_lookup_by_name_per_ns keeps a lock on the node where the
searched ifp is stored. Then this node can not be freed even if
the ifp is removed from the node. Just add the missing unlock
(as for the if_lookup_by_index_per_ns lookup function)

Fixes: b8af3fbbaf ("zebra: fix detection of interface renames")
Signed-off-by: Thibaut Collet <thibaut.collet@6wind.com>
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2019-09-25 08:51:06 +02:00
Igor Ryzhov
e429a2a0cc *: fix missing VRF autocompletions
Current autocompletion works only for simple "vrf NAME" case.

This commit expands it also for the following cases:
- "nexthop-vrf NAME" in staticd
- usage of $varname in many daemons

All daemons are updated to use single varname "$vrf_name".

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2019-09-24 19:51:46 +03:00
Russ White
8db933928f
Merge pull request #4959 from pguibert6WIND/zebra_inform_layer
zebra: inform upper layer error when reading correct speed interface
2019-09-24 11:46:13 -04:00
Donald Sharp
138c5a7450 *: Add infrastructure to support zapi interface callbacks
Start the conversion to allow zapi interface callbacks to be
controlled like vrf creation/destruction/change callbacks.

This will allow us to consolidate control into the interface.c
instead of having each daemon read the stream and react accordingly.
This will hopefully reduce a bunch of cut-n-paste stuff

Create 4 new callback functions that will be controlled by
lib/if.c

create -> A upper level protocol receives an interface creation event
The ifp is brand spanking newly created in the system.
up -> A upper level protocol receives a interface up event
This means the interface is up and ready to go.
down -> A upper level protocol receives a interface down
destroy -> A upper level protocol receives a destroy event
This means to delete the pointers associated with it.

At this point this is just boilerplate setup for future commits.
There is no new functionality.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-09-19 13:34:06 -04:00
Donald Sharp
1d311a05c9 lib, zebra: Allow for interface deletion when kernel event happens
When zebra gets a callback from the kernel that an interface has
actually been deleted *and* the end users has not configured
the interface, then allow for deletion of the interface from zebra.

This is especially important in a docker environment where containers
and their veth interfaces are treated as ephermeal.  FRR can quickly
have an inordinate amount of interfaces sitting around that are
not in the kernel and we have no way to clean them up either.

My expectation is that this will cause a second order crashes
in upper level protocols, but I am not sure how to catch these
and fix them now ( suggestions welcome ).  There are too many
use patterns and order based events that I cannot know for certain
that we are going to see any at all, until someone sees this problem
as a crash :(  I do not recommend that this be put in the current
stabilization branch and allow this to soak in master for some time
first.

Testing:

sharpd@donna ~/frr4> sudo ip link add vethdj type veth peer name vethjd
sharpd@donna ~/frr4> sudo ip link add vethaa type veth peer name vethab
sharpd@donna ~/frr4> sudo vtysh -c "show int brief"
Interface       Status  VRF             Addresses
---------       ------  ---             ---------
dummy1          down    default
enp0s3          up      default         10.0.2.15/24
enp0s8          up      default         192.168.209.2/24
enp0s9          up      default         192.168.210.2/24
enp0s10         up      default         192.168.212.4/24
lo              up      default         10.22.89.38/32
vethaa          down    default
vethab          down    default
vethdj          down    default
vethjd          down    default
virbr0          up      default         192.168.122.1/24
virbr0-nic      down    default

sharpd@donna ~/frr4> sudo ip link set vethaa up
sharpd@donna ~/frr4> sudo ip link set vethab up
sharpd@donna ~/frr4> sudo ip link del vethdj
sharpd@donna ~/frr4> sudo vtysh -c "show int brief"
Interface       Status  VRF             Addresses
---------       ------  ---             ---------
dummy1          down    default
enp0s3          up      default         10.0.2.15/24
enp0s8          up      default         192.168.209.2/24
enp0s9          up      default         192.168.210.2/24
enp0s10         up      default         192.168.212.4/24
lo              up      default         10.22.89.38/32
vethaa          up      default
vethab          up      default
virbr0          up      default         192.168.122.1/24
virbr0-nic      down    default

sharpd@donna ~/frr4> sudo ip link del vethaa
sharpd@donna ~/frr4> sudo vtysh -c "show int brief"
Interface       Status  VRF             Addresses
---------       ------  ---             ---------
dummy1          down    default
enp0s3          up      default         10.0.2.15/24
enp0s8          up      default         192.168.209.2/24
enp0s9          up      default         192.168.210.2/24
enp0s10         up      default         192.168.212.4/24
lo              up      default         10.22.89.38/32
virbr0          up      default         192.168.122.1/24
virbr0-nic      down    default

sharpd@donna ~/frr4> sudo ip link add vethaa type veth peer name vethab
sharpd@donna ~/frr4> sudo vtysh -c "show int brief"
Interface       Status  VRF             Addresses
---------       ------  ---             ---------
dummy1          down    default
enp0s3          up      default         10.0.2.15/24
enp0s8          up      default         192.168.209.2/24
enp0s9          up      default         192.168.210.2/24
enp0s10         up      default         192.168.212.4/24
lo              up      default         10.22.89.38/32
vethaa          down    default
vethab          down    default
virbr0          up      default         192.168.122.1/24
virbr0-nic      down    default

sharpd@donna ~/frr4> sudo vtysh -c "show run"
Building configuration...

Current configuration:
!
frr version 7.2-dev
frr defaults datacenter
hostname donna.cumulusnetworks.com
log stdout
no ipv6 forwarding
!
ip route 192.168.3.0/24 192.168.209.1
ip route 192.168.4.0/24 blackhole
ip route 192.168.5.0/24 192.168.209.1
ip route 192.168.6.0/24 192.168.209.1
ip route 192.168.7.0/24 99.99.99.99 nexthop-vrf EVA
ip route 192.168.8.0/24 192.168.209.1
ip route 4.5.6.7/32 12.13.14.15
!
interface dummy1
 ip address 12.13.14.15/32
!
interface vethaa
 description FROO
!
line vty
!
end
sharpd@donna ~/frr4> sudo ip link del vethaa
sharpd@donna ~/frr4> sudo vtysh -c "show int brief"
Interface       Status  VRF             Addresses
---------       ------  ---             ---------
dummy1          down    default
enp0s3          up      default         10.0.2.15/24
enp0s8          up      default         192.168.209.2/24
enp0s9          up      default         192.168.210.2/24
enp0s10         up      default         192.168.212.4/24
lo              up      default         10.22.89.38/32
vethaa          down    default
virbr0          up      default         192.168.122.1/24
virbr0-nic      down    default

sharpd@donna ~/frr4> sudo vtysh -c "show run"
Building configuration...

Current configuration:
!
frr version 7.2-dev
frr defaults datacenter
hostname donna.cumulusnetworks.com
log stdout
no ipv6 forwarding
!
ip route 192.168.3.0/24 192.168.209.1
ip route 192.168.4.0/24 blackhole
ip route 192.168.5.0/24 192.168.209.1
ip route 192.168.6.0/24 192.168.209.1
ip route 192.168.7.0/24 99.99.99.99 nexthop-vrf EVA
ip route 192.168.8.0/24 192.168.209.1
ip route 4.5.6.7/32 12.13.14.15
!
interface dummy1
 ip address 12.13.14.15/32
!
interface vethaa
 description FROO
!
line vty
!
end

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-09-19 13:34:06 -04:00
vdhingra
14a4d9d047 Zebra: Rectifying the log messages.
This change addresses the following :
1. Ensures zlog_debug should be under DEBUG macro check
2. Ensures zlog_err and zlog_warn wherever applicable.
3. Removed few posivite logs from fpm handling, whose frequency is high.

Signed-off-by: vishaldhingra <vdhingra@vmware.com>
2019-09-19 02:59:04 -07:00
Julien Floret
594c287816 zebra: inform upper layer error when reading correct speed interface
speed interface is done 15 seconds after interface creation. during that
time, the vrf or the interface may have disappeared. to protect this,
return an error in case it is not possible to create a vrf socket or it
is not possible to get speed of an interface because of a missing
device.

Signed-off-by: Julien Floret <julien.floret@6wind.com>
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2019-09-17 18:38:42 +02:00
Donald Sharp
dec2a1469f
Merge pull request #4812 from pogojotz/fix-destination-multi-use
zebra: Do not use connection dest for bcast
2019-08-26 09:25:17 -04:00
Juergen Werner
0f3af7386e zebra: Do not use connection dest for bcast
The `destination` field of the connection structure was used to store
the broadcast address, if the connection was not p2p. This multipurpose
is not very evident and the benefits over calculating the bcast address
on the fly minimal.

Signed-off-by: Juergen Werner <juergen@opensourcerouting.org>
2019-08-18 18:54:46 +02:00
Dinesh G Dutt
eb4a93fb09 zebra: Display master interface names, not ifindices
When displaying the master interface's information in "show interface",
    the display is currently the ifindex of the master interface. Make it
    display the name as well as that is more useful than the name.

    Signed-off-by: Dinesh G Dutt<5016467+ddutt@users.noreply.github.com>
2019-08-13 16:28:16 +00:00
Donald Sharp
b5046a3c50 zebra: Remove repeated enqueueing of system routes for rethinking
The code as written before this code change point would enqueue
every system route type to be refigured when we have an
interface event.  I believe this was to originally handle bugs
in the way nexthop tracking was handled, mainly that if you keep
asking the question you'll eventually get the right answer.

Modify the code to not do this, we have fixed nexthop tracking
to not be so brain dead and to know when it needs to refigure
a route that it is tracking.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-07-29 11:39:06 -04:00
Donald Sharp
8f08b1cc31 zebra: Modify way we query for inteface speed
Initial commit of understanding interface speed changes
on startup was this commit:

dc7b3caefb

Effectively we had encountered situations on system startup
where the interface speed for a device was not properly setup
when zebra learns about the interface ( Imagine a bond being
brought up and the controlling software creating the bond
is not fast given system load, the bond's speed changes
upwards for each interface added ).

The initial workup on this was to allow a 15 second window
and then just reread the interface speed.  We've since noticed
that under heavy system load on startup this is not always sufficient.

So modify the code to wait the 15 seconds and then check the interfaces
speed.  If the interfaces speed is still MAX_UINT32T or it has changed
let's wait a bit longer and try again.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-07-13 15:42:41 -04:00
Donald Sharp
a36898e755
Revert "Ospf missing interface handling 2" 2019-06-23 19:46:39 -04:00
Donald Sharp
a12bb225a6
Merge pull request #3775 from pguibert6WIND/ospf_missing_interface_handling_2
Ospf missing interface handling 2
2019-06-22 13:35:45 -04:00
Don Slice
a5c7809c8b zebra: add ability to "show interface vrf all brief"
Found that the "show interface brief" command was missing the
ability to specify all vrfs.   Added that capability via this
fix.

Ticket: CM-25139
Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
2019-06-17 17:18:53 +00:00
David Lamparter
7e5cfaea0a zebra: fix stats printing formats
Signed-off-by: David Lamparter <equinox@diac24.net>
2019-06-12 19:35:43 +02: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
da85f5e038 lib, bgpd, ospfd, pimd, zebra, rip, ripng, bfd: change if_update_to_new_vrf() api
vrf_id parameter is replaced with struct vrf * parameter. It is
needed to create vrf structure before entering in the fuction.
an error is generated in case the vrf parameter is missing.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2019-06-12 08:37:58 +02:00
Philippe Guibert
8205b1b455 zebra, lib: upon entering interface, create vrf context
the interface search is based on vrfs. As at startup, some interfaces
may be configured, there is need to have vrfs contexts present. A macro
is being appended with an extra parameter that permits create a vrf and
return the context. This macro is also used by some show routines, but
will not create vrfs, because that extra parameter will be set to false,
on that case.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2019-06-12 08:37:58 +02:00
Philippe Guibert
ac6c2a11a6 lib: create interface upon accessing interface NB API.
Upon accessing interface NB API, the interface is created, if the vrf
is available. the commit does not change the behaviour, since at this
commit, this is not yet possible to have vrf contexts, while zebra did
not connect to daemons. However, that commit adds some work, so that it
will be possible to work on a vrf context, without having the vrf_id
completely resolved. for instance, if we suppose a vrf is created by
command 'vrf TOTO' in the starting configuration of a daemon, then 'interface
TITI vrf TOTO' will permit to create interface TITI within vrf TOTO.

the macro VRF_GET_INSTANCE will return the vrf context, if available or
not.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2019-06-12 08:37:58 +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
Quentin Young
d8d78e2ca9 zebra: gracefully fail to protodown on bsd
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
Donald Sharp
ba5165eccc zebra: Modify how we display/store os description
The alias/description of an interface in linux was being
used to override the internal description.  As such let's
fix the display to keep track of both if we have it.

Config in FRR:
!
interface docker0
 description another combination
!
interface enp3s0
 description BAMBOOZLE ME WILL YOU
!

Config in linux:
sharpd@robot ~/f/zebra> ip link show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    alias This is the loopback you cabbage
2: enp3s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
    link/ether 74:d0:2b:9c:16:eb brd ff:ff:ff:ff:ff:ff
    alias HI HI HI

Now the 'show int descr' command:
robot# show int description
Interface       Status  Protocol  Description
docker0         up      down      another combination
enp3s0          up      up        BAMBOOZLE ME WILL YOU
                                  HI HI HI
lo              up      up        This is the loopback you cabbage

Fixes: #4191
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-04-25 04:22:43 -04:00
Donald Sharp
8f19bc1c69
Merge pull request #3786 from mjstapp/dplane_intf
zebra: async interface address programming
2019-04-22 15:29:02 -04:00
Mark Stapp
0f1f6ce4d6 zebra: Dplane interface address install for non-netlink
ioctl-based platform code for interface address installation

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2019-04-22 13:49:27 -04:00
Mark Stapp
6416880328 zebra: Use dplane for interface addresses (netlink)
Start using the dataplane for interface-address programming,
on netlink platforms. Other platforms just stubbed at this
point.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2019-04-22 13:49:27 -04:00
Anuradha Karuppiah
aa0677b4b6 zebra: use "mcast group" instead of just mcast in show and logs
Fixup done in response to Jafar's review comments.

root@act-7726-03:~# vtysh -c  "show interface vxlan1000111"
Interface vxlan1000111 is up, line protocol is up
  Link ups:       0    last: (never)
  Link downs:     0    last: (never)
  PTM status: disabled
  vrf: default
  index 95 metric 0 mtu 1500 speed 0
  flags: <UP,BROADCAST,RUNNING,MULTICAST>
  Type: Ethernet
  HWaddr: 7e:1d:c1:d5:d1:cc
  Interface Type Vxlan
  VxLAN Id 1000111 VTEP IP: 6.0.0.28 Access VLAN Id 111
  Mcast Group 239.1.1.111 >>>>>>>>>>
  Master (bridge) ifindex 99
root@act-7726-03:~#

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2019-04-21 07:24:20 -07:00
Anuradha Karuppiah
d7fe235c1b zebra: process mcast-grp rxed in the vxlan-device
BUP mcast IP address is maintained per-vxlan-device.

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2019-04-20 08:33:19 -07:00
David Lamparter
0fe29323f5
Merge pull request #3723 from slrz/zebra-rtadv-add-rfc8106-support
zebra: add support for IPv6 RA options for DNS configuration (RFC8106)
2019-02-12 14:30:00 +01:00
Lars Seipel
3eb4fbb0f5 zebra: support DNS configuration options in rtadv
Add support for the RDNSS and DNSSL router advertisement
options described in RFC 8106.

Signed-off-by: Lars Seipel <ls@slrz.net>
2019-02-02 19:10:19 +01:00
Donald Sharp
3801e7646c zebra: Move the master thread handler to the zrouter structure
The master thread handler is really part of the zrouter structure.
So let's move it over to that.  Eventually zserv.h will only be
used for zapi messages.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-01-31 09:20:46 -05:00
David Lamparter
185fd9ca77
Merge pull request #3288 from nitinsoniism/show_intf_brief
zebra: Support "brief" output for "show interface"
2019-01-29 16:23:36 +01:00
Nitin Soni
49548752e1 zebra: Support "brief" output for "show interface"
"brief" output for "show interface" helps when we have to quickly check
important information like ip address, vrf etc. This prints
information in the easy to read tabular format. Currently it prints oper
status, ifname, vrf, ipv4 and ipv6 addresses.

Ticket: CM-9109
Signed-off-by: Nitin Soni <nsoni@cumulusnetworks.com>
2019-01-08 02:19:58 -08:00
David Lamparter
d482ae5912
Merge pull request #3326 from qlyoung/fix-lla-reinstallation
zebra: force neighbor entry reinstallation
2018-11-15 14:58:51 +01:00
Quentin Young
2b6aabe067 zebra: force neighbor entry reinstallation
Even if the neighbor entry we want already exists, force its
reinstallation to ensure that it's valid. This will now take place when
we request an update of the neighbor entry.

Ticket: CM-22604
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-10-28 11:22:23 +00:00
Dinesh Dutt
b9368db98c zebra: Let zebra know about bond and blond slave intf types
The interface type can be a bond or a bond slave, add some
code to note this and to display it as part of a show interface
command.

Signed-off-by: Dinesh Dutt <didutt@gmail.com>
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-11-12 11:40:33 -05: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
David Lamparter
6a154c8812 *: list_delete_and_null() -> list_delete()
Signed-off-by: David Lamparter <equinox@diac24.net>
2018-10-02 11:40:52 +02:00
Russ White
82977e243a
Merge pull request #3020 from donaldsharp/global_5549
Allow v6 global addresses to be nexthops for v4 addresses in bgp
2018-09-24 09:55:50 -04:00
Donald Sharp
8e59a4027f zebra: Use actual memory type for zebra info pointer
Use MTYPE_ZINFO for the `struct zebra_if` data structure
instead of using MTYPE_TMP.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-09-19 11:35:43 -04:00
Donald Sharp
ee98d1f11c zebra: Abstract mac neigh installation into it's own function
Abstract the mac neigh installation for 169.254.0.1 into
it's own function that we can pass the mac address into.
This will allow a future commit to use this functionality
when we have the appropriate mac address from reading
optional attributes of a RA packet.

Signed-off-by: Donald Sharp <sharpd@cumuusnetworks.com>
2018-09-19 11:25:22 -04:00
Donald Sharp
98efddf1d7 zebra: Cleanup comments to appropriately match style
The block comments from a couple commits were not following
proper style.  Fix.

Fix SA warning that had snuck in.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-09-18 10:44:59 -04:00
Anuradha Karuppiah
520ebf72b2 zebra: resolve link dependencies post nldump
Netdevices are not sorted in any fashion by the kernel during the initial
interface nldump. So you can get an upper device (such as an SVI) before
its corresponding lower device (bridge).

To fix this problem we skip resolving link dependencies during handling of
nldump notifications. Resolving instead at the end (when all the devices
are present)

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>

Ticket: CM-22388, CM-21796
Reviewed By: CCR-7845
Testing Done:
1. verified on a setup with missing linkages
2. automation - evpn-min
2018-09-18 10:41:53 -04:00
David Lamparter
2fa3198399
Merge pull request #3023 from qlyoung/ultimate-warning-reference-cards-rename
warning reference cards rename
2018-09-14 17:35:58 +02:00
Quentin Young
450971aa99 *: LIB_[ERR|WARN] -> EC_LIB
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-09-13 19:34:28 +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
F. Aragon
7fe96307ee
bgpd lib ospf6d pbrd tests zebra: shadowing fixes
This fixes all remaining local variable shadowing cases

Signed-off-by: F. Aragon <paco@voltanet.io>
2018-09-13 17:37:08 +02:00
David Lamparter
e991eff5b5 Merge remote-tracking branch 'frr/master' into warnings
Conflicts:
	zebra/if_ioctl_solaris.c
	zebra/rtread_getmsg.c

Signed-off-by: David Lamparter <equinox@diac24.net>
2018-09-12 21:58:39 +02:00
Russ White
88f47ef365
Merge pull request #2944 from thbtcllt/master
fix zebra crash when a vrf interface changes with netns implementation for vrf
2018-09-11 11:33:27 -04: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
Thibaut Collet
c3568c4d1a zebra/lib: code cleaning
Remove useless parenthesis and explicit cast.
Remove redundant code.

Signed-off-by: Thibaut Collet <thibaut.collet@6wind.com>
2018-09-06 07:48:12 +02:00
Thibaut Collet
ee2f2c23ca zebra: fix crash when interface vrf changes
This crash occurs only with netns implementation.
vrf meaning is different regarging its implementation (netns or
vrf-lite)

- With vrf-lite implementation vrf is a property of the interface that
  can be changed as the speed or the state (iproute2 command: "ip link
  set dev IF_NAME master VRF_NAME"). All interfaces of the system are in
  the same netns and so interface name is unique.
- With netns implementation vrf is a characteristic of the interface
  that CANNOT be changed: it is the id of the netns where the interface
  is located. To change the vrf of an interface (iproute2 command to
  move an interface "ip netns exec VRF_NAME1 ip link set dev IF_NAME
  netns VRF_NAME2") the interface is deleted from the old vrf and
  created in the new vrf.
  Interface name is not unique, the same name can be present in the
  different netns (typically the lo interface) and search of interface
  must be done by the tuple (interface name, netns id).

Current tests on the vrf implementation (vrf-lite or netns) are not
sufficient. In some cases (for example when an interface is moved from
a vrf X to the default vrf and then move back to VRF X) we can have a
corruption message and then a crash of zebra.

To avoid this corruption test on the vrf implementation, needed when an
interface changes, has been rewritten:
- For all interface changes except deletion the if_get_by_name function,
  that checks if an interface exists and creates or updates it if
  needed, is changed:
    * The vrf-lite implementation is unchanged: search of the interface
      is based only on the name and update the vrf-id if needed.
    * The netns implementation search of the interface is based on the
      (name, vrf-id) tuple and interface is created if not found, the
      vrf-id is never updated.
- deletion of an interface (reception of a RTM_DELLINK netlink message):
    * The vrf-lite implementation is unchanged: the interface
      information are cleared and the interface is moved to the default
      vrf if it does not belong to (to allow vrf deletion)
    * The netns implementation is changed: only the interface
      information are cleared and the interface stays in its vrf to
      avoid conflict with interface with the same name in the default
      vrf.

This implementation reverts (partially or totally):
commit 393ec5424e ("zebra: fix missing node attribute set in ifp")
commit e9e9b1150f ("lib: create interface even if name is the same")
commit 9373219c67 ("zebra: improve logs when replacing interface to an
other netns")
Fixes: b53686c52a ("zebra: delete interface that disappeared")

Signed-off-by: Thibaut Collet <thibaut.collet@6wind.com>
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-08-30 14:37:59 +02:00
Philippe Guibert
0e4864eaf0 zebra: do not update link if interface is veth interface
when interface is a virtual ethernet interface, then there is no need to
update link pointer of interface.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-08-29 11:34:08 +02:00
Philippe Guibert
680c278fb8 zebra: when veth link is used across vrf, the link may not be good
This function is changed so that the interface index is searched across
the correct namespace.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-08-27 17:03:22 +02: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
Donald Sharp
4d43f68aeb lib, zebra: Add LIB_ERR_INTERFACE
Add a error type that allows us to track bad interface states.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-08-14 20:02:05 +00:00
Donald Sharp
9f2982ab69 zebra: Remove zebra_static.c and .h
These are no longer needed so remove.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-07-29 12:37:26 -04:00
Donald Sharp
7e24fdf333 staticd: Start the addition of a staticd
This is the start of separating out the static
handling code from zebra -> staticd.  This will
help simplify the zebra code and isolate static
route handling to it's own code base.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-07-29 12:37:24 -04:00
Nathan Van Gheem
ec1db5882d lib,zebra: fix json output when vrf1 when not active
When I did a show ip route with `json` on a vrf when it didn't exist,
frr would output invalid json.

Signed-off-by: Nathan Van Gheem <nathan@cumulusnetworks.com>
2018-07-27 10:17:03 -04:00
Don Slice
65a6617b64 zebra: re-install static routes needed vrf when the vrf intf comes up
Problem reported that if the vrf device is taken down and then brought
back up, any static route referencing that vrf device was not
re-installed.  This fix runs back thru the static routes that
reference the vrf device coming up and re-install them.

Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
2018-06-18 11:38:45 +00:00