summaryrefslogtreecommitdiffstats
path: root/ripd/rip_main.c
diff options
context:
space:
mode:
authorRenato Westphal <renato@opensourcerouting.org>2019-01-04 22:08:10 +0100
committerRenato Westphal <renato@opensourcerouting.org>2019-01-18 19:15:41 +0100
commitae7b826a2338aa1cc61019fa74391da1c3ceb542 (patch)
tree6a2456b96aad0aeb182525e14c865ca9f6ba13dd /ripd/rip_main.c
parentripd: failure to create a socket shouldn't be a fatal error (diff)
downloadfrr-ae7b826a2338aa1cc61019fa74391da1c3ceb542.tar.xz
frr-ae7b826a2338aa1cc61019fa74391da1c3ceb542.zip
ripd: add VRF support
* Turn the "instance" YANG presence-container into a YANG list keyed by the new "vrf" leaf. This is a backward incompatible change but this should be ok for now. * RIP VRF instances can be configured even when the corresponding VRF doesn't exist. And a RIP VRF instance isn't deleted when the corresponding VRF is deleted. For this to work, implement the rip_instance_enable() and rip_instance_disable() functions that are called to enable/disable RIP routing instances when necessary. A RIP routing instance can be enabled only when the corresponding VRF is enabled (this information comes from zebra and depends on the underlying VRF backend). Routing instances are stored in the new rip_instances rb-tree (global variable). * Add a vrf pointer to the rip structure instead of storing vrf_id only. This is much more convenient than using vrf_lookup_by_id() every time we need to get the vrf pointer from the VRF ID. The rip->vrf pointer is updated whenever the VRF enable/disable hooks are called. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
Diffstat (limited to 'ripd/rip_main.c')
-rw-r--r--ripd/rip_main.c17
1 files changed, 4 insertions, 13 deletions
diff --git a/ripd/rip_main.c b/ripd/rip_main.c
index 46babe2e0..8b6e3a620 100644
--- a/ripd/rip_main.c
+++ b/ripd/rip_main.c
@@ -46,7 +46,7 @@
static struct option longopts[] = {{"retain", no_argument, NULL, 'r'}, {0}};
/* ripd privileges */
-zebra_capabilities_t _caps_p[] = {ZCAP_NET_RAW, ZCAP_BIND};
+zebra_capabilities_t _caps_p[] = {ZCAP_NET_RAW, ZCAP_BIND, ZCAP_SYS_ADMIN};
struct zebra_privs_t ripd_privs = {
#if defined(FRR_USER)
@@ -59,7 +59,7 @@ struct zebra_privs_t ripd_privs = {
.vty_group = VTY_GROUP,
#endif
.caps_p = _caps_p,
- .cap_num_p = 2,
+ .cap_num_p = array_size(_caps_p),
.cap_num_i = 0};
/* Master of threads. */
@@ -79,18 +79,9 @@ static void sighup(void)
/* SIGINT handler. */
static void sigint(void)
{
- struct vrf *vrf;
-
zlog_notice("Terminating on signal");
- RB_FOREACH (vrf, vrf_id_head, &vrfs_by_id) {
- struct rip *rip;
-
- rip = vrf->info;
- if (rip)
- rip_clean(rip);
- }
-
+ rip_vrf_terminate();
rip_zclient_stop();
frr_fini();
@@ -179,7 +170,7 @@ int main(int argc, char **argv)
/* Library initialization. */
rip_error_init();
keychain_init();
- vrf_init(NULL, NULL, NULL, NULL, NULL);
+ rip_vrf_init();
/* RIP related initialization. */
rip_init();