summaryrefslogtreecommitdiffstats
path: root/nhrpd/nhrp_main.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* nhrpd: Fix clang SA about null derefDonald Sharp2021-02-141-2/+7
| | | | | | | | Clang was complaining when running SA that the nhrpd_privs.change function was null. It just does not fully understand how things are setup. Add a assert to make it happy. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* lib: fix crashes with leafrefs that point to non-implemented modulesRenato Westphal2020-09-111-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Whenever libyang loads a module that contains a leafref, it will also implicitly load the module of the referring node if it's not loaded already. That makes sense as otherwise it wouldn't be possible to validate the leafref value correctly. The problem is that loading a module implicitly violates the assumption of the northbound layer that all loaded modules are implemented (i.e. they have a northbound node associated to each schema node). This means that loading a module that isn't implemented can lead to crashes as the "priv" pointer of schema nodes is no longer guaranteed to be valid. To fix this problem, add a few null checks to ignore data nodes associated to non-implemented modules. The side effect of this change is harmless. If a daemon receives configuration it doesn't support (e.g. BFD peers on staticd), that configuration will be stored but otherwise ignored. This can only happen when using a northbound client like gRPC, as the CLI will never send to a daemon a command it doesn't support. This minor problem should go away in the long run as FRR migrates to a centralized management model, at which point the YANG-modeled configuration of all daemons will be maintained in a single place. Finally, update some daemons to stop implementing YANG modules they don't need to (i.e. revert 1b741a01c and a74b47f5). Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* nhrpd: add frr-vrf to the list of implemented yang modulesDonald Sharp2020-09-111-0/+1
| | | | | | | | | | | PR #6376 introduced a VRF leafref in the frr-interface YANG module. That change exposed a bug in the northbound layer that is causing nhrpd to crash under certain circumstances. Even though nhrpd wasn't converted to the new northbound model yet, make it implement the frr-vrf module in order to work around this problem. This is a temporary fix until a better solution is available. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* *: integrate remaining daemons with filterRafael Zalamena2020-06-051-0/+2
| | | | | | | Don't crash when trying to `show running-config` because of missing filter northbound integration. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
* lib: rename memory_vty.c to lib_vty.cDavid Lamparter2019-12-061-1/+0
| | | | | | And memory_init() to lib_cmd_init(). Signed-off-by: David Lamparter <equinox@diac24.net>
* *: make frr_yang_module_info constDavid Lamparter2019-11-301-1/+1
| | | | Signed-off-by: David Lamparter <equinox@diac24.net>
* *: Add infrastructure to support zapi interface callbacksDonald Sharp2019-09-191-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | 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>
* lib: split off c-ares code from nhrpdDavid Lamparter2019-07-031-1/+1
| | | | | | This is useful in other places too, e.g. for BMP outbound connections. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* lib: ZEBRA_NUM_OF -> array_sizeDavid Lamparter2019-04-181-1/+1
| | | | | | The latter is widely used, e.g. in the Linux kernel. Signed-off-by: David Lamparter <equinox@diac24.net>
* yang, lib: add 'frr-interface.yang' and associated stub callbacksRenato Westphal2018-10-271-0/+1
| | | | | | | | | | | | | Introduce frr-interface.yang, which defines a model for managing FRR interfaces. Update the 'frr_yang_module_info' array of all daemons that will implement this module. Add automatically generated stub callbacks in if.c. These callbacks will be implemented in the following commit. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* *: 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>
* *: fix config.h/zebra.h include orderDavid Lamparter2018-09-081-0/+4
| | | | | | | | config.h (or, transitively, zebra.h) must be the first include file listed for autoconf things like _GNU_SOURCE and _POSIX_C_SOURCE to work correctly. Signed-off-by: David Lamparter <equinox@diac24.net>
* *: 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>
* nhrpd: Add NHRP_ERR_XXXX for zlog_err to zlog_ferr conversionDonald Sharp2018-08-141-0/+2
| | | | Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* *: conform with COMMUNITY.md formatting rules, via 'make indent'Lou Berger2018-03-061-18/+23
| | | | Signed-off-by: Lou Berger <lberger@labn.net>
* nhrpd: Let struct zebra_privs_t be availableDonald Sharp2017-10-241-1/+1
| | | | signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* *: centralize some exit cleanup into libfrrDavid Lamparter2017-08-151-7/+2
| | | | | | | | Start creating a counterpart to frr_init and frr_late_init. Unfortunately, some daemons don't do any exit handling, this doesn't change that just yet. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* nhrp: initialize interfaces after VRFsJorge Boncompte2017-08-041-1/+1
| | | | | | | Interfaces depend logically of VRF, initialize one after another just in case in the future someone adds something to this functions. Signed-off-by: Jorge Boncompte <jbonor@gmail.com>
* *: Consolidate vrf_hooks into vrf_initDonald Sharp2017-05-161-1/+1
| | | | | | | | We only needed to add/change the vrf callbacks when we initialize the vrf subsystem. As such it is not necessary to handle the callbacks in any other way than through the init function. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* Fix the wrong user/group for nhrpd.Hung-Weic Chiu2017-05-021-5/+3
| | | | | | - Modify the defince from quagga to frr Signed-off-by: Hung-Weic Chiu <sppsorrg@gmail.com>
* lib: remove remaining struct zlog * argsDavid Lamparter2017-03-081-2/+2
| | | | | | These don't serve any purpose either. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* *: add frr_run()David Lamparter2017-03-081-11/+1
| | | | | | | Contains the fetch-and-run-thread logic, and vty startup (which is the last thing happening before entering the main loop). Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* *: add frr_config_fork()David Lamparter2017-03-081-42/+3
| | | | | | | | | Centralise read_config/daemonize/dryrun/pidfile/vty_serv into libfrr. This also makes multi-instance pid/config handling available as part of the library. It's only wired up in ospfd, but the code is in lib/. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* *: centralize more into frr_init()David Lamparter2017-03-071-3/+0
| | | | | | Move CLI/VTY/Memory accounting init into frr_* Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* *: add frr_init() infrastructureDavid Lamparter2017-03-071-68/+25
| | | | | | | | | Start centralising startup & option parsing into the library. FRR_DAEMON_INFO is a bit weird, but it will become useful later (e.g. for killing the ZLOG_* enum, and having the daemon name available) Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* nhrpd: adapt to API changesDavid Lamparter2017-03-071-4/+7
| | | | Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* nhrpd: implement next hop resolution protocolTimo Teräs2017-03-071-0/+246
This provides DMVPN support and integrates to strongSwan. Please read README.nhrpd and README.kernel for more details. [DL: cherry-picked from dafa05e65fe4b3b3ed5525443f554215ba14f42c] [DL: merge partially resolved, this commit will not build.] Signed-off-by: Timo Teräs <timo.teras@iki.fi> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>