FIB table add/delete API
part 2;
- this adds the code to create an IP and MPLS table via the API.
- but the enforcement that the table must be created before it is used is still missing, this is so that CSIT can pass.
Change-Id: Id124d884ade6cb7da947225200e3bb193454c555
Signed-off-by: Neale Ranns <nranns@cisco.com>
diff --git a/src/vnet/dhcp/dhcp4_proxy_node.c b/src/vnet/dhcp/dhcp4_proxy_node.c
index 1b59cde..339a788 100644
--- a/src/vnet/dhcp/dhcp4_proxy_node.c
+++ b/src/vnet/dhcp/dhcp4_proxy_node.c
@@ -785,7 +785,8 @@
return VNET_API_ERROR_INVALID_SRC_ADDRESS;
rx_fib_index = fib_table_find_or_create_and_lock(FIB_PROTOCOL_IP4,
- rx_table_id);
+ rx_table_id,
+ FIB_SOURCE_DHCP);
if (is_del)
{
@@ -795,7 +796,7 @@
fib_table_entry_special_remove(rx_fib_index,
&all_1s,
FIB_SOURCE_DHCP);
- fib_table_unlock (rx_fib_index, FIB_PROTOCOL_IP4);
+ fib_table_unlock (rx_fib_index, FIB_PROTOCOL_IP4, FIB_SOURCE_DHCP);
}
}
else
@@ -808,10 +809,10 @@
&all_1s,
FIB_SOURCE_DHCP,
FIB_ENTRY_FLAG_LOCAL);
- fib_table_lock (rx_fib_index, FIB_PROTOCOL_IP4);
+ fib_table_lock (rx_fib_index, FIB_PROTOCOL_IP4, FIB_SOURCE_DHCP);
}
}
- fib_table_unlock (rx_fib_index, FIB_PROTOCOL_IP4);
+ fib_table_unlock (rx_fib_index, FIB_PROTOCOL_IP4, FIB_SOURCE_DHCP);
return (rc);
}
diff --git a/src/vnet/dhcp/dhcp6_proxy_node.c b/src/vnet/dhcp/dhcp6_proxy_node.c
index 9c2f522..ce7a8fc 100644
--- a/src/vnet/dhcp/dhcp6_proxy_node.c
+++ b/src/vnet/dhcp/dhcp6_proxy_node.c
@@ -841,7 +841,8 @@
return VNET_API_ERROR_INVALID_SRC_ADDRESS;
rx_fib_index = mfib_table_find_or_create_and_lock(FIB_PROTOCOL_IP6,
- rx_table_id);
+ rx_table_id,
+ MFIB_SOURCE_DHCP);
if (is_del)
{
@@ -851,7 +852,7 @@
mfib_table_entry_delete(rx_fib_index,
&all_dhcp_servers,
MFIB_SOURCE_DHCP);
- mfib_table_unlock(rx_fib_index, FIB_PROTOCOL_IP6);
+ mfib_table_unlock(rx_fib_index, FIB_PROTOCOL_IP6, MFIB_SOURCE_DHCP);
}
}
else
@@ -885,11 +886,11 @@
MFIB_SOURCE_DHCP,
MFIB_RPF_ID_NONE,
MFIB_ENTRY_FLAG_ACCEPT_ALL_ITF);
- mfib_table_lock(rx_fib_index, FIB_PROTOCOL_IP6);
+ mfib_table_lock(rx_fib_index, FIB_PROTOCOL_IP6, MFIB_SOURCE_DHCP);
}
}
- mfib_table_unlock(rx_fib_index, FIB_PROTOCOL_IP6);
+ mfib_table_unlock(rx_fib_index, FIB_PROTOCOL_IP6, MFIB_SOURCE_DHCP);
return (rc);
}
diff --git a/src/vnet/dhcp/dhcp_proxy.c b/src/vnet/dhcp/dhcp_proxy.c
index ba7f354..1784906 100644
--- a/src/vnet/dhcp/dhcp_proxy.c
+++ b/src/vnet/dhcp/dhcp_proxy.c
@@ -29,9 +29,9 @@
u32 fib_index)
{
if (FIB_PROTOCOL_IP4 == proto)
- fib_table_lock(fib_index, proto);
+ fib_table_lock(fib_index, proto, FIB_SOURCE_DHCP);
else
- mfib_table_lock(fib_index, proto);
+ mfib_table_lock(fib_index, proto, MFIB_SOURCE_DHCP);
}
static void
@@ -39,9 +39,9 @@
u32 fib_index)
{
if (FIB_PROTOCOL_IP4 == proto)
- fib_table_unlock(fib_index, proto);
+ fib_table_unlock(fib_index, proto, FIB_SOURCE_DHCP);
else
- mfib_table_unlock(fib_index, proto);
+ mfib_table_unlock(fib_index, proto, MFIB_SOURCE_DHCP);
}
u32
@@ -169,7 +169,7 @@
if (~0 != index)
{
server = &proxy->dhcp_servers[index];
- fib_table_unlock (server->server_fib_index, proto);
+ fib_table_unlock (server->server_fib_index, proto, FIB_SOURCE_DHCP);
vec_del1(proxy->dhcp_servers, index);
@@ -228,7 +228,8 @@
dhcp_server_t server = {
.dhcp_server = *addr,
.server_fib_index = fib_table_find_or_create_and_lock(proto,
- server_table_id),
+ server_table_id,
+ FIB_SOURCE_DHCP),
};
vec_add1(proxy->dhcp_servers, server);
@@ -297,9 +298,11 @@
int rc = 0;
if (proto == FIB_PROTOCOL_IP4)
- rx_fib_index = fib_table_find_or_create_and_lock(proto, tbl_id);
+ rx_fib_index = fib_table_find_or_create_and_lock(proto, tbl_id,
+ FIB_SOURCE_DHCP);
else
- rx_fib_index = mfib_table_find_or_create_and_lock(proto, tbl_id);
+ rx_fib_index = mfib_table_find_or_create_and_lock(proto, tbl_id,
+ MFIB_SOURCE_DHCP);
v = dhcp_get_vss_info(dm, rx_fib_index, proto);
if (NULL != v)