Type: fix
Signed-off-by: Neale Ranns <nranns@cisco.com>
Change-Id: Iaae7a9e120bbf8168c581b06d3ac0e124b32e0e7
*/
if (!(FIB_ENTRY_FLAG_LOCAL & src->fes_entry_flags))
{
*/
if (!(FIB_ENTRY_FLAG_LOCAL & src->fes_entry_flags))
{
- adj = adj_get(fib_path_list_get_adj(
- src->fes_pl,
- fib_entry_get_default_chain_type(entry)));
- if (IP_LOOKUP_NEXT_GLEAN == adj->lookup_next_index)
+ ai = fib_path_list_get_adj(src->fes_pl,
+ fib_entry_get_default_chain_type(entry));
+ if (INDEX_INVALID != ai)
- /*
- * the connected prefix will link to a glean on a non-p2p
- * u.interface.
- */
- adj->sub_type.glean.receive_addr = entry->fe_prefix.fp_addr;
+ adj = adj_get(ai);
+
+ if (IP_LOOKUP_NEXT_GLEAN == adj->lookup_next_index)
+ {
+ /*
+ * the connected prefix will link to a glean on a non-p2p
+ * u.interface.
+ */
+ adj->sub_type.glean.receive_addr = entry->fe_prefix.fp_addr;
+ }
-static const adj_index_t
fib_path_attached_next_hop_get_adj (fib_path_t *path,
fib_path_attached_next_hop_get_adj (fib_path_t *path,
+ vnet_link_t link,
+ dpo_id_t *dpo)
+ fib_protocol_t nh_proto;
+ adj_index_t ai;
+
+ nh_proto = dpo_proto_to_fib(path->fp_nh_proto);
+
if (vnet_sw_interface_is_p2p(vnet_get_main(),
path->attached_next_hop.fp_interface))
{
if (vnet_sw_interface_is_p2p(vnet_get_main(),
path->attached_next_hop.fp_interface))
{
* the subnet address (the attached route) links to the
* auto-adj (see below), we want that adj here too.
*/
* the subnet address (the attached route) links to the
* auto-adj (see below), we want that adj here too.
*/
- return (adj_nbr_add_or_lock(dpo_proto_to_fib(path->fp_nh_proto),
- link,
- &zero_addr,
- path->attached_next_hop.fp_interface));
+ ai = adj_nbr_add_or_lock(nh_proto, link, &zero_addr,
+ path->attached_next_hop.fp_interface);
- return (adj_nbr_add_or_lock(dpo_proto_to_fib(path->fp_nh_proto),
- link,
- &path->attached_next_hop.fp_nh,
- path->attached_next_hop.fp_interface));
+ ai = adj_nbr_add_or_lock(nh_proto, link,
+ &path->attached_next_hop.fp_nh,
+ path->attached_next_hop.fp_interface);
+
+ dpo_set(dpo, DPO_ADJACENCY, vnet_link_to_dpo_proto(link), ai);
+ adj_unlock(ai);
* resolve directly via the adjacency discribed by the
* interface and next-hop
*/
* resolve directly via the adjacency discribed by the
* interface and next-hop
*/
- dpo_set(&path->fp_dpo,
- DPO_ADJACENCY,
- path->fp_nh_proto,
- fib_path_attached_next_hop_get_adj(
- path,
- dpo_proto_to_link(path->fp_nh_proto)));
+ fib_path_attached_next_hop_get_adj(path,
+ dpo_proto_to_link(path->fp_nh_proto),
+ &path->fp_dpo);
+
+ ASSERT(dpo_is_adj(&path->fp_dpo));
/*
* become a child of the adjacency so we receive updates
/*
* become a child of the adjacency so we receive updates
-static const adj_index_t
fib_path_attached_get_adj (fib_path_t *path,
fib_path_attached_get_adj (fib_path_t *path,
+ vnet_link_t link,
+ dpo_id_t *dpo)
+ fib_protocol_t nh_proto;
+
+ nh_proto = dpo_proto_to_fib(path->fp_nh_proto);
+
if (vnet_sw_interface_is_p2p(vnet_get_main(),
path->attached.fp_interface))
{
if (vnet_sw_interface_is_p2p(vnet_get_main(),
path->attached.fp_interface))
{
* point-2-point interfaces do not require a glean, since
* there is nothing to ARP. Install a rewrite/nbr adj instead
*/
* point-2-point interfaces do not require a glean, since
* there is nothing to ARP. Install a rewrite/nbr adj instead
*/
- return (adj_nbr_add_or_lock(dpo_proto_to_fib(path->fp_nh_proto),
- link,
- &zero_addr,
- path->attached.fp_interface));
+ adj_index_t ai;
+
+ ai = adj_nbr_add_or_lock(nh_proto, link, &zero_addr,
+ path->attached.fp_interface);
+
+ dpo_set(dpo, DPO_ADJACENCY, vnet_link_to_dpo_proto(link), ai);
+ adj_unlock(ai);
+ }
+ else if (vnet_sw_interface_is_nbma(vnet_get_main(),
+ path->attached.fp_interface))
+ {
+ dpo_copy(dpo, drop_dpo_get(path->fp_nh_proto));
- return (adj_glean_add_or_lock(dpo_proto_to_fib(path->fp_nh_proto),
- link,
- path->attached.fp_interface,
- NULL));
+ adj_index_t ai;
+
+ ai = adj_glean_add_or_lock(nh_proto, link,
+ path->attached.fp_interface,
+ NULL);
+ dpo_set(dpo, DPO_ADJACENCY_GLEAN, vnet_link_to_dpo_proto(link), ai);
+ adj_unlock(ai);
bier_table_ecmp_unlock(path->fp_via_bier_tbl);
break;
case FIB_PATH_TYPE_ATTACHED_NEXT_HOP:
bier_table_ecmp_unlock(path->fp_via_bier_tbl);
break;
case FIB_PATH_TYPE_ATTACHED_NEXT_HOP:
- adj_child_remove(path->fp_dpo.dpoi_index,
- path->fp_sibling);
- adj_unlock(path->fp_dpo.dpoi_index);
- break;
case FIB_PATH_TYPE_ATTACHED:
case FIB_PATH_TYPE_ATTACHED:
- adj_child_remove(path->fp_dpo.dpoi_index,
- path->fp_sibling);
- adj_unlock(path->fp_dpo.dpoi_index);
+ if (dpo_is_adj(&path->fp_dpo))
+ adj_child_remove(path->fp_dpo.dpoi_index,
+ path->fp_sibling);
break;
case FIB_PATH_TYPE_UDP_ENCAP:
udp_encap_unlock(path->fp_dpo.dpoi_index);
break;
case FIB_PATH_TYPE_UDP_ENCAP:
udp_encap_unlock(path->fp_dpo.dpoi_index);
* restack the DPO to pick up the correct DPO sub-type
*/
uword if_is_up;
* restack the DPO to pick up the correct DPO sub-type
*/
uword if_is_up;
if_is_up = vnet_sw_interface_is_up(
vnet_get_main(),
path->attached_next_hop.fp_interface);
if_is_up = vnet_sw_interface_is_up(
vnet_get_main(),
path->attached_next_hop.fp_interface);
- ai = fib_path_attached_next_hop_get_adj(
- path,
- dpo_proto_to_link(path->fp_nh_proto));
+ fib_path_attached_next_hop_get_adj(
+ path,
+ dpo_proto_to_link(path->fp_nh_proto),
+ &path->fp_dpo);
path->fp_oper_flags &= ~FIB_PATH_OPER_FLAG_RESOLVED;
path->fp_oper_flags &= ~FIB_PATH_OPER_FLAG_RESOLVED;
- if (if_is_up && adj_is_up(ai))
+ if (if_is_up && adj_is_up(path->fp_dpo.dpoi_index))
{
path->fp_oper_flags |= FIB_PATH_OPER_FLAG_RESOLVED;
}
{
path->fp_oper_flags |= FIB_PATH_OPER_FLAG_RESOLVED;
}
- dpo_set(&path->fp_dpo, DPO_ADJACENCY, path->fp_nh_proto, ai);
- adj_unlock(ai);
-
{
path->fp_oper_flags &= ~FIB_PATH_OPER_FLAG_RESOLVED;
}
{
path->fp_oper_flags &= ~FIB_PATH_OPER_FLAG_RESOLVED;
}
- dpo_set(&tmp,
- DPO_ADJACENCY,
- path->fp_nh_proto,
- fib_path_attached_get_adj(path,
- dpo_proto_to_link(path->fp_nh_proto)));
+ fib_path_attached_get_adj(path,
+ dpo_proto_to_link(path->fp_nh_proto),
+ &tmp);
/*
* re-fetch after possible mem realloc
/*
* re-fetch after possible mem realloc
* become a child of the adjacency so we receive updates
* when the interface state changes
*/
* become a child of the adjacency so we receive updates
* when the interface state changes
*/
- path->fp_sibling = adj_child_add(path->fp_dpo.dpoi_index,
- FIB_NODE_TYPE_PATH,
- fib_path_get_index(path));
+ if (dpo_is_adj(&path->fp_dpo))
+ {
+ path->fp_sibling = adj_child_add(path->fp_dpo.dpoi_index,
+ FIB_NODE_TYPE_PATH,
+ fib_path_get_index(path));
+ }
dpo_reset(&tmp);
break;
}
dpo_reset(&tmp);
break;
}
path = fib_path_get(path_index);
path = fib_path_get(path_index);
- ASSERT(dpo_is_adj(&path->fp_dpo));
if (dpo_is_adj(&path->fp_dpo))
{
return (path->fp_dpo.dpoi_index);
if (dpo_is_adj(&path->fp_dpo))
{
return (path->fp_dpo.dpoi_index);
case FIB_FORW_CHAIN_TYPE_NSH:
case FIB_FORW_CHAIN_TYPE_MCAST_IP4:
case FIB_FORW_CHAIN_TYPE_MCAST_IP6:
case FIB_FORW_CHAIN_TYPE_NSH:
case FIB_FORW_CHAIN_TYPE_MCAST_IP4:
case FIB_FORW_CHAIN_TYPE_MCAST_IP6:
- {
- adj_index_t ai;
-
- /*
- * get a appropriate link type adj.
- */
- ai = fib_path_attached_next_hop_get_adj(
+ fib_path_attached_next_hop_get_adj(
- fib_forw_chain_type_to_link_type(fct));
- dpo_set(dpo, DPO_ADJACENCY,
- fib_forw_chain_type_to_dpo_proto(fct), ai);
- adj_unlock(ai);
-
+ fib_forw_chain_type_to_link_type(fct),
+ dpo);
case FIB_FORW_CHAIN_TYPE_BIER:
break;
}
case FIB_FORW_CHAIN_TYPE_BIER:
break;
}
case FIB_FORW_CHAIN_TYPE_ETHERNET:
case FIB_FORW_CHAIN_TYPE_NSH:
case FIB_FORW_CHAIN_TYPE_BIER:
case FIB_FORW_CHAIN_TYPE_ETHERNET:
case FIB_FORW_CHAIN_TYPE_NSH:
case FIB_FORW_CHAIN_TYPE_BIER:
- {
- adj_index_t ai;
-
- /*
- * get a appropriate link type adj.
- */
- ai = fib_path_attached_get_adj(
- path,
- fib_forw_chain_type_to_link_type(fct));
- dpo_set(dpo, DPO_ADJACENCY,
- fib_forw_chain_type_to_dpo_proto(fct), ai);
- adj_unlock(ai);
- break;
- }
+ fib_path_attached_get_adj(path,
+ fib_forw_chain_type_to_link_type(fct),
+ dpo);
+ break;
case FIB_FORW_CHAIN_TYPE_MCAST_IP4:
case FIB_FORW_CHAIN_TYPE_MCAST_IP6:
{
case FIB_FORW_CHAIN_TYPE_MCAST_IP4:
case FIB_FORW_CHAIN_TYPE_MCAST_IP6:
{
gre_if.config_ip4()
gre_if.generate_remote_hosts(4)
gre_if.config_ip4()
gre_if.generate_remote_hosts(4)
+ self.logger.info(self.vapi.cli("sh adj"))
+ self.logger.info(self.vapi.cli("sh ip fib"))
+
itf.local_ip4,
gre_if._remote_hosts[ii].ip4)
itf.local_ip4,
gre_if._remote_hosts[ii].ip4)
+ gre_if.admin_down()
+ gre_if.unconfig_ip4()
+
if __name__ == '__main__':
unittest.main(testRunner=VppTestRunner)
if __name__ == '__main__':
unittest.main(testRunner=VppTestRunner)