]> git.proxmox.com Git - mirror_frr.git/commitdiff
staticd: register to interface events related with non default vrf
authorPhilippe Guibert <philippe.guibert@6wind.com>
Mon, 26 Aug 2019 11:36:16 +0000 (13:36 +0200)
committerPhilippe Guibert <philippe.guibert@6wind.com>
Tue, 17 Sep 2019 15:30:48 +0000 (17:30 +0200)
in addition to non default vrf, once a new vrf is available, the static
daemon registers to events from that vrf, including presence of
interfaces. this permits to create static route with nexthop=interface.
Reversely, an unregistration is scheduled too when vrf disappears.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
staticd/static_vrf.c
staticd/static_zebra.c
staticd/static_zebra.h

index 9dd25fbdd1316f19685e9f6a35a7cf66006514fc..abb64aad3f34b04641afe654c1f92b3eb6953ea5 100644 (file)
@@ -27,6 +27,7 @@
 #include "static_memory.h"
 #include "static_vrf.h"
 #include "static_routes.h"
+#include "static_zebra.h"
 #include "static_vty.h"
 
 static void zebra_stable_node_cleanup(struct route_table *table,
@@ -76,6 +77,8 @@ static int static_vrf_new(struct vrf *vrf)
 
 static int static_vrf_enable(struct vrf *vrf)
 {
+       static_zebra_vrf_register(vrf);
+
        static_fixup_vrf_ids(vrf->info);
 
        /*
@@ -89,6 +92,7 @@ static int static_vrf_enable(struct vrf *vrf)
 
 static int static_vrf_disable(struct vrf *vrf)
 {
+       static_zebra_vrf_unregister(vrf);
        return 0;
 }
 
index 1965c2968ef3deea29cd3c1820ca5e0b10a862b7..2944cdad326dda1c8b9c54fda973da6874fdbe9b 100644 (file)
@@ -526,3 +526,17 @@ void static_zebra_init(void)
                                      static_nht_hash_cmp,
                                      "Static Nexthop Tracking hash");
 }
+
+void static_zebra_vrf_register(struct vrf *vrf)
+{
+       if (vrf->vrf_id == VRF_DEFAULT)
+               return;
+       zclient_send_reg_requests(zclient, vrf->vrf_id);
+}
+
+void static_zebra_vrf_unregister(struct vrf *vrf)
+{
+       if (vrf->vrf_id == VRF_DEFAULT)
+               return;
+       zclient_send_dereg_requests(zclient, vrf->vrf_id);
+}
index 15f5410b812a77fe7c1c5cec0f09b8b17bbfed43..962dc3908fa9e05fb00b756a9967a788cc701d9d 100644 (file)
@@ -28,4 +28,7 @@ extern void static_zebra_route_add(struct route_node *rn,
                                   struct static_route *si_changed,
                                   vrf_id_t vrf_id, safi_t safi, bool install);
 extern void static_zebra_init(void);
+extern void static_zebra_vrf_register(struct vrf *vrf);
+extern void static_zebra_vrf_unregister(struct vrf *vrf);
+
 #endif