aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/ip
diff options
context:
space:
mode:
Diffstat (limited to 'src/vnet/ip')
-rw-r--r--src/vnet/ip/ip.api32
-rw-r--r--src/vnet/ip/ip6_packet.h18
-rw-r--r--src/vnet/ip/ip_api.c30
3 files changed, 41 insertions, 39 deletions
diff --git a/src/vnet/ip/ip.api b/src/vnet/ip/ip.api
index b94d6d748b2..282f531e4fb 100644
--- a/src/vnet/ip/ip.api
+++ b/src/vnet/ip/ip.api
@@ -19,7 +19,8 @@
called through a shared memory interface.
*/
-option version = "1.0.1";
+option version = "1.1.0";
+import "vnet/fib/fib_types.api";
/** \brief Add / del table request
A table can be added multiple times, but need be deleted only once.
@@ -52,33 +53,6 @@ define ip_fib_dump
u32 context;
};
-/** \brief FIB path
- @param sw_if_index - index of the interface
- @param weight - The weight, for UCMP
- @param preference - The preference of the path. lowest preference is prefered
- @param is_local - local if non-zero, else remote
- @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 afi - the afi of the next hop, IP46_TYPE_IP4=1, IP46_TYPE_IP6=2
- @param next_hop[16] - the next hop address
-
- WARNING: this type is replicated, pending cleanup completion
-*/
-typeonly manual_print manual_endian define fib_path
-{
- u32 sw_if_index;
- u32 table_id;
- u8 weight;
- u8 preference;
- u8 is_local;
- u8 is_drop;
- u8 is_unreach;
- u8 is_prohibit;
- u8 afi;
- u8 next_hop[16];
-};
-
/** \brief IP FIB table response
@param table_id - IP fib table id
@address_length - mask length
@@ -420,7 +394,7 @@ autoreply define ip_add_del_route
u8 next_hop_address[16];
u8 next_hop_n_out_labels;
u32 next_hop_via_label;
- u32 next_hop_out_label_stack[next_hop_n_out_labels];
+ vl_api_fib_mpls_label_t next_hop_out_label_stack[next_hop_n_out_labels];
};
/** \brief Add / del route request
diff --git a/src/vnet/ip/ip6_packet.h b/src/vnet/ip/ip6_packet.h
index 76e3c1f93f0..a02f8b2ea8e 100644
--- a/src/vnet/ip/ip6_packet.h
+++ b/src/vnet/ip/ip6_packet.h
@@ -342,11 +342,27 @@ typedef struct
} ip6_header_t;
always_inline u8
-ip6_traffic_class (ip6_header_t * i)
+ip6_traffic_class (const ip6_header_t * i)
{
return (i->ip_version_traffic_class_and_flow_label & 0x0FF00000) >> 20;
}
+static_always_inline u8
+ip6_traffic_class_network_order (const ip6_header_t * ip6)
+{
+ return (clib_net_to_host_u32 (ip6->ip_version_traffic_class_and_flow_label)
+ & 0x0ff00000) >> 20;
+}
+
+static_always_inline void
+ip6_set_traffic_class_network_order (ip6_header_t * ip6, u8 dscp)
+{
+ u32 tmp =
+ clib_net_to_host_u32 (ip6->ip_version_traffic_class_and_flow_label);
+ tmp |= (dscp << 20);
+ ip6->ip_version_traffic_class_and_flow_label = clib_host_to_net_u32 (tmp);
+}
+
always_inline void *
ip6_next_header (ip6_header_t * i)
{
diff --git a/src/vnet/ip/ip_api.c b/src/vnet/ip/ip_api.c
index 60fa2faf926..726d24ca5a8 100644
--- a/src/vnet/ip/ip_api.c
+++ b/src/vnet/ip/ip_api.c
@@ -867,7 +867,7 @@ add_del_route_t_handler (u8 is_multipath,
u16 next_hop_weight,
u16 next_hop_preference,
mpls_label_t next_hop_via_label,
- mpls_label_t * next_hop_out_label_stack)
+ fib_mpls_label_t * next_hop_out_label_stack)
{
vnet_classify_main_t *cm = &vnet_classify_main;
fib_route_path_flags_t path_flags = FIB_ROUTE_PATH_FLAG_NONE;
@@ -1071,7 +1071,7 @@ static int
ip4_add_del_route_t_handler (vl_api_ip_add_del_route_t * mp)
{
u32 fib_index, next_hop_fib_index;
- mpls_label_t *label_stack = NULL;
+ fib_mpls_label_t *label_stack = NULL;
int rv, ii, n_labels;;
rv = add_del_route_check (FIB_PROTOCOL_IP4,
@@ -1097,13 +1097,19 @@ ip4_add_del_route_t_handler (vl_api_ip_add_del_route_t * mp)
n_labels = mp->next_hop_n_out_labels;
if (n_labels == 0)
;
- else if (1 == n_labels)
- vec_add1 (label_stack, ntohl (mp->next_hop_out_label_stack[0]));
else
{
vec_validate (label_stack, n_labels - 1);
for (ii = 0; ii < n_labels; ii++)
- label_stack[ii] = ntohl (mp->next_hop_out_label_stack[ii]);
+ {
+ label_stack[ii].fml_value =
+ ntohl (mp->next_hop_out_label_stack[ii].label);
+ label_stack[ii].fml_ttl = mp->next_hop_out_label_stack[ii].ttl;
+ label_stack[ii].fml_exp = mp->next_hop_out_label_stack[ii].exp;
+ label_stack[ii].fml_mode =
+ (mp->next_hop_out_label_stack[ii].is_uniform ?
+ FIB_MPLS_LSP_MODE_UNIFORM : FIB_MPLS_LSP_MODE_PIPE);
+ }
}
return (add_del_route_t_handler (mp->is_multipath,
@@ -1133,8 +1139,8 @@ ip4_add_del_route_t_handler (vl_api_ip_add_del_route_t * mp)
static int
ip6_add_del_route_t_handler (vl_api_ip_add_del_route_t * mp)
{
+ fib_mpls_label_t *label_stack = NULL;
u32 fib_index, next_hop_fib_index;
- mpls_label_t *label_stack = NULL;
int rv, ii, n_labels;;
rv = add_del_route_check (FIB_PROTOCOL_IP6,
@@ -1160,13 +1166,19 @@ ip6_add_del_route_t_handler (vl_api_ip_add_del_route_t * mp)
n_labels = mp->next_hop_n_out_labels;
if (n_labels == 0)
;
- else if (1 == n_labels)
- vec_add1 (label_stack, ntohl (mp->next_hop_out_label_stack[0]));
else
{
vec_validate (label_stack, n_labels - 1);
for (ii = 0; ii < n_labels; ii++)
- label_stack[ii] = ntohl (mp->next_hop_out_label_stack[ii]);
+ {
+ label_stack[ii].fml_value =
+ ntohl (mp->next_hop_out_label_stack[ii].label);
+ label_stack[ii].fml_ttl = mp->next_hop_out_label_stack[ii].ttl;
+ label_stack[ii].fml_exp = mp->next_hop_out_label_stack[ii].exp;
+ label_stack[ii].fml_mode =
+ (mp->next_hop_out_label_stack[ii].is_uniform ?
+ FIB_MPLS_LSP_MODE_UNIFORM : FIB_MPLS_LSP_MODE_PIPE);
+ }
}
return (add_del_route_t_handler (mp->is_multipath,