aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet
diff options
context:
space:
mode:
Diffstat (limited to 'src/vnet')
-rw-r--r--src/vnet/dhcp/dhcp6_proxy_node.c9
-rw-r--r--src/vnet/dhcp/dhcp_proxy.c84
-rw-r--r--src/vnet/dhcp/dhcp_proxy.h1
-rw-r--r--src/vnet/interface_api.c4
4 files changed, 78 insertions, 20 deletions
diff --git a/src/vnet/dhcp/dhcp6_proxy_node.c b/src/vnet/dhcp/dhcp6_proxy_node.c
index ed44977d76b..58674209ca7 100644
--- a/src/vnet/dhcp/dhcp6_proxy_node.c
+++ b/src/vnet/dhcp/dhcp6_proxy_node.c
@@ -226,7 +226,7 @@ dhcpv6_proxy_to_server_input (vlib_main_t * vm,
/* Send to DHCPV6 server via the configured FIB */
rx_sw_if_index = sw_if_index = vnet_buffer(b0)->sw_if_index[VLIB_RX];
- rx_fib_idx = im->fib_index_by_sw_if_index [rx_sw_if_index];
+ rx_fib_idx = im->mfib_index_by_sw_if_index [rx_sw_if_index];
server = dhcp_get_server(dpm, rx_fib_idx, FIB_PROTOCOL_IP6);
if (PREDICT_FALSE (NULL == server))
@@ -587,7 +587,7 @@ dhcpv6_proxy_to_client_input (vlib_main_t * vm,
//Advance buffer to start of encapsulated DHCPv6 message
vlib_buffer_advance (b0, sizeof(*r0));
- client_fib_idx = im->fib_index_by_sw_if_index[sw_if_index];
+ client_fib_idx = im->mfib_index_by_sw_if_index[sw_if_index];
server = dhcp_get_server(dm, client_fib_idx, FIB_PROTOCOL_IP6);
if (NULL == server)
@@ -894,7 +894,8 @@ static u8 *
format_dhcp6_proxy_server (u8 * s, va_list * args)
{
dhcp_server_t * server = va_arg (*args, dhcp_server_t *);
- ip6_fib_t * rx_fib, * server_fib;
+ ip6_fib_t *server_fib;
+ ip6_mfib_t *rx_fib;
if (NULL == server)
{
@@ -904,7 +905,7 @@ format_dhcp6_proxy_server (u8 * s, va_list * args)
}
server_fib = ip6_fib_get(server->server_fib_index);
- rx_fib = ip6_fib_get(server->rx_fib_index);
+ rx_fib = ip6_mfib_get(server->rx_fib_index);
s = format (s, "%=40U%=40U%=14u%=14u",
diff --git a/src/vnet/dhcp/dhcp_proxy.c b/src/vnet/dhcp/dhcp_proxy.c
index da2deea65f6..8e31c3dbecc 100644
--- a/src/vnet/dhcp/dhcp_proxy.c
+++ b/src/vnet/dhcp/dhcp_proxy.c
@@ -17,12 +17,55 @@
#include <vnet/dhcp/dhcp_proxy.h>
#include <vnet/fib/fib_table.h>
+#include <vnet/mfib/mfib_table.h>
/**
* @brief Shard 4/6 instance of DHCP main
*/
dhcp_proxy_main_t dhcp_proxy_main;
+static void
+dhcp_proxy_rx_table_lock (fib_protocol_t proto,
+ u32 fib_index)
+{
+ if (FIB_PROTOCOL_IP4 == proto)
+ fib_table_lock(fib_index, proto);
+ else
+ mfib_table_lock(fib_index, proto);
+}
+
+static void
+dhcp_proxy_rx_table_unlock (fib_protocol_t proto,
+ u32 fib_index)
+{
+ if (FIB_PROTOCOL_IP4 == proto)
+ fib_table_unlock(fib_index, proto);
+ else
+ mfib_table_unlock(fib_index, proto);
+}
+
+static u32
+dhcp_proxy_rx_table_get_table_id (fib_protocol_t proto,
+ u32 fib_index)
+{
+ if (FIB_PROTOCOL_IP4 == proto)
+ {
+ fib_table_t *fib;
+
+ fib = fib_table_get(fib_index, proto);
+
+ return (fib->ft_table_id);
+ }
+ else
+ {
+ mfib_table_t *mfib;
+
+ mfib = mfib_table_get(fib_index, proto);
+
+ return (mfib->mft_table_id);
+ }
+}
+
void
dhcp_proxy_walk (fib_protocol_t proto,
dhcp_proxy_walk_fn_t fn,
@@ -51,11 +94,11 @@ dhcp_vss_walk (fib_protocol_t proto,
void *ctx)
{
dhcp_proxy_main_t * dpm = &dhcp_proxy_main;
+ mfib_table_t *mfib;
dhcp_vss_t * vss;
u32 vss_index, i;
fib_table_t *fib;
-
vec_foreach_index (i, dpm->vss_index_by_rx_fib_index[proto])
{
vss_index = dpm->vss_index_by_rx_fib_index[proto][i];
@@ -64,10 +107,20 @@ dhcp_vss_walk (fib_protocol_t proto,
vss = pool_elt_at_index (dpm->vss[proto], vss_index);
- fib = fib_table_get(i, proto);
+ if (FIB_PROTOCOL_IP4 == proto)
+ {
+ fib = fib_table_get(i, proto);
- if (!fn(vss, fib->ft_table_id, ctx))
- break;
+ if (!fn(vss, fib->ft_table_id, ctx))
+ break;
+ }
+ else
+ {
+ mfib = mfib_table_get(i, proto);
+
+ if (!fn(vss, mfib->mft_table_id, ctx))
+ break;
+ }
}
}
@@ -164,7 +217,8 @@ dhcp_proxy_dump_walk (dhcp_server_t *server,
void *arg)
{
dhcp_proxy_dump_walk_cxt_t *ctx = arg;
- fib_table_t *s_fib, *r_fib;
+ fib_table_t *s_fib;
+ u32 rx_table_id;
dhcp_vss_t *v;
v = dhcp_get_vss_info(&dhcp_proxy_main,
@@ -172,7 +226,8 @@ dhcp_proxy_dump_walk (dhcp_server_t *server,
ctx->proto);
s_fib = fib_table_get(server->server_fib_index, ctx->proto);
- r_fib = fib_table_get(server->rx_fib_index, ctx->proto);
+ rx_table_id = dhcp_proxy_rx_table_get_table_id(server->rx_fib_index,
+ ctx->proto);
dhcp_send_details(ctx->proto,
ctx->opaque,
@@ -180,7 +235,7 @@ dhcp_proxy_dump_walk (dhcp_server_t *server,
&server->dhcp_server,
&server->dhcp_src_address,
s_fib->ft_table_id,
- r_fib->ft_table_id,
+ rx_table_id,
(v ? v->fib_id : 0),
(v ? v->oui : 0));
@@ -226,7 +281,10 @@ int dhcp_proxy_set_vss (fib_protocol_t proto,
u32 rx_fib_index;
int rc = 0;
- rx_fib_index = fib_table_find_or_create_and_lock(proto, tbl_id);
+ if (proto == FIB_PROTOCOL_IP4)
+ rx_fib_index = fib_table_find_or_create_and_lock(proto, tbl_id);
+ else
+ rx_fib_index = mfib_table_find_or_create_and_lock(proto, tbl_id);
v = dhcp_get_vss_info(dm, rx_fib_index, proto);
if (NULL != v)
@@ -235,7 +293,7 @@ int dhcp_proxy_set_vss (fib_protocol_t proto,
{
/* release the lock held on the table when the VSS
* info was created */
- fib_table_unlock (rx_fib_index, proto);
+ dhcp_proxy_rx_table_unlock (proto, rx_fib_index);
pool_put (dm->vss[proto], v);
dm->vss_index_by_rx_fib_index[proto][rx_fib_index] = ~0;
@@ -258,18 +316,18 @@ int dhcp_proxy_set_vss (fib_protocol_t proto,
rx_fib_index, ~0);
/* hold a lock on the table whilst the VSS info exist */
- fib_table_lock (rx_fib_index, proto);
-
pool_get (dm->vss[proto], v);
v->fib_id = fib_id;
v->oui = oui;
+
dm->vss_index_by_rx_fib_index[proto][rx_fib_index] =
v - dm->vss[proto];
+ dhcp_proxy_rx_table_lock (proto, rx_fib_index);
}
}
/* Release the lock taken during the create_or_lock at the start */
- fib_table_unlock (rx_fib_index, proto);
-
+ dhcp_proxy_rx_table_unlock (proto, rx_fib_index);
+
return (rc);
}
diff --git a/src/vnet/dhcp/dhcp_proxy.h b/src/vnet/dhcp/dhcp_proxy.h
index 4586d8838af..708e92f3c32 100644
--- a/src/vnet/dhcp/dhcp_proxy.h
+++ b/src/vnet/dhcp/dhcp_proxy.h
@@ -104,7 +104,6 @@ typedef struct {
/* hash lookup specific vrf_id -> option 82 vss suboption */
u32 *vss_index_by_rx_fib_index[DHCP_N_PROTOS];
-
} dhcp_proxy_main_t;
extern dhcp_proxy_main_t dhcp_proxy_main;
diff --git a/src/vnet/interface_api.c b/src/vnet/interface_api.c
index f94928b6dad..bfd2af31a58 100644
--- a/src/vnet/interface_api.c
+++ b/src/vnet/interface_api.c
@@ -29,6 +29,7 @@
#include <vnet/l2/l2_vtr.h>
#include <vnet/vnet_msg_enum.h>
#include <vnet/fib/fib_api.h>
+#include <vnet/mfib/mfib_table.h>
#define vl_typedefs /* define message structures */
#include <vnet/vnet_all_api_h.h>
@@ -340,9 +341,9 @@ vl_api_sw_interface_set_table_t_handler (vl_api_sw_interface_set_table_t * mp)
fib_index = fib_table_find_or_create_and_lock (FIB_PROTOCOL_IP6,
table_id);
-
vec_validate (ip6_main.fib_index_by_sw_if_index, sw_if_index);
ip6_main.fib_index_by_sw_if_index[sw_if_index] = fib_index;
+
fib_index = mfib_table_find_or_create_and_lock (FIB_PROTOCOL_IP6,
table_id);
vec_validate (ip6_main.mfib_index_by_sw_if_index, sw_if_index);
@@ -362,7 +363,6 @@ vl_api_sw_interface_set_table_t_handler (vl_api_sw_interface_set_table_t * mp)
fib_index = fib_table_find_or_create_and_lock (FIB_PROTOCOL_IP4,
table_id);
-
vec_validate (ip4_main.fib_index_by_sw_if_index, sw_if_index);
ip4_main.fib_index_by_sw_if_index[sw_if_index] = fib_index;