aboutsummaryrefslogtreecommitdiffstats
path: root/vpp
diff options
context:
space:
mode:
authorNeale Ranns <nranns@cisco.com>2016-10-20 13:39:34 +0100
committerDamjan Marion <dmarion.lists@gmail.com>2016-10-25 15:09:10 +0000
commit948e00ff5eded0806fc7f54e8f3943aade2bd14a (patch)
tree500ed052d71f7ae81d1f8c5a6449e70c0de0aa40 /vpp
parentdc5aac5c392c977d011233c374154cd83dcebf36 (diff)
Support IETF routing Yang models (VPP-503).
Add support for special routes to send ICMP unreachable or admin prohibited. Change-Id: Ia1ac65b0e5e925c0f9ebc7824141833b4e18f05e Signed-off-by: Neale Ranns <nranns@cisco.com>
Diffstat (limited to 'vpp')
-rw-r--r--vpp/vpp-api/api.c50
-rw-r--r--vpp/vpp-api/vpe.api6
2 files changed, 46 insertions, 10 deletions
diff --git a/vpp/vpp-api/api.c b/vpp/vpp-api/api.c
index cc067402d18..6ac51097df2 100644
--- a/vpp/vpp-api/api.c
+++ b/vpp/vpp-api/api.c
@@ -117,6 +117,7 @@
#include <vnet/dpo/receive_dpo.h>
#include <vnet/dpo/lookup_dpo.h>
#include <vnet/dpo/classify_dpo.h>
+#include <vnet/dpo/ip_null_dpo.h>
#define f64_endian(a)
#define f64_print(a,b)
@@ -1032,6 +1033,8 @@ static int
add_del_route_t_handler (u8 is_multipath,
u8 is_add,
u8 is_drop,
+ u8 is_unreach,
+ u8 is_prohibit,
u8 is_local,
u8 is_classify,
u32 classify_table_index,
@@ -1090,22 +1093,29 @@ add_del_route_t_handler (u8 is_multipath,
dslock (sm, 1 /* release hint */ , 2 /* tag */ );
- if (is_drop || is_local || is_classify)
+ if (is_drop || is_local || is_classify || is_unreach || is_prohibit)
{
/*
* special route types that link directly to the adj
*/
if (is_add)
{
- dpo_id_t dpo = DPO_NULL;
+ dpo_id_t dpo = DPO_INVALID;
dpo_proto_t dproto;
dproto = fib_proto_to_dpo (prefix->fp_proto);
if (is_drop)
- dpo_copy (&dpo, drop_dpo_get (dproto));
+ ip_null_dpo_add_and_lock (dproto, IP_NULL_ACTION_NONE, &dpo);
else if (is_local)
receive_dpo_add_or_lock (dproto, ~0, NULL, &dpo);
+ else if (is_unreach)
+ ip_null_dpo_add_and_lock (dproto,
+ IP_NULL_ACTION_SEND_ICMP_UNREACH, &dpo);
+ else if (is_prohibit)
+ ip_null_dpo_add_and_lock (dproto,
+ IP_NULL_ACTION_SEND_ICMP_PROHIBIT,
+ &dpo);
else if (is_classify)
{
if (pool_is_free_index (cm->tables,
@@ -1125,10 +1135,10 @@ add_del_route_t_handler (u8 is_multipath,
return VNET_API_ERROR_NO_SUCH_TABLE;
}
- fib_table_entry_special_dpo_add (fib_index,
- prefix,
- FIB_SOURCE_API,
- FIB_ENTRY_FLAG_EXCLUSIVE, &dpo);
+ fib_table_entry_special_dpo_update (fib_index,
+ prefix,
+ FIB_SOURCE_API,
+ FIB_ENTRY_FLAG_EXCLUSIVE, &dpo);
dpo_reset (&dpo);
}
else
@@ -1255,7 +1265,17 @@ ip4_add_del_route_t_handler (vl_api_ip_add_del_route_t * mp)
memset (&nh, 0, sizeof (nh));
memcpy (&nh.ip4, mp->next_hop_address, sizeof (nh.ip4));
- return (add_del_route_t_handler (mp->is_multipath, mp->is_add, mp->is_drop, mp->is_local, mp->is_classify, mp->classify_table_index, mp->is_resolve_host, mp->is_resolve_attached, fib_index, &pfx, 1, // is_ip4
+ return (add_del_route_t_handler (mp->is_multipath,
+ mp->is_add,
+ mp->is_drop,
+ mp->is_unreach,
+ mp->is_prohibit,
+ mp->is_local,
+ mp->is_classify,
+ mp->classify_table_index,
+ mp->is_resolve_host,
+ mp->is_resolve_attached,
+ fib_index, &pfx, 1,
&nh,
ntohl (mp->next_hop_sw_if_index),
next_hop_fib_index,
@@ -1290,7 +1310,17 @@ ip6_add_del_route_t_handler (vl_api_ip_add_del_route_t * mp)
memset (&nh, 0, sizeof (nh));
memcpy (&nh.ip6, mp->next_hop_address, sizeof (nh.ip6));
- return (add_del_route_t_handler (mp->is_multipath, mp->is_add, mp->is_drop, mp->is_local, mp->is_classify, mp->classify_table_index, mp->is_resolve_host, mp->is_resolve_attached, fib_index, &pfx, 0, // is_ip4
+ return (add_del_route_t_handler (mp->is_multipath,
+ mp->is_add,
+ mp->is_drop,
+ mp->is_unreach,
+ mp->is_prohibit,
+ mp->is_local,
+ mp->is_classify,
+ mp->classify_table_index,
+ mp->is_resolve_host,
+ mp->is_resolve_attached,
+ fib_index, &pfx, 0,
&nh, ntohl (mp->next_hop_sw_if_index),
next_hop_fib_index,
mp->next_hop_weight,
@@ -1347,6 +1377,8 @@ mpls_route_add_del_t_handler (vnet_main_t * vnm,
memcpy (&nh.ip6, mp->mr_next_hop, sizeof (nh.ip6));
return (add_del_route_t_handler (mp->mr_is_multipath, mp->mr_is_add, 0, // mp->is_drop,
+ 0, // mp->is_unreach,
+ 0, // mp->is_prohibit,
0, // mp->is_local,
mp->mr_is_classify,
mp->mr_classify_table_index,
diff --git a/vpp/vpp-api/vpe.api b/vpp/vpp-api/vpe.api
index ac84bdc5cd5..c5eacce5413 100644
--- a/vpp/vpp-api/vpe.api
+++ b/vpp/vpp-api/vpe.api
@@ -492,7 +492,9 @@ define mpls_ip_bind_unbind_reply
@param create_vrf_if_needed -
@param resolve_if_needed -
@param is_add - 1 if adding the route, 0 if deleting
- @param is_drop -
+ @param is_drop - Drop the packet
+ @param is_unreach - Drop the packet and rate limit send ICMP unreachable
+ @param is_prohibit - Drop the packet and rate limit send ICMP prohibited
@param is_ipv6 - 0 if an ip4 route, else ip6
@param is_local -
@param is_classify -
@@ -517,6 +519,8 @@ define ip_add_del_route
u8 resolve_if_needed;
u8 is_add;
u8 is_drop;
+ u8 is_unreach;
+ u8 is_prohibit;
u8 is_ipv6;
u8 is_local;
u8 is_classify;