summaryrefslogtreecommitdiffstats
path: root/staticd (follow)
Commit message (Collapse)AuthorAgeFilesLines
* *: Convert from ->interface_up to the interface callbackDonald Sharp2019-09-191-33/+9
| | | | | | | For all the places we have a zclient->interface_up convert them to use the interface ifp_up callback instead. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* *: Switch all zclient->interface_add to interface create callbackDonald Sharp2019-09-191-14/+2
| | | | | | | Switch the zclient->interface_add functionality to have everyone use the interface create callback in lib/if.c Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* *: Add infrastructure to support zapi interface callbacksDonald Sharp2019-09-191-0/+24
| | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Merge pull request #4722 from ak503/staticDonald Sharp2019-09-111-1/+2
|\ | | | | staticd: correct update static route when specify nexthop-vrf
| * staticd: correct update static route when specify nexthop-vrfDmitrii Turlupov2019-08-281-1/+2
| | | | | | | | Signed-off-by: Dmitrii Turlupov <dturlupov@factor-ts.ru>
* | staticd: static route config should fail if gw configured as its local ip.rgirada2019-09-072-1/+42
| | | | | | | | | | | | | | | | | | | | | | Fix: Added a check in staticd upon receiving nexthop update from zebra such that it will fail to resolve the nexthop if the connected address added as nexthop. But still allowing to add to staticd database and appears in running config. Throwing an warning massage to user if such misconfig issued. Signed-off-by: Rajesh Girada <rgirada@vmware.com>
* | staticd: Re-send/Remove routes on interface eventsStephen Worley2019-09-041-1/+7
| | | | | | | | | | | | | | | | We were not processing interface up/down events for device only static routes. This patch looks up the ifp and then calls the same API we are using for interface add/remove events. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
* | pbrd, sharpd, staticd: Add some color to sample configuration filesDonald Sharp2019-08-191-1/+3
| | | | | | | | | | | | | | | | The sample configuration files for pbrd, sharpd and staticd where all the same. Add some bit of color to help new people get rolling on these three daemons. Signed-off-by: Donald Sharp <sharpd@cumulusnetwork.com>
* | staticd: Fix blackhole routes being installedDonald Sharp2019-08-081-3/+21
| | | | | | | | | | | | | | | | | | | | | | When we are ready to install a route, we were treating blackhole routes as something that should be nexthop tracked which does not work as well as one would expect. Additionally add some test code to show that this actually fixes this issue. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* | staticd: Track state of where we are and limit installs/updates to minDonald Sharp2019-07-163-1/+121
| | | | | | | | | | | | | | | | Track the state of the route and how we have installed it or not. This commit limits the number of installs/updates/deletes to a minimum number instead of repeated sends to zebra. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* | static: Start state tracking to know what we think the route is doingDonald Sharp2019-07-161-0/+26
| | | | | | | | | | | | | | | | We need to track the state information in staticd of what we think the route is. Add the enum for this state and place it into the si. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* | staticd: Setup nexthop tracking instead of installing routeDonald Sharp2019-07-162-2/+7
| | | | | | | | | | | | | | | | | | | | Route installs should be handled by the setup of nexthop tracking instead of installing the route and then installing the nexthop tracking again ( and reinstalling the route ) This change makes routes be installed one time. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* | staticd: Fix static_nht_update to actually know route we are installingDonald Sharp2019-07-165-36/+70
|/ | | | | | | | | | | We are using static_nht_update in two different cases: 1) We have received a callback that a nexthop has changed and we need to find any static route that is using it and we must refigure it. 2) We have received a new static route that depends on a pre-existing nexthop, in which case we can go straight to the chase and just refigure that particular node, since we already have all the information we need. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* staticd: If we are told a nexthop has changed reinstall the route.Donald Sharp2019-06-241-12/+1
| | | | | | | If we are told that a dependant nexthop has changed, just reinstall the route. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* Revert "Ospf missing interface handling 2"Donald Sharp2019-06-242-10/+9
|
* *: change interface structure, from vrf_id to vrfPhilippe Guibert2019-06-121-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* *: change if_lookup_by_name() api with vrfPhilippe Guibert2019-06-122-7/+8
| | | | | | | | | | 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>
* staticd: strcpy -> strlcpyQuentin Young2019-05-291-1/+1
| | | | Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* lib: hashing functions should take const argumentsQuentin Young2019-05-141-2/+2
| | | | | | | | | | It doesn't make much sense for a hash function to modify its argument, so const the hash input. BGP does it in a couple places, those cast away the const. Not great but not any worse than it was. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* *: use ZAPI_CALLBACK_ARGS macro for zapi handlersQuentin Young2019-05-031-18/+10
| | | | | | | | | | | | This macro: - Marks ZAPI callbacks for readability - Standardizes argument names - Makes it simple to add ZAPI arguments in the future - Ensures proper types - Looks better - Shortens function declarations Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* staticd: Allow reinstall of static nexthops on vrf restartDonald Sharp2019-04-041-0/+1
| | | | | | | | | | When staticd receives notification that a vrf that it is using is back up into a state that can be used, go through and mark all the si data structures nexthops as not installed. This will allow us to complete the loop and reinstall routes that need to be fully resolved. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* staticd: Fix static routes that are not added in RIB after Null0 or vrf routesAdrian Ban2019-04-031-2/+2
| | | | | | | | | | | | | | When you add a static route like: ip route 10.0.0.0/24 Null0 ip route 192.168.7.0/24 99.99.99.99 nexthop-vrf EVA all routes after this command will be ignored by staticd and are not inserted in RIB. This is the cause of return instead of continue in the for loop in static_nht_update_safi() function that is stopping the search in the routes list and is returning in the previous function without calling static_zebra_route_add() function. This patch is fixing this issue. Signed-off-by: Adrian Ban <bugs@abtelcom.ro>
* *: remove null check before XFREEQuentin Young2019-02-261-24/+12
| | | | Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* build: fix a whole bunch of *FLAGSDavid Lamparter2019-01-301-1/+1
| | | | | | | | | - some target_CFLAGS that needed to include AM_CFLAGS didn't do so - libyang/sysrepo/sqlite3/confd CFLAGS + LIBS weren't used at all - consistently use $(FOO_CFLAGS) instead of @FOO_CFLAGS@ - 2 dependencies were missing for clippy Signed-off-by: David Lamparter <equinox@diac24.net>
* *: The onlink attribute should be owned by the nexthop not the route.Donald Sharp2019-01-271-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* lib: remove the vrf_is_mapped_on_netns() functionRenato Westphal2019-01-201-12/+12
| | | | | | | | | | | | | | | | | Now that all daemons receive the VRF backend from zebra, we can get rid of vrf_is_mapped_on_netns() in favor of using the more convenient vrf_is_backend_netns() function, which doesn't require any argument. This commit also fixes the following problem: debian(config)# ip route 50.0.0.0/8 blackhole vrf FAKE table 2 % table param only available when running on netns-based vrfs Even when zebra was started with the --vrfwnetns, the error above would be displayed since the VRF FAKE didn't exist, which would make vrf_is_mapped_on_netns() return 0 incorrectly. Using vrf_is_backend_netns() this problem doesn't happen anymore. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* staticd: Fix nht to include SAFI_MULTICASTDonald Sharp2019-01-041-37/+46
| | | | | | | | | | | | | | | | | | | | | | | | The nexthop tracking was correctly registering the nexthops in the SAFI_UNICAST table, but we need to apply them to the SAFI_MULTICAST mroute information( if any ) as well. donna.cumulusnetworks.com# conf t donna.cumulusnetworks.com(config)# ip mroute 230.0.4.0/24 192.168.210.50 donna.cumulusnetworks.com(config)# end donna.cumulusnetworks.com# show ip rpf Codes: K - kernel route, C - connected, S - static, R - RIP, O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP, T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP, F - PBR, f - OpenFabric, > - selected route, * - FIB route C>* 10.0.2.0/24 is directly connected, enp0s3, 00:08:28 C>* 192.168.209.0/24 is directly connected, enp0s8, 00:08:28 C>* 192.168.210.0/24 is directly connected, enp0s9, 00:08:28 S>* 230.0.4.0/24 [1/0] via 192.168.210.50, enp0s9, 00:07:56 S>* 230.0.5.0/24 [1/0] via 192.168.210.50, enp0s9, 00:07:17 Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* staticd: Do not ready prefix for printing till it's decodedDonald Sharp2018-12-291-2/+2
| | | | | | | | The static daemon is setting up the prefix for printing before it is decoded when we get notified about our route. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* staticd: fix static analysis warningsRenato Westphal2018-12-071-4/+4
| | | | Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* staticd: fix null0 routes (again)Quentin Young2018-11-221-20/+48
| | | | | | | | Think we got it all this time. Null0 is shown as a CLI option, and any capitalization of Null0 (such as null0, nuLl0, etc) is accepted to mean Null0. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* Merge pull request #3311 from dslicenc/static-int-upDavid Lamparter2018-11-193-4/+72
|\ | | | | staticd: install static routes in a vrf when next-hop interface comes up
| * staticd: remove stale header info in static_fixup_intf_nhDon Slice2018-11-121-1/+0
| | | | | | | | Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
| * staticd: install static routes in a vrf when next-hop interface comes upDon Slice2018-11-123-4/+73
| | | | | | | | | | | | | | | | | | Problem reported with cross-vrf static routes that the routes weren't installed when the target interface is bounced. Determined that we did not initiate re-install of the statics in that particular case, so added it. Test case previously failing now passes. Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
* | *: Replace zclient_new with zclient_new_notifyDonald Sharp2018-11-121-1/+1
|/ | | | | | | It's been a year since we added the new optional parameters to instantiation. Let's switch over to the new name. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* *: add empty array of YANG modulesRenato Westphal2018-10-271-1/+5
| | | | | | | | | | FRR_DAEMON_INFO should now contain an array of 'frr_yang_module_info' structures describing the YANG modules implemented by the daemon. This array will be used by frr_init() function to load all YANG modules and initialize the northbound callbacks during the daemon initialization. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* Merge pull request #3227 from qlyoung/fix-exit-vrf-placement-upstreamDavid Lamparter2018-10-261-1/+1
|\ | | | | vtysh: fix exit-vrf printing
| * vtysh: fix exit-vrf printingQuentin Young2018-10-241-1/+1
| | | | | | | | | | | | | | | | Resolves issue with exit-vrf being placed at the end of zebra's portion of a vrf block, but before other daemons' portions of the same config block. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* | staticd: finish missing onlink piecesQuentin Young2018-10-241-3/+9
|/ | | | | | | Missed a cherry-pick somewhere, `onlink` was never actually displayed in the config although it could be configured. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* *: Replace hash_cmp function return value to a boolDonald Sharp2018-10-191-2/+2
| | | | | | | | | The ->hash_cmp and linked list ->cmp functions were sometimes being used interchangeably and this really is not a good thing. So let's modify the hash_cmp function pointer to return a boolean and convert everything to use the new syntax. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* staticd: add ability to create onlink static routeQuentin Young2018-10-164-33/+55
| | | | Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* staticd: Allow table_id to be a distinguisher for installationDonald Sharp2018-09-141-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The table_id should be a discriminator in the installation of static routes into zebra from staticd. Add this to allow the end user to do something like this: ip route 4.5.6.7/32 192.168.209.44 ip route 4.5.6.7/32 192.168.209.44 table 3000 ip route 4.5.6.7/32 192.168.209.45 table 3000 robot# show ip route Codes: K - kernel route, C - connected, S - static, R - RIP, O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP, T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP, F - PBR, f - OpenFabric, > - selected route, * - FIB route K>* 0.0.0.0/0 [0/101] via 192.168.201.1, enp0s3, 00:01:40 S>* 4.3.2.1/32 [1/0] via 192.168.210.4, enp0s10, 00:01:35 S>* 4.3.2.2/32 [1/0] via 192.168.209.4, enp0s9, 00:01:35 S>* 4.5.6.0/26 [1/0] via 192.168.210.4, enp0s10, 00:01:35 S>* 4.5.6.7/32 [1/0] via 192.168.209.44, enp0s9, 00:01:35 C>* 192.168.201.0/24 is directly connected, enp0s3, 00:01:40 C>* 192.168.208.0/24 is directly connected, enp0s8, 00:01:40 C>* 192.168.209.0/24 is directly connected, enp0s9, 00:01:40 C>* 192.168.210.0/24 is directly connected, enp0s10, 00:01:40 robot# show ip route table 3000 Codes: K - kernel route, C - connected, S - static, R - RIP, O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP, T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP, F - PBR, f - OpenFabric, > - selected route, * - FIB route S>* 4.5.6.7/32 [1/0] via 192.168.209.44, enp0s9, 00:00:55 * via 192.168.209.45, enp0s9, 00:00:55 robot# Fixes: #2954 Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* build: fix not building docs w/o sphinxDavid Lamparter2018-09-091-1/+1
| | | | | | Can't build manpages without sphinx-build, oops... Signed-off-by: David Lamparter <equinox@diac24.net>
* Merge pull request #2862 from opensourcerouting/non-recursiveDonald Sharp2018-09-091-0/+2
|\ | | | | final non-recursive make
| * build: move vtysh & manpage listings to subdir.amDavid Lamparter2018-09-081-0/+2
| | | | | | | | | | | | | | Since we're now building through one large Makefile, we can easily put things with their daemons and crossreference nicely. Signed-off-by: David Lamparter <equinox@diac24.net>
* | *: fix clang-6 SA warningsDavid Lamparter2018-09-081-2/+2
|/ | | | | | | I don't see these in CI, but my local clang-6 does emit warnings for these. Signed-off-by: David Lamparter <equinox@diac24.net>
* staticd: Fix 'show debug static" commandDonald Sharp2018-09-071-0/+14
| | | | | | | | 'show debugging' is returning a Command incomplete error message as that it is being sent to staticd and staticd has no knowledge of it, fix this. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* static: Put vty_frame around vrf output in staticd.Donald Sharp2018-08-311-0/+6
| | | | Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* staticd: Fix mixup in vrf translationsDonald Sharp2018-08-312-33/+55
| | | | | | | | | | | | | When we store the nexthop for ref-counting, keep track of the nexthop vrf_id as well. This will allow us to track the nexthop per vrf! Additionally when we get the callback from zebra about a nexthop update, iterate over all static routes to see if the nexthop we are getting a callback is one we are concerned about. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* *: add a vrf update hook to be informed of the vrf namePhilippe Guibert2018-08-281-1/+1
| | | | | | | | The Vrf aliases can be known with a specific hook. That hook will then, from zebra propagate the information to the relevant zapi clients. The registration hook function is the same for all daemons. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
* staticd: refcount the nht add/removalDonald Sharp2018-08-251-2/+90
| | | | | | | | | | | | | When we add / remove a nexthop that we need to track, keep track of the number of times we have done this for each nexthop. Consequently keep track of the number of available nexthops, so that we can just install new routes when we get one that uses a pre-existing nexthop. Deletion of nexthops is done on refcount going to 0. Removal of routes is handled elsewhere for removal. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>