if (afi == AFI_MAX)
return 0;
- if (is_zebra_valid_kernel_table(table_id))
+ if (is_zebra_valid_kernel_table(table_id) &&
+ table_id < ZEBRA_KERNEL_TABLE_MAX)
return zebra_import_table_used[afi][table_id];
return 0;
}
extern void rib_update(vrf_id_t, rib_update_event_t);
extern void rib_weed_tables(void);
extern void rib_sweep_route(void);
+extern void rib_sweep_table(struct route_table *);
extern void rib_close_table(struct route_table *);
extern void rib_init(void);
extern unsigned long rib_score_proto(u_char proto, u_short instance);
return cnt;
}
+void zebra_ns_sweep_route(void)
+{
+ struct zebra_ns_table *znst;
+ struct zebra_ns *zns;
+
+ zns = zebra_ns_lookup(NS_DEFAULT);
+
+ RB_FOREACH (znst, zebra_ns_table_head, &zns->ns_tables)
+ rib_sweep_table(znst->table);
+}
+
struct route_table *zebra_ns_get_table(struct zebra_ns *zns,
struct zebra_vrf *zvrf, uint32_t tableid,
afi_t afi)
int zebra_ns_config_write(struct vty *vty, struct ns *ns);
unsigned long zebra_ns_score_proto(u_char proto, u_short instance);
+void zebra_ns_sweep_route(void);
#endif
int is_zebra_valid_kernel_table(u_int32_t table_id)
{
- if ((table_id > ZEBRA_KERNEL_TABLE_MAX))
- return 0;
-
#ifdef linux
if ((table_id == RT_TABLE_UNSPEC) || (table_id == RT_TABLE_LOCAL)
|| (table_id == RT_TABLE_COMPAT))
}
/* Delete self installed routes after zebra is relaunched. */
-static void rib_sweep_table(struct route_table *table)
+void rib_sweep_table(struct route_table *table)
{
struct route_node *rn;
struct route_entry *re;
rib_sweep_table(zvrf->table[AFI_IP][SAFI_UNICAST]);
rib_sweep_table(zvrf->table[AFI_IP6][SAFI_UNICAST]);
}
+
+ zebra_ns_sweep_route();
}
/* Remove specific by protocol routes from 'table'. */