aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeale Ranns <neale.ranns@cisco.com>2016-10-28 06:31:54 -0700
committerJohn Lo <loj@cisco.com>2016-10-29 13:15:14 +0000
commit8c1bebe83f7e277a36b8f570ed88363a5f3639b3 (patch)
treeea4354126fd522761496af7d8fb035c362eaee2b
parent435a64b530cef7d7a09624717f5235711acef459 (diff)
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>
-rw-r--r--vnet/vnet/dpo/classify_dpo.c5
-rw-r--r--vnet/vnet/dpo/classify_dpo.h4
-rw-r--r--vnet/vnet/dpo/drop_dpo.c2
-rw-r--r--vnet/vnet/ip/ip4_forward.c5
-rw-r--r--vnet/vnet/ip/ip6_forward.c9
-rw-r--r--vnet/vnet/ip/lookup.c2
-rw-r--r--vnet/vnet/mpls/interface.c2
-rw-r--r--vnet/vnet/mpls/mpls.c14
-rw-r--r--vpp/vpp-api/api.c2
9 files changed, 25 insertions, 20 deletions
diff --git a/vnet/vnet/dpo/classify_dpo.c b/vnet/vnet/dpo/classify_dpo.c
index 93f3f0ae275..9e7886c9edd 100644
--- a/vnet/vnet/dpo/classify_dpo.c
+++ b/vnet/vnet/dpo/classify_dpo.c
@@ -40,7 +40,7 @@ classify_dpo_get_index (classify_dpo_t *cd)
}
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 @@ format_classify_dpo (u8 *s, va_list *args)
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 cd35c3c440b..48f4b2bf8a5 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 @@ typedef struct classify_dpo_t
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 26c3e8a06f2..5118d2a45b7 100644
--- a/vnet/vnet/dpo/drop_dpo.c
+++ b/vnet/vnet/dpo/drop_dpo.c
@@ -24,7 +24,7 @@ static dpo_id_t drop_dpos[DPO_PROTO_NUM];
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 bfa9f0a54f4..d69a3c37dd7 100644
--- a/vnet/vnet/ip/ip4_forward.c
+++ b/vnet/vnet/ip/ip4_forward.c
@@ -654,7 +654,7 @@ ip4_add_interface_routes (u32 sw_if_index,
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 @@ int vnet_set_ip4_classify_intfc (vlib_main_t * vm, u32 sw_if_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,
diff --git a/vnet/vnet/ip/ip6_forward.c b/vnet/vnet/ip/ip6_forward.c
index c285af9544f..bdcdbf0dc82 100644
--- a/vnet/vnet/ip/ip6_forward.c
+++ b/vnet/vnet/ip/ip6_forward.c
@@ -354,9 +354,8 @@ ip6_add_interface_routes (vnet_main_t * vnm, u32 sw_if_index,
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 @@ int vnet_set_ip6_classify_intfc (vlib_main_t * vm, u32 sw_if_index,
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 78152f01c04..4ddbb54279e 100644
--- a/vnet/vnet/ip/lookup.c
+++ b/vnet/vnet/ip/lookup.c
@@ -296,7 +296,7 @@ static uword unformat_dpo (unformat_input_t * input, va_list * args)
}
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 726e6720bf2..af0428cec8d 100644
--- a/vnet/vnet/mpls/interface.c
+++ b/vnet/vnet/mpls/interface.c
@@ -941,7 +941,7 @@ int vnet_mpls_ethernet_add_del_policy_tunnel (u8 *dst,
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 ac35e5d4144..aa1d963dca1 100644
--- a/vnet/vnet/mpls/mpls.c
+++ b/vnet/vnet/mpls/mpls.c
@@ -528,7 +528,7 @@ vnet_mpls_local_label (vlib_main_t * vm,
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 @@ vnet_mpls_local_label (vlib_main_t * vm,
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 @@ vnet_mpls_local_label (vlib_main_t * vm,
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 @@ vnet_mpls_local_label (vlib_main_t * vm,
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 9af8dbc6a66..832ea66e914 100644
--- a/vpp/vpp-api/api.c
+++ b/vpp/vpp-api/api.c
@@ -1126,7 +1126,7 @@ add_del_route_t_handler (u8 is_multipath,
}
dpo_set (&dpo, DPO_CLASSIFY, dproto,
- classify_dpo_create (prefix->fp_proto,
+ classify_dpo_create (dproto,
ntohl (classify_table_index)));
}
else