summary |
shortlog |
log |
commit | commitdiff |
review |
tree
raw |
patch |
inline | side by side (from parent 1:
cfc7a10)
An anonymous l3-out subnet is a locally attached l3-out subnet, and
differs from regular l3-out subnets in the way adjacencies are managed.
It is required for the anonymous l3-out external interfaces to correctly
classify locally attached l3-out hosts.
Type: feature
Change-Id: Ie7bc88b1f22abc4d0b46db5f3cfbf208bc53ba5f
Signed-off-by: Benoît Ganne <bganne@cisco.com>
"stitched-external");
const gbp_subnet::type_t gbp_subnet::type_t::TRANSPORT(2, "transport");
const gbp_subnet::type_t gbp_subnet::type_t::L3_OUT(3, "l3-out");
"stitched-external");
const gbp_subnet::type_t gbp_subnet::type_t::TRANSPORT(2, "transport");
const gbp_subnet::type_t gbp_subnet::type_t::L3_OUT(3, "l3-out");
+const gbp_subnet::type_t gbp_subnet::type_t::ANON_L3_OUT(4, "anon-l3-out");
singular_db<gbp_subnet::key_t, gbp_subnet> gbp_subnet::m_db;
singular_db<gbp_subnet::key_t, gbp_subnet> gbp_subnet::m_db;
gbp_subnet::gbp_subnet(const gbp_route_domain& rd,
const route::prefix_t& prefix,
gbp_subnet::gbp_subnet(const gbp_route_domain& rd,
const route::prefix_t& prefix,
+ sclass_t sclass,
+ const type_t& type)
: m_hw(false)
, m_rd(rd.singular())
, m_prefix(prefix)
: m_hw(false)
, m_rd(rd.singular())
, m_prefix(prefix)
- , m_type(type_t::L3_OUT)
, m_recirc(nullptr)
, m_epg()
, m_sclass(sclass)
, m_recirc(nullptr)
, m_epg()
, m_sclass(sclass)
VOM_LOG(log_level_t::DEBUG) << "read: " << gs.to_string();
break;
}
VOM_LOG(log_level_t::DEBUG) << "read: " << gs.to_string();
break;
}
+ case GBP_API_SUBNET_ANON_L3_OUT: {
+ gbp_subnet gs(*rd, pfx, payload.subnet.sclass, type_t::ANON_L3_OUT);
+ OM::commit(key, gs);
+ VOM_LOG(log_level_t::DEBUG) << "read: " << gs.to_string();
+ break;
+ }
case GBP_API_SUBNET_STITCHED_EXTERNAL: {
std::shared_ptr<interface> itf =
interface::find(payload.subnet.sw_if_index);
case GBP_API_SUBNET_STITCHED_EXTERNAL: {
std::shared_ptr<interface> itf =
interface::find(payload.subnet.sw_if_index);
const static type_t TRANSPORT;
/**
const static type_t TRANSPORT;
/**
- * A transport subnet, sent via the RD's UU-fwd interface
*/
const static type_t L3_OUT;
*/
const static type_t L3_OUT;
+ /**
+ * An anonymous L3-out subnet
+ */
+ const static type_t ANON_L3_OUT;
+
private:
type_t(int v, const std::string s);
};
/**
private:
type_t(int v, const std::string s);
};
/**
- * Construct an internal GBP subnet
- */
+ * Construct an internal GBP subnet
+ */
gbp_subnet(const gbp_route_domain& rd,
const route::prefix_t& prefix,
const type_t& type);
gbp_subnet(const gbp_route_domain& rd,
const route::prefix_t& prefix,
const type_t& type);
*/
gbp_subnet(const gbp_route_domain& rd,
const route::prefix_t& prefix,
*/
gbp_subnet(const gbp_route_domain& rd,
const route::prefix_t& prefix,
+ sclass_t sclass,
+ const type_t& type = type_t::L3_OUT);
GBP_API_SUBNET_STITCHED_INTERNAL,
GBP_API_SUBNET_STITCHED_EXTERNAL,
GBP_API_SUBNET_L3_OUT,
GBP_API_SUBNET_STITCHED_INTERNAL,
GBP_API_SUBNET_STITCHED_EXTERNAL,
GBP_API_SUBNET_L3_OUT,
+ GBP_API_SUBNET_ANON_L3_OUT,
};
typeonly define gbp_subnet
};
typeonly define gbp_subnet
case GBP_API_SUBNET_L3_OUT:
*t = GBP_SUBNET_L3_OUT;
return (0);
case GBP_API_SUBNET_L3_OUT:
*t = GBP_SUBNET_L3_OUT;
return (0);
+ case GBP_API_SUBNET_ANON_L3_OUT:
+ *t = GBP_SUBNET_ANON_L3_OUT;
+ return (0);
case GBP_API_SUBNET_STITCHED_INTERNAL:
*t = GBP_SUBNET_STITCHED_INTERNAL;
return (0);
case GBP_API_SUBNET_STITCHED_INTERNAL:
*t = GBP_SUBNET_STITCHED_INTERNAL;
return (0);
case GBP_SUBNET_L3_OUT:
a = GBP_API_SUBNET_L3_OUT;
break;
case GBP_SUBNET_L3_OUT:
a = GBP_API_SUBNET_L3_OUT;
break;
+ case GBP_SUBNET_ANON_L3_OUT:
+ a = GBP_API_SUBNET_ANON_L3_OUT;
+ break;
}
a = clib_host_to_net_u32 (a);
}
a = clib_host_to_net_u32 (a);
-gbp_subnet_l3_out_add (gbp_subnet_t * gs, sclass_t sclass)
+gbp_subnet_l3_out_add (gbp_subnet_t * gs, sclass_t sclass, int is_anon)
+ fib_entry_flag_t flags;
dpo_id_t gpd = DPO_INVALID;
gs->gs_l3_out.gs_sclass = sclass;
dpo_id_t gpd = DPO_INVALID;
gs->gs_l3_out.gs_sclass = sclass;
gbp_route_domain_get_scope (gs->gs_rd),
gs->gs_l3_out.gs_sclass, ~0, &gpd);
gbp_route_domain_get_scope (gs->gs_rd),
gs->gs_l3_out.gs_sclass, ~0, &gpd);
+ flags = FIB_ENTRY_FLAG_INTERPOSE;
+ if (is_anon)
+ flags |= FIB_ENTRY_FLAG_COVERED_INHERIT;
+
gs->gs_fei = fib_table_entry_special_dpo_add (gs->gs_key->gsk_fib_index,
&gs->gs_key->gsk_pfx,
FIB_SOURCE_SPECIAL,
gs->gs_fei = fib_table_entry_special_dpo_add (gs->gs_key->gsk_fib_index,
&gs->gs_key->gsk_pfx,
FIB_SOURCE_SPECIAL,
- FIB_ENTRY_FLAG_INTERPOSE,
- &gpd);
gs = pool_elt_at_index (gbp_subnet_pool, gsi);
gs = pool_elt_at_index (gbp_subnet_pool, gsi);
- if (GBP_SUBNET_L3_OUT == gs->gs_type)
- fib_table_entry_delete_index (gs->gs_fei, FIB_SOURCE_SPECIAL);
- else
- fib_table_entry_delete_index (gs->gs_fei, FIB_SOURCE_PLUGIN_HI);
+ fib_table_entry_delete_index (gs->gs_fei,
+ (GBP_SUBNET_L3_OUT == gs->gs_type
+ || GBP_SUBNET_ANON_L3_OUT ==
+ gs->gs_type) ? FIB_SOURCE_SPECIAL :
+ FIB_SOURCE_PLUGIN_HI);
gbp_subnet_db_del (gs);
gbp_route_domain_unlock (gs->gs_rd);
gbp_subnet_db_del (gs);
gbp_route_domain_unlock (gs->gs_rd);
+ switch (type)
+ {
+ case GBP_SUBNET_TRANSPORT:
+ case GBP_SUBNET_STITCHED_INTERNAL:
+ case GBP_SUBNET_STITCHED_EXTERNAL:
+ case GBP_SUBNET_L3_OUT:
+ case GBP_SUBNET_ANON_L3_OUT:
+ break;
+ default:
+ return (VNET_API_ERROR_INCORRECT_ADJACENCY_TYPE);
+ }
+
grdi = gbp_route_domain_find_and_lock (rd_id);
if (~0 == grdi)
grdi = gbp_route_domain_find_and_lock (rd_id);
if (~0 == grdi)
rv = gbp_subnet_transport_add (gs);
break;
case GBP_SUBNET_L3_OUT:
rv = gbp_subnet_transport_add (gs);
break;
case GBP_SUBNET_L3_OUT:
- rv = gbp_subnet_l3_out_add (gs, sclass);
+ rv = gbp_subnet_l3_out_add (gs, sclass, 0 /* is_anon */ );
+ break;
+ case GBP_SUBNET_ANON_L3_OUT:
+ rv = gbp_subnet_l3_out_add (gs, sclass, 1 /* is_anon */ );
gbp_subnet_add_del_cli (vlib_main_t * vm,
unformat_input_t * input, vlib_cli_command_t * cmd)
{
gbp_subnet_add_del_cli (vlib_main_t * vm,
unformat_input_t * input, vlib_cli_command_t * cmd)
{
+ unformat_input_t _line_input, *line_input = &_line_input;
vnet_main_t *vnm = vnet_get_main ();
fib_prefix_t pfx = {.fp_addr = ip46_address_initializer };
int length;
vnet_main_t *vnm = vnet_get_main ();
fib_prefix_t pfx = {.fp_addr = ip46_address_initializer };
int length;
- while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
+ /* Get a line of input. */
+ if (!unformat_user (input, unformat_line_input, line_input))
+ return 0;
+
+ while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
- if (unformat (input, "del"))
+ if (unformat (line_input, "del"))
- else if (unformat (input, "rd %d", &rd_id))
+ else if (unformat (line_input, "rd %d", &rd_id))
- (input, "prefix %U/%d", unformat_ip4_address, &pfx.fp_addr.ip4,
- &length))
+ (line_input, "prefix %U/%d", unformat_ip4_address,
+ &pfx.fp_addr.ip4, &length))
pfx.fp_proto = FIB_PROTOCOL_IP4;
else
if (unformat
pfx.fp_proto = FIB_PROTOCOL_IP4;
else
if (unformat
- (input, "prefix %U/%d", unformat_ip6_address, &pfx.fp_addr.ip6,
- &length))
+ (line_input, "prefix %U/%d", unformat_ip6_address,
+ &pfx.fp_addr.ip6, &length))
pfx.fp_proto = FIB_PROTOCOL_IP6;
pfx.fp_proto = FIB_PROTOCOL_IP6;
- else if (unformat (input, "type transport"))
+ else if (unformat (line_input, "type transport"))
type = GBP_SUBNET_TRANSPORT;
type = GBP_SUBNET_TRANSPORT;
- else if (unformat (input, "type internal"))
+ else if (unformat (line_input, "type stitched-internal"))
type = GBP_SUBNET_STITCHED_INTERNAL;
type = GBP_SUBNET_STITCHED_INTERNAL;
- else if (unformat (input, "type external"))
+ else if (unformat (line_input, "type stitched-external"))
type = GBP_SUBNET_STITCHED_EXTERNAL;
type = GBP_SUBNET_STITCHED_EXTERNAL;
- else if (unformat (input, "type l3out"))
+ else if (unformat (line_input, "type anon-l3-out"))
+ type = GBP_SUBNET_ANON_L3_OUT;
+ else if (unformat (line_input, "type l3-out"))
type = GBP_SUBNET_L3_OUT;
else
if (unformat_user
type = GBP_SUBNET_L3_OUT;
else
if (unformat_user
- (input, unformat_vnet_sw_interface, vnm, &sw_if_index))
+ (line_input, unformat_vnet_sw_interface, vnm, &sw_if_index))
- else if (unformat (input, "sclass %u", &sclass))
+ else if (unformat (line_input, "sclass %u", &sclass))
+ return clib_error_return (0, "unknown input `%U'",
+ format_unformat_error, line_input);
+ unformat_free (line_input);
sclass = gs->gs_stitched_external.gs_sclass;
break;
case GBP_SUBNET_L3_OUT:
sclass = gs->gs_stitched_external.gs_sclass;
break;
case GBP_SUBNET_L3_OUT:
+ case GBP_SUBNET_ANON_L3_OUT:
sclass = gs->gs_l3_out.gs_sclass;
break;
}
sclass = gs->gs_l3_out.gs_sclass;
break;
}
return (format (s, "transport"));
case GBP_SUBNET_L3_OUT:
return (format (s, "l3-out"));
return (format (s, "transport"));
case GBP_SUBNET_L3_OUT:
return (format (s, "l3-out"));
+ case GBP_SUBNET_ANON_L3_OUT:
+ return (format (s, "anon-l3-out"));
}
return (format (s, "unknown"));
}
return (format (s, "unknown"));
vnet_get_main (), gs->gs_stitched_external.gs_sw_if_index);
break;
case GBP_SUBNET_L3_OUT:
vnet_get_main (), gs->gs_stitched_external.gs_sw_if_index);
break;
case GBP_SUBNET_L3_OUT:
+ case GBP_SUBNET_ANON_L3_OUT:
s = format (s, " {sclass:%d}", gs->gs_l3_out.gs_sclass);
break;
}
s = format (s, " {sclass:%d}", gs->gs_l3_out.gs_sclass);
break;
}
GBP_SUBNET_STITCHED_INTERNAL,
GBP_SUBNET_STITCHED_EXTERNAL,
GBP_SUBNET_L3_OUT,
GBP_SUBNET_STITCHED_INTERNAL,
GBP_SUBNET_STITCHED_EXTERNAL,
GBP_SUBNET_L3_OUT,
+ GBP_SUBNET_ANON_L3_OUT,
} gbp_subnet_type_t;
extern int gbp_subnet_add (u32 rd_id,
} gbp_subnet_type_t;
extern int gbp_subnet_add (u32 rd_id,