X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvnet%2Finterface_api.c;h=2cf6d9e4dcd2f25694eb892fa12c3d333ad69600;hb=eddd8e3588561039985b27edf059db6033bfdfab;hp=5b2f2fc0788713845cc32138258f4bb30444763b;hpb=455779f84e2883dcfad095e25132d0d74ec15bfc;p=vpp.git diff --git a/src/vnet/interface_api.c b/src/vnet/interface_api.c index 5b2f2fc0788..2cf6d9e4dcd 100644 --- a/src/vnet/interface_api.c +++ b/src/vnet/interface_api.c @@ -539,18 +539,15 @@ ip_table_bind (fib_protocol_t fproto, fib_index, ip6_main.fib_index_by_sw_if_index[sw_if_index]); - if (0 == table_id) - { - /* reset back to default */ - if (0 != ip6_main.fib_index_by_sw_if_index[sw_if_index]) - fib_table_unlock (ip6_main.fib_index_by_sw_if_index[sw_if_index], - FIB_PROTOCOL_IP6, src); - if (0 != ip6_main.mfib_index_by_sw_if_index[sw_if_index]) - mfib_table_unlock (ip6_main.mfib_index_by_sw_if_index - [sw_if_index], FIB_PROTOCOL_IP6, msrc); - - } - else + /* unlock currently assigned tables */ + if (0 != ip6_main.fib_index_by_sw_if_index[sw_if_index]) + fib_table_unlock (ip6_main.fib_index_by_sw_if_index[sw_if_index], + FIB_PROTOCOL_IP6, src); + if (0 != ip6_main.mfib_index_by_sw_if_index[sw_if_index]) + mfib_table_unlock (ip6_main.mfib_index_by_sw_if_index[sw_if_index], + FIB_PROTOCOL_IP6, msrc); + + if (0 != table_id) { /* we need to lock the table now it's inuse */ fib_table_lock (fib_index, FIB_PROTOCOL_IP6, src); @@ -590,18 +587,15 @@ ip_table_bind (fib_protocol_t fproto, fib_index, ip4_main.fib_index_by_sw_if_index[sw_if_index]); - if (0 == table_id) - { - /* reset back to default */ - if (0 != ip4_main.fib_index_by_sw_if_index[sw_if_index]) - fib_table_unlock (ip4_main.fib_index_by_sw_if_index[sw_if_index], - FIB_PROTOCOL_IP4, src); - if (0 != ip4_main.mfib_index_by_sw_if_index[sw_if_index]) - mfib_table_unlock (ip4_main.mfib_index_by_sw_if_index - [sw_if_index], FIB_PROTOCOL_IP4, msrc); + /* unlock currently assigned tables */ + if (0 != ip4_main.fib_index_by_sw_if_index[sw_if_index]) + fib_table_unlock (ip4_main.fib_index_by_sw_if_index[sw_if_index], + FIB_PROTOCOL_IP4, src); + if (0 != ip4_main.mfib_index_by_sw_if_index[sw_if_index]) + mfib_table_unlock (ip4_main.mfib_index_by_sw_if_index[sw_if_index], + FIB_PROTOCOL_IP4, msrc); - } - else + if (0 != table_id) { /* we need to lock the table now it's inuse */ fib_index = fib_table_find_or_create_and_lock (FIB_PROTOCOL_IP4,