From 032bfaaf28f919b029835cd600ad12000ad77498 Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Tue, 27 Sep 2016 15:57:56 +0000 Subject: [PATCH] zebra: "ip import-table" display is hosed Signed-off-by: Daniel Walton Reviewed-by: Don Slice Ticket: CM-13020 Now that we have evpn we have the following AFIs /* Address family numbers from RFC1700. */ typedef enum { AFI_IP = 1, AFI_IP6 = 2, AFI_ETHER = 3, /* RFC 1700 has "6" for 802.* */ AFI_MAX = 4 } afi_t; The import-table code was treating the afi as a flag which was fine before when the only choices were 1 and 2 but now that we have #3 that doesn't work. The fix is to change zebra_import_table_used to a [AFI_MAX][ZEBRA_KERNEL_TABLE_MAX] array to track if import-table is enabled. --- zebra/redistribute.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/zebra/redistribute.c b/zebra/redistribute.c index 4e7538327f..6f91c94f7e 100644 --- a/zebra/redistribute.c +++ b/zebra/redistribute.c @@ -46,20 +46,14 @@ /* array holding redistribute info about table redistribution */ /* bit AFI is set if that AFI is redistributing routes from this table */ -static u_char zebra_import_table_used[ZEBRA_KERNEL_TABLE_MAX]; +static int zebra_import_table_used[AFI_MAX][ZEBRA_KERNEL_TABLE_MAX]; static u_int32_t zebra_import_table_distance[AFI_MAX][ZEBRA_KERNEL_TABLE_MAX]; int is_zebra_import_table_enabled(afi_t afi, u_int32_t table_id) { if (is_zebra_valid_kernel_table(table_id)) - { - if (CHECK_FLAG(zebra_import_table_used[table_id], (u_char)afi)) - return 1; - else - return 0; - } - + return zebra_import_table_used[afi][table_id]; return 0; } @@ -672,12 +666,12 @@ zebra_import_table (afi_t afi, u_int32_t table_id, u_int32_t distance, const cha zebra_del_import_table_route_map (afi, table_id); } - SET_FLAG(zebra_import_table_used[table_id], afi); + zebra_import_table_used[afi][table_id] = 1; zebra_import_table_distance[afi][table_id] = distance; } else { - UNSET_FLAG(zebra_import_table_used[table_id], (u_char)afi); + zebra_import_table_used[afi][table_id] = 0; zebra_import_table_distance[afi][table_id] = ZEBRA_TABLE_DISTANCE_DEFAULT; rmap_name = zebra_get_import_table_route_map (afi, table_id); @@ -721,7 +715,7 @@ zebra_import_table_config (struct vty *vty) int i; afi_t afi; int write = 0; - char afi_str[AFI_MAX][6] = {"", "ip", "ipv6"}; + char afi_str[AFI_MAX][10] = {"", "ip", "ipv6", "ethernet"}; const char *rmap_name; for (afi = AFI_IP; afi < AFI_MAX; afi++) -- 2.39.5