Fix a few places where the protocol of the DPO object was incorrectly set and hence the graph traversed by the packet jumped between ip4 and ip6 nodes.
Change-Id: I75c4ecfdf79df39f5dbb7c68f1fc82ff04aaed28
Signed-off-by: Neale Ranns <neale.ranns@cisco.com>
}
index_t
-classify_dpo_create (fib_protocol_t proto,
+classify_dpo_create (dpo_proto_t proto,
u32 classify_table_index)
{
classify_dpo_t *cd;
cd = classify_dpo_get(index);
- return (format(s, "classify:[%d]:table:%d",
+ return (format(s, "%U-classify:[%d]:table:%d",
+ format_dpo_proto, cd->cd_proto,
index, cd->cd_table_index));
}
*/
typedef struct classify_dpo_t
{
- fib_protocol_t cd_proto;
+ dpo_proto_t cd_proto;
u32 cd_table_index;
u16 cd_locks;
} classify_dpo_t;
-extern index_t classify_dpo_create(fib_protocol_t proto,
+extern index_t classify_dpo_create(dpo_proto_t proto,
u32 classify_table_index);
extern u8* format_classify_dpo(u8 *s, va_list *args);
const dpo_id_t *
drop_dpo_get (dpo_proto_t proto)
{
- dpo_set(&drop_dpos[proto], DPO_DROP, proto, 1);
+ dpo_set(&drop_dpos[proto], DPO_DROP, proto, proto);
return (&drop_dpos[proto]);
}
dpo_set(&dpo,
DPO_CLASSIFY,
DPO_PROTO_IP4,
- classify_dpo_create(FIB_PROTOCOL_IP4,
+ classify_dpo_create(DPO_PROTO_IP4,
classify_table_index));
fib_table_entry_special_dpo_add(fib_index,
dpo_set(&dpo,
DPO_CLASSIFY,
DPO_PROTO_IP4,
- classify_dpo_create(FIB_PROTOCOL_IP4,
- table_index));
+ classify_dpo_create(DPO_PROTO_IP4, table_index));
fib_table_entry_special_dpo_add(fib_index,
&pfx,
dpo_set(&dpo,
DPO_CLASSIFY,
- DPO_PROTO_IP4,
- classify_dpo_create(FIB_PROTOCOL_IP6,
- classify_table_index));
+ DPO_PROTO_IP6,
+ classify_dpo_create(DPO_PROTO_IP6, classify_table_index));
fib_table_entry_special_dpo_add(fib_index,
&pfx,
dpo_set(&dpo,
DPO_CLASSIFY,
- DPO_PROTO_IP4,
- classify_dpo_create(FIB_PROTOCOL_IP4,
+ DPO_PROTO_IP6,
+ classify_dpo_create(DPO_PROTO_IP6,
table_index));
fib_table_entry_special_dpo_add(fib_index,
}
dpo_set(dpo, DPO_CLASSIFY, proto,
- classify_dpo_create(fp, classify_table_index));
+ classify_dpo_create(proto, classify_table_index));
}
else
return 0;
dpo_set(&dpo,
DPO_CLASSIFY,
DPO_PROTO_IP4,
- classify_dpo_create(FIB_PROTOCOL_IP4,
+ classify_dpo_create(DPO_PROTO_IP4,
classify_table_index));
tp->fei = fib_table_entry_special_dpo_add(tp->inner_fib_index,
rpath.frp_label = MPLS_LABEL_INVALID;
rpath.frp_proto = FIB_PROTOCOL_IP4;
rpath.frp_sw_if_index = FIB_NODE_INDEX_INVALID;
- pfx.fp_payload_proto = FIB_PROTOCOL_IP4;
+ pfx.fp_payload_proto = DPO_PROTO_IP4;
vec_add1(rpaths, rpath);
}
else if (unformat (line_input,
rpath.frp_proto = FIB_PROTOCOL_IP6;
rpath.frp_sw_if_index = FIB_NODE_INDEX_INVALID;
vec_add1(rpaths, rpath);
- pfx.fp_payload_proto = FIB_PROTOCOL_IP6;
+ pfx.fp_payload_proto = DPO_PROTO_IP6;
}
else if (unformat (line_input,
"mpls-lookup-in-table %d",
rpath.frp_label = MPLS_LABEL_INVALID;
rpath.frp_proto = FIB_PROTOCOL_MPLS;
rpath.frp_sw_if_index = FIB_NODE_INDEX_INVALID;
- pfx.fp_payload_proto = FIB_PROTOCOL_MPLS;
+ pfx.fp_payload_proto = DPO_PROTO_MPLS;
vec_add1(rpaths, rpath);
}
else
pfx.fp_len = 21;
pfx.fp_label = local_label;
+ if (NULL == rpaths)
+ {
+ error = clib_error_return(0 , "no paths");
+ goto done;
+ }
+
/*
* the CLI parsing stored table Ids, swap to FIB indicies
*/
- fi = fib_table_id_find_fib_index(pfx.fp_payload_proto,
+ fi = fib_table_id_find_fib_index(dpo_proto_to_fib(pfx.fp_payload_proto),
rpaths[0].frp_fib_index);
if (~0 == fi)
}
dpo_set (&dpo, DPO_CLASSIFY, dproto,
- classify_dpo_create (prefix->fp_proto,
+ classify_dpo_create (dproto,
ntohl (classify_table_index)));
}
else