X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvnet%2Fmfib%2Fmfib_table.c;h=7ffe8941e75fd46dc4565836329280f327c1fb71;hb=0f26c5a0138ac86d7ebd197c31a09d8d624c35fe;hp=e4c0936d6c9736559c45d94e4f154d7be6d7434d;hpb=32e1c010b0c34fd0984f7fc45fae648a182025c5;p=vpp.git diff --git a/src/vnet/mfib/mfib_table.c b/src/vnet/mfib/mfib_table.c index e4c0936d6c9..7ffe8941e75 100644 --- a/src/vnet/mfib/mfib_table.c +++ b/src/vnet/mfib/mfib_table.c @@ -165,6 +165,7 @@ fib_node_index_t mfib_table_entry_update (u32 fib_index, const mfib_prefix_t *prefix, mfib_source_t source, + fib_rpf_id_t rpf_id, mfib_entry_flags_t entry_flags) { fib_node_index_t mfib_entry_index; @@ -181,7 +182,8 @@ mfib_table_entry_update (u32 fib_index, * update to a non-existing entry with non-zero flags */ mfib_entry_index = mfib_entry_create(fib_index, source, - prefix, entry_flags); + prefix, rpf_id, + entry_flags); mfib_table_entry_insert(mfib_table, prefix, mfib_entry_index); } @@ -195,7 +197,11 @@ mfib_table_entry_update (u32 fib_index, { mfib_entry_lock(mfib_entry_index); - if (mfib_entry_update(mfib_entry_index, source, entry_flags)) + if (mfib_entry_update(mfib_entry_index, + source, + entry_flags, + rpf_id, + INDEX_INVALID)) { /* * this update means we can now remove the entry. @@ -227,6 +233,7 @@ mfib_table_entry_path_update (u32 fib_index, mfib_entry_index = mfib_entry_create(fib_index, source, prefix, + MFIB_RPF_ID_NONE, MFIB_ENTRY_FLAG_NONE); mfib_table_entry_insert(mfib_table, prefix, mfib_entry_index); @@ -283,6 +290,38 @@ mfib_table_entry_path_remove (u32 fib_index, } } +fib_node_index_t +mfib_table_entry_special_add (u32 fib_index, + const mfib_prefix_t *prefix, + mfib_source_t source, + mfib_entry_flags_t entry_flags, + index_t rep_dpo) +{ + fib_node_index_t mfib_entry_index; + mfib_table_t *mfib_table; + + mfib_table = mfib_table_get(fib_index, prefix->fp_proto); + mfib_entry_index = mfib_table_lookup_exact_match_i(mfib_table, prefix); + + if (FIB_NODE_INDEX_INVALID == mfib_entry_index) + { + mfib_entry_index = mfib_entry_create(fib_index, + source, + prefix, + MFIB_RPF_ID_NONE, + MFIB_ENTRY_FLAG_NONE); + + mfib_table_entry_insert(mfib_table, prefix, mfib_entry_index); + } + + mfib_entry_update(mfib_entry_index, source, + (MFIB_ENTRY_FLAG_EXCLUSIVE | entry_flags), + MFIB_RPF_ID_NONE, + rep_dpo); + + return (mfib_entry_index); +} + static void mfib_table_entry_delete_i (u32 fib_index, fib_node_index_t mfib_entry_index, @@ -456,6 +495,25 @@ mfib_table_lock (u32 fib_index, mfib_table->mft_locks++; } +void +mfib_table_walk (u32 fib_index, + fib_protocol_t proto, + mfib_table_walk_fn_t fn, + void *ctx) +{ + switch (proto) + { + case FIB_PROTOCOL_IP4: + ip4_mfib_table_walk(ip4_mfib_get(fib_index), fn, ctx); + break; + case FIB_PROTOCOL_IP6: + ip6_mfib_table_walk(ip6_mfib_get(fib_index), fn, ctx); + break; + case FIB_PROTOCOL_MPLS: + break; + } +} + u8* format_mfib_table_name (u8* s, va_list ap) {