diff options
author | Neale Ranns <nranns@cisco.com> | 2017-10-13 02:43:33 -0700 |
---|---|---|
committer | Florin Coras <florin.coras@gmail.com> | 2017-10-13 23:43:35 +0000 |
commit | f9342023c19887da656133e2688a90d70383b0c5 (patch) | |
tree | ce87af209b57e2210276f6b5cebedc1ec69fdf8e /src/vnet/interface_api.c | |
parent | 69cce166535e138e66d0a95f1cfe6a3591489e10 (diff) |
Enforce FIB table creation before use
last i the serise of the use of the FIB table create/delete API. VPP now forces the tables to have been explicitly creted before they are used.
Change-Id: Ifde3b1bbb76697a01ab71bce4f5264e6d1725467
Signed-off-by: Neale Ranns <nranns@cisco.com>
Diffstat (limited to 'src/vnet/interface_api.c')
-rw-r--r-- | src/vnet/interface_api.c | 43 |
1 files changed, 8 insertions, 35 deletions
diff --git a/src/vnet/interface_api.c b/src/vnet/interface_api.c index c19f0a84297..ee13135f086 100644 --- a/src/vnet/interface_api.c +++ b/src/vnet/interface_api.c @@ -365,6 +365,14 @@ ip_table_bind (fib_protocol_t fproto, fib_source_t src; mfib_source_t msrc; + fib_index = fib_table_find (fproto, table_id); + mfib_index = mfib_table_find (fproto, table_id); + + if (~0 == fib_index || ~0 == mfib_index) + { + return (VNET_API_ERROR_NO_SUCH_FIB); + } + if (is_api) { src = FIB_SOURCE_API; @@ -376,32 +384,6 @@ ip_table_bind (fib_protocol_t fproto, msrc = MFIB_SOURCE_CLI; } - /* - * This is temporary whilst I do the song and dance with the CSIT version - */ - if (0 != table_id) - { - fib_index = fib_table_find_or_create_and_lock (fproto, table_id, src); - mfib_index = - mfib_table_find_or_create_and_lock (fproto, table_id, msrc); - } - else - { - fib_index = 0; - mfib_index = 0; - } - - /* - * This if table does not exist = error is what we want in the end. - */ - /* fib_index = fib_table_find (fproto, table_id); */ - /* mfib_index = mfib_table_find (fproto, table_id); */ - - /* if (~0 == fib_index || ~0 == mfib_index) */ - /* { */ - /* return (VNET_API_ERROR_NO_SUCH_FIB); */ - /* } */ - if (FIB_PROTOCOL_IP6 == fproto) { /* @@ -508,15 +490,6 @@ ip_table_bind (fib_protocol_t fproto, ip4_main.mfib_index_by_sw_if_index[sw_if_index] = mfib_index; } - /* - * Temporary. undo the locks from the find and create at the staart - */ - if (0 != table_id) - { - fib_table_unlock (fib_index, fproto, src); - mfib_table_unlock (mfib_index, fproto, msrc); - } - return (0); } |