Code Review
/
vpp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
ip: Protocol Independent IP Neighbors
[vpp.git]
/
src
/
plugins
/
gbp
/
gbp_route_domain.c
diff --git
a/src/plugins/gbp/gbp_route_domain.c
b/src/plugins/gbp/gbp_route_domain.c
index
67b6915
..
99c6e16
100644
(file)
--- a/
src/plugins/gbp/gbp_route_domain.c
+++ b/
src/plugins/gbp/gbp_route_domain.c
@@
-18,7
+18,6
@@
#include <vnet/dpo/dvr_dpo.h>
#include <vnet/fib/fib_table.h>
#include <vnet/dpo/dvr_dpo.h>
#include <vnet/fib/fib_table.h>
-#include <vnet/ip/ip_neighbor.h>
/**
* A fixed MAC address to use as the source MAC for packets L3 switched
/**
* A fixed MAC address to use as the source MAC for packets L3 switched
@@
-53,6
+52,7
@@
typedef struct gbp_route_domain_db_t
} gbp_route_domain_db_t;
static gbp_route_domain_db_t gbp_route_domain_db;
} gbp_route_domain_db_t;
static gbp_route_domain_db_t gbp_route_domain_db;
+static fib_source_t gbp_fib_source;
/**
* logger
/**
* logger
@@
-126,6
+126,7
@@
gbp_route_domain_db_remove (gbp_route_domain_t * grd)
int
gbp_route_domain_add_and_lock (u32 rd_id,
int
gbp_route_domain_add_and_lock (u32 rd_id,
+ gbp_scope_t scope,
u32 ip4_table_id,
u32 ip6_table_id,
u32 ip4_uu_sw_if_index, u32 ip6_uu_sw_if_index)
u32 ip4_table_id,
u32 ip6_table_id,
u32 ip4_uu_sw_if_index, u32 ip6_uu_sw_if_index)
@@
-142,6
+143,7
@@
gbp_route_domain_add_and_lock (u32 rd_id,
pool_get_zero (gbp_route_domain_pool, grd);
grd->grd_id = rd_id;
pool_get_zero (gbp_route_domain_pool, grd);
grd->grd_id = rd_id;
+ grd->grd_scope = scope;
grd->grd_table_id[FIB_PROTOCOL_IP4] = ip4_table_id;
grd->grd_table_id[FIB_PROTOCOL_IP6] = ip6_table_id;
grd->grd_uu_sw_if_index[FIB_PROTOCOL_IP4] = ip4_uu_sw_if_index;
grd->grd_table_id[FIB_PROTOCOL_IP4] = ip4_table_id;
grd->grd_table_id[FIB_PROTOCOL_IP6] = ip6_table_id;
grd->grd_uu_sw_if_index[FIB_PROTOCOL_IP4] = ip4_uu_sw_if_index;
@@
-152,7
+154,7
@@
gbp_route_domain_add_and_lock (u32 rd_id,
grd->grd_fib_index[fproto] =
fib_table_find_or_create_and_lock (fproto,
grd->grd_table_id[fproto],
grd->grd_fib_index[fproto] =
fib_table_find_or_create_and_lock (fproto,
grd->grd_table_id[fproto],
-
FIB_SOURCE_PLUGIN_HI
);
+
gbp_fib_source
);
if (~0 != grd->grd_uu_sw_if_index[fproto])
{
if (~0 != grd->grd_uu_sw_if_index[fproto])
{
@@
-170,7
+172,7
@@
gbp_route_domain_add_and_lock (u32 rd_id,
mac_address_to_bytes (gbp_route_domain_get_local_mac (),
eth->src_address);
mac_address_to_bytes (gbp_route_domain_get_remote_mac (),
mac_address_to_bytes (gbp_route_domain_get_local_mac (),
eth->src_address);
mac_address_to_bytes (gbp_route_domain_get_remote_mac (),
- eth->
src
_address);
+ eth->
dst
_address);
/*
* create an adjacency out of the uu-fwd interfaces that will
/*
* create an adjacency out of the uu-fwd interfaces that will
@@
-219,8
+221,7
@@
gbp_route_domain_unlock (index_t index)
FOR_EACH_FIB_IP_PROTOCOL (fproto)
{
FOR_EACH_FIB_IP_PROTOCOL (fproto)
{
- fib_table_unlock (grd->grd_fib_index[fproto],
- fproto, FIB_SOURCE_PLUGIN_HI);
+ fib_table_unlock (grd->grd_fib_index[fproto], fproto, gbp_fib_source);
if (INDEX_INVALID != grd->grd_adj[fproto])
adj_unlock (grd->grd_adj[fproto]);
}
if (INDEX_INVALID != grd->grd_adj[fproto])
adj_unlock (grd->grd_adj[fproto]);
}
@@
-241,6
+242,16
@@
gbp_route_domain_get_rd_id (index_t grdi)
return (grd->grd_id);
}
return (grd->grd_id);
}
+gbp_scope_t
+gbp_route_domain_get_scope (index_t grdi)
+{
+ gbp_route_domain_t *grd;
+
+ grd = gbp_route_domain_get (grdi);
+
+ return (grd->grd_scope);
+}
+
int
gbp_route_domain_delete (u32 rd_id)
{
int
gbp_route_domain_delete (u32 rd_id)
{
@@
-296,6
+307,7
@@
gbp_route_domain_cli (vlib_main_t * vm,
u32 ip6_uu_sw_if_index = ~0;
u32 ip4_table_id = ~0;
u32 ip6_table_id = ~0;
u32 ip6_uu_sw_if_index = ~0;
u32 ip4_table_id = ~0;
u32 ip6_table_id = ~0;
+ u32 scope = ~0;
u32 rd_id = ~0;
u8 add = 1;
u32 rd_id = ~0;
u8 add = 1;
@@
-317,6
+329,8
@@
gbp_route_domain_cli (vlib_main_t * vm,
add = 0;
else if (unformat (input, "rd %d", &rd_id))
;
add = 0;
else if (unformat (input, "rd %d", &rd_id))
;
+ else if (unformat (input, "scope %d", &scope))
+ ;
else
break;
}
else
break;
}
@@
-331,7
+345,8
@@
gbp_route_domain_cli (vlib_main_t * vm,
if (~0 == ip6_table_id)
return clib_error_return (0, "IP6 table-ID must be specified");
if (~0 == ip6_table_id)
return clib_error_return (0, "IP6 table-ID must be specified");
- gbp_route_domain_add_and_lock (rd_id, ip4_table_id,
+ gbp_route_domain_add_and_lock (rd_id, scope,
+ ip4_table_id,
ip6_table_id,
ip4_uu_sw_if_index, ip6_uu_sw_if_index);
}
ip6_table_id,
ip4_uu_sw_if_index, ip6_uu_sw_if_index);
}
@@
-345,13
+360,13
@@
gbp_route_domain_cli (vlib_main_t * vm,
* Configure a GBP route-domain
*
* @cliexpar
* Configure a GBP route-domain
*
* @cliexpar
- * @cliexstart{
set gbp route-domain [del] bd <ID> bvi <interface> uu-flood <interface>
}
+ * @cliexstart{
gbp route-domain [del] rd <ID> ip4-table-id <ID> ip6-table-id <ID> [ip4-uu <interface>] [ip6-uu <interface>]
}
* @cliexend
?*/
/* *INDENT-OFF* */
VLIB_CLI_COMMAND (gbp_route_domain_cli_node, static) = {
.path = "gbp route-domain",
* @cliexend
?*/
/* *INDENT-OFF* */
VLIB_CLI_COMMAND (gbp_route_domain_cli_node, static) = {
.path = "gbp route-domain",
- .short_help = "gbp route-domain [del]
epg bd <ID> bvi <interface> uu-flood <interface>
",
+ .short_help = "gbp route-domain [del]
rd <ID> ip4-table-id <ID> ip6-table-id <ID> [ip4-uu <interface>] [ip6-uu <interface>]
",
.function = gbp_route_domain_cli,
};
.function = gbp_route_domain_cli,
};
@@
-414,6
+429,9
@@
static clib_error_t *
gbp_route_domain_init (vlib_main_t * vm)
{
grd_logger = vlib_log_register_class ("gbp", "rd");
gbp_route_domain_init (vlib_main_t * vm)
{
grd_logger = vlib_log_register_class ("gbp", "rd");
+ gbp_fib_source = fib_source_allocate ("gbp-rd",
+ FIB_SOURCE_PRIORITY_HI,
+ FIB_SOURCE_BH_DROP);
return (NULL);
}
return (NULL);
}