summaryrefslogtreecommitdiffstats
path: root/src/vnet/flow/flow_api.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/vnet/flow/flow_api.c')
-rw-r--r--src/vnet/flow/flow_api.c58
1 files changed, 58 insertions, 0 deletions
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;