IPv6 Classify Forwarding Graph errors
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>
diff --git a/vnet/vnet/dpo/classify_dpo.c b/vnet/vnet/dpo/classify_dpo.c
index 93f3f0a..9e7886c 100644
--- a/vnet/vnet/dpo/classify_dpo.c
+++ b/vnet/vnet/dpo/classify_dpo.c
@@ -40,7 +40,7 @@
}
index_t
-classify_dpo_create (fib_protocol_t proto,
+classify_dpo_create (dpo_proto_t proto,
u32 classify_table_index)
{
classify_dpo_t *cd;
@@ -61,7 +61,8 @@
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));
}
diff --git a/vnet/vnet/dpo/classify_dpo.h b/vnet/vnet/dpo/classify_dpo.h
index cd35c3c..48f4b2b 100644
--- a/vnet/vnet/dpo/classify_dpo.h
+++ b/vnet/vnet/dpo/classify_dpo.h
@@ -25,7 +25,7 @@
*/
typedef struct classify_dpo_t
{
- fib_protocol_t cd_proto;
+ dpo_proto_t cd_proto;
u32 cd_table_index;
@@ -35,7 +35,7 @@
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);
diff --git a/vnet/vnet/dpo/drop_dpo.c b/vnet/vnet/dpo/drop_dpo.c
index 26c3e8a..5118d2a 100644
--- a/vnet/vnet/dpo/drop_dpo.c
+++ b/vnet/vnet/dpo/drop_dpo.c
@@ -24,7 +24,7 @@
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]);
}
diff --git a/vnet/vnet/ip/ip4_forward.c b/vnet/vnet/ip/ip4_forward.c
index bfa9f0a..d69a3c3 100644
--- a/vnet/vnet/ip/ip4_forward.c
+++ b/vnet/vnet/ip/ip4_forward.c
@@ -654,7 +654,7 @@
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,
@@ -3301,8 +3301,7 @@
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,
diff --git a/vnet/vnet/ip/ip6_forward.c b/vnet/vnet/ip/ip6_forward.c
index c285af9..bdcdbf0 100644
--- a/vnet/vnet/ip/ip6_forward.c
+++ b/vnet/vnet/ip/ip6_forward.c
@@ -354,9 +354,8 @@
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,
@@ -3083,8 +3082,8 @@
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,
diff --git a/vnet/vnet/ip/lookup.c b/vnet/vnet/ip/lookup.c
index 78152f0..4ddbb54 100644
--- a/vnet/vnet/ip/lookup.c
+++ b/vnet/vnet/ip/lookup.c
@@ -296,7 +296,7 @@
}
dpo_set(dpo, DPO_CLASSIFY, proto,
- classify_dpo_create(fp, classify_table_index));
+ classify_dpo_create(proto, classify_table_index));
}
else
return 0;
diff --git a/vnet/vnet/mpls/interface.c b/vnet/vnet/mpls/interface.c
index 726e672..af0428c 100644
--- a/vnet/vnet/mpls/interface.c
+++ b/vnet/vnet/mpls/interface.c
@@ -941,7 +941,7 @@
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,
diff --git a/vnet/vnet/mpls/mpls.c b/vnet/vnet/mpls/mpls.c
index ac35e5d..aa1d963 100644
--- a/vnet/vnet/mpls/mpls.c
+++ b/vnet/vnet/mpls/mpls.c
@@ -528,7 +528,7 @@
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,
@@ -539,7 +539,7 @@
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",
@@ -548,7 +548,7 @@
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
@@ -597,10 +597,16 @@
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)
diff --git a/vpp/vpp-api/api.c b/vpp/vpp-api/api.c
index 9af8dbc..832ea66 100644
--- a/vpp/vpp-api/api.c
+++ b/vpp/vpp-api/api.c
@@ -1126,7 +1126,7 @@
}
dpo_set (&dpo, DPO_CLASSIFY, dproto,
- classify_dpo_create (prefix->fp_proto,
+ classify_dpo_create (dproto,
ntohl (classify_table_index)));
}
else