#include "zebra_pbr.h"
#include "zebra_vxlan.h"
#include "zebra_mlag.h"
+#include "zebra_nhg.h"
+#include "debug.h"
-struct zebra_router zrouter;
+DEFINE_MTYPE_STATIC(ZEBRA, RIB_TABLE_INFO, "RIB table info")
+
+struct zebra_router zrouter = {
+ .multipath_num = MULTIPATH_NUM,
+ .ipv4_multicast_mode = MCAST_NO_CONFIG,
+};
static inline int
zebra_router_table_entry_compare(const struct zebra_router_table *e1,
return zrt->table;
}
-unsigned long zebra_router_score_proto(uint8_t proto, unsigned short instance)
-{
- struct zebra_router_table *zrt;
- unsigned long cnt = 0;
-
- RB_FOREACH (zrt, zebra_router_table_head, &zrouter.tables) {
- if (zrt->ns_id != NS_DEFAULT)
- continue;
- cnt += rib_score_proto_table(proto, instance, zrt->table);
- }
- return cnt;
-}
-
void zebra_router_show_table_summary(struct vty *vty)
{
struct zebra_router_table *zrt;
}
}
+void zebra_router_sweep_nhgs(void)
+{
+ zebra_nhg_sweep_table(zrouter.nhgs_id);
+}
+
static void zebra_router_free_table(struct zebra_router_table *zrt)
{
void *table_info;
memory_order_relaxed);
}
+void multicast_mode_ipv4_set(enum multicast_mode mode)
+{
+ if (IS_ZEBRA_DEBUG_RIB)
+ zlog_debug("%s: multicast lookup mode set (%d)", __func__,
+ mode);
+ zrouter.ipv4_multicast_mode = mode;
+}
+
+enum multicast_mode multicast_mode_ipv4_get(void)
+{
+ return zrouter.ipv4_multicast_mode;
+}
+
void zebra_router_terminate(void)
{
struct zebra_router_table *zrt, *tmp;
zebra_vxlan_disable();
zebra_mlag_terminate();
+ hash_clean(zrouter.nhgs, zebra_nhg_hash_free);
+ hash_free(zrouter.nhgs);
+ hash_clean(zrouter.nhgs_id, NULL);
+ hash_free(zrouter.nhgs_id);
+
hash_clean(zrouter.rules_hash, zebra_pbr_rules_free);
hash_free(zrouter.rules_hash);
zrouter.packets_to_process = ZEBRA_ZAPI_PACKETS_TO_PROCESS;
+ zrouter.rtadv_sock = -1;
+
zebra_vxlan_init();
zebra_mlag_init();
zrouter.iptable_hash = hash_create_size(8, zebra_pbr_iptable_hash_key,
zebra_pbr_iptable_hash_equal,
"IPtable Hash Entry");
+
+ zrouter.nhgs =
+ hash_create_size(8, zebra_nhg_hash_key, zebra_nhg_hash_equal,
+ "Zebra Router Nexthop Groups");
+ zrouter.nhgs_id =
+ hash_create_size(8, zebra_nhg_id_key, zebra_nhg_hash_id_equal,
+ "Zebra Router Nexthop Groups ID index");
}