NAT44: active-passive HA (VPP-1571)
[vpp.git] / src / plugins / gbp / gbp_route_domain.c
index c030ee5..6a3f4fa 100644 (file)
@@ -15,6 +15,7 @@
 
 #include <plugins/gbp/gbp_route_domain.h>
 #include <plugins/gbp/gbp_endpoint.h>
+#include <plugins/gbp/gbp_sclass.h>
 
 #include <vnet/dpo/dvr_dpo.h>
 #include <vnet/fib/fib_table.h>
@@ -62,6 +63,12 @@ vlib_log_class_t grd_logger;
 #define GBP_BD_DBG(...)                           \
     vlib_log_debug (grd_logger, __VA_ARGS__);
 
+index_t
+gbp_route_domain_index (const gbp_route_domain_t * grd)
+{
+  return (grd - gbp_route_domain_pool);
+}
+
 gbp_route_domain_t *
 gbp_route_domain_get (index_t i)
 {
@@ -176,6 +183,8 @@ gbp_route_domain_add_and_lock (u32 rd_id,
                                             &ADJ_BCAST_ADDR,
                                             grd->grd_uu_sw_if_index[fproto],
                                             rewrite);
+
+           gbp_sclass_enable_ip (grd->grd_uu_sw_if_index[fproto]);
          }
        else
          {
@@ -217,6 +226,8 @@ gbp_route_domain_unlock (index_t index)
                          fproto, FIB_SOURCE_PLUGIN_HI);
        if (INDEX_INVALID != grd->grd_adj[fproto])
          adj_unlock (grd->grd_adj[fproto]);
+       if (~0 != grd->grd_uu_sw_if_index[fproto])
+         gbp_sclass_disable_ip (grd->grd_uu_sw_if_index[fproto]);
       }
 
       gbp_route_domain_db_remove (grd);
@@ -225,6 +236,16 @@ gbp_route_domain_unlock (index_t index)
     }
 }
 
+u32
+gbp_route_domain_get_rd_id (index_t grdi)
+{
+  gbp_route_domain_t *grd;
+
+  grd = gbp_route_domain_get (grdi);
+
+  return (grd->grd_id);
+}
+
 int
 gbp_route_domain_delete (u32 rd_id)
 {