aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet
diff options
context:
space:
mode:
Diffstat (limited to 'src/vnet')
-rw-r--r--src/vnet/flow/FEATURE.yaml4
-rw-r--r--src/vnet/flow/flow.api2
-rw-r--r--src/vnet/flow/flow_api.c58
3 files changed, 63 insertions, 1 deletions
diff --git a/src/vnet/flow/FEATURE.yaml b/src/vnet/flow/FEATURE.yaml
index cd86429557c..a26571c35e8 100644
--- a/src/vnet/flow/FEATURE.yaml
+++ b/src/vnet/flow/FEATURE.yaml
@@ -4,6 +4,8 @@ maintainer: Damjan Marion <damarion@cisco.com>
features:
- Four APIs are provided - flow_add, flow_del, flow_enable and flow_disable
- The below flow types are currently supported:
+ - FLOW_TYPE_IP4,
+ - FLOW_TYPE_IP6,
- FLOW_TYPE_IP4_N_TUPLE,
- FLOW_TYPE_IP6_N_TUPLE,
- FLOW_TYPE_IP4_N_TUPLE_TAGGED,
@@ -11,6 +13,8 @@ features:
- FLOW_TYPE_IP4_L2TPV3OIP,
- FLOW_TYPE_IP4_IPSEC_ESP,
- FLOW_TYPE_IP4_IPSEC_AH,
+ - FLOW_TYPE_IP4_VXLAN,
+ - FLOW_TYPE_IP6_VXLAN,
- FLOW_TYPE_IP4_GTPC,
- FLOW_TYPE_IP4_GTPU
- The below flow actions can be specified for the flows:
diff --git a/src/vnet/flow/flow.api b/src/vnet/flow/flow.api
index b819847e998..7bb21cdcd72 100644
--- a/src/vnet/flow/flow.api
+++ b/src/vnet/flow/flow.api
@@ -13,7 +13,7 @@
* limitations under the License.
*/
-option version = "0.0.1";
+option version = "0.0.2";
import "vnet/interface_types.api";
import "vnet/ip/ip_types.api";
diff --git a/src/vnet/flow/flow_api.c b/src/vnet/flow/flow_api.c
index b24c8510be5..4d0c536f113 100644
--- a/src/vnet/flow/flow_api.c
+++ b/src/vnet/flow/flow_api.c
@@ -83,6 +83,24 @@ port_and_mask_convert (vl_api_ip_port_and_mask_t * vl_api_port,
}
static inline void
+ipv4_flow_convert (vl_api_flow_ip4_t *vl_api_flow, vnet_flow_ip4_t *f)
+{
+ ipv4_addr_and_mask_convert (&vl_api_flow->src_addr, &f->src_addr);
+ ipv4_addr_and_mask_convert (&vl_api_flow->dst_addr, &f->dst_addr);
+
+ protocol_and_mask_convert (&vl_api_flow->protocol, &f->protocol);
+}
+
+static void
+ipv6_flow_convert (vl_api_flow_ip6_t *vl_api_flow, vnet_flow_ip6_t *f)
+{
+ ipv6_addr_and_mask_convert (&vl_api_flow->src_addr, &f->src_addr);
+ ipv6_addr_and_mask_convert (&vl_api_flow->dst_addr, &f->dst_addr);
+
+ protocol_and_mask_convert (&vl_api_flow->protocol, &f->protocol);
+}
+
+static inline void
ipv4_n_tuple_flow_convert (vl_api_flow_ip4_n_tuple_t * vl_api_flow,
vnet_flow_ip4_n_tuple_t * f)
{
@@ -158,6 +176,34 @@ ipv4_ipsec_ah_flow_convert (vl_api_flow_ip4_ipsec_ah_t * vl_api_flow,
}
static inline void
+ipv4_vxlan_flow_convert (vl_api_flow_ip4_vxlan_t *vl_api_flow,
+ vnet_flow_ip4_vxlan_t *f)
+{
+ ipv4_addr_and_mask_convert (&vl_api_flow->src_addr, &f->src_addr);
+ ipv4_addr_and_mask_convert (&vl_api_flow->dst_addr, &f->dst_addr);
+ protocol_and_mask_convert (&vl_api_flow->protocol, &f->protocol);
+
+ port_and_mask_convert (&vl_api_flow->src_port, &f->src_port);
+ port_and_mask_convert (&vl_api_flow->dst_port, &f->dst_port);
+
+ f->vni = ntohs (vl_api_flow->vni);
+}
+
+static inline void
+ipv6_vxlan_flow_convert (vl_api_flow_ip6_vxlan_t *vl_api_flow,
+ vnet_flow_ip6_vxlan_t *f)
+{
+ ipv6_addr_and_mask_convert (&vl_api_flow->src_addr, &f->src_addr);
+ ipv6_addr_and_mask_convert (&vl_api_flow->dst_addr, &f->dst_addr);
+ protocol_and_mask_convert (&vl_api_flow->protocol, &f->protocol);
+
+ port_and_mask_convert (&vl_api_flow->src_port, &f->src_port);
+ port_and_mask_convert (&vl_api_flow->dst_port, &f->dst_port);
+
+ f->vni = ntohs (vl_api_flow->vni);
+}
+
+static inline void
ipv4_gtpu_flow_convert (vl_api_flow_ip4_gtpu_t * vl_api_flow,
vnet_flow_ip4_gtpu_t * f)
{
@@ -207,6 +253,12 @@ vl_api_flow_add_t_handler (vl_api_flow_add_t * mp)
switch (flow.type)
{
+ case VNET_FLOW_TYPE_IP4:
+ ipv4_flow_convert (&f->flow.ip4, &flow.ip4);
+ break;
+ case VNET_FLOW_TYPE_IP6:
+ ipv6_flow_convert (&f->flow.ip6, &flow.ip6);
+ break;
case VNET_FLOW_TYPE_IP4_N_TUPLE:
ipv4_n_tuple_flow_convert (&f->flow.ip4_n_tuple, &flow.ip4_n_tuple);
break;
@@ -232,6 +284,12 @@ vl_api_flow_add_t_handler (vl_api_flow_add_t * mp)
case VNET_FLOW_TYPE_IP4_IPSEC_AH:
ipv4_ipsec_ah_flow_convert (&f->flow.ip4_ipsec_ah, &flow.ip4_ipsec_ah);
break;
+ case VNET_FLOW_TYPE_IP4_VXLAN:
+ ipv4_vxlan_flow_convert (&f->flow.ip4_vxlan, &flow.ip4_vxlan);
+ break;
+ case VNET_FLOW_TYPE_IP6_VXLAN:
+ ipv6_vxlan_flow_convert (&f->flow.ip6_vxlan, &flow.ip6_vxlan);
+ break;
case VNET_FLOW_TYPE_IP4_GTPU:
ipv4_gtpu_flow_convert (&f->flow.ip4_gtpu, &flow.ip4_gtpu);
break;