aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/cnat/cnat_api.c
diff options
context:
space:
mode:
authorNathan Skrzypczak <nathan.skrzypczak@gmail.com>2021-02-25 11:14:53 +0100
committerFlorin Coras <florin.coras@gmail.com>2021-02-26 01:55:07 +0000
commit4d237874e5c9922330c62ac1b003a9a171c1bc3b (patch)
tree3ce74a3e85659124653e8406635bec29e156b9f2 /src/plugins/cnat/cnat_api.c
parent27647a27c7b1e800547e3a3ea97b099b25618177 (diff)
cnat: Add maglev support
* Backend choice in translations is controlled by lb_type switch allowing to enable Maglev. * Size of pool is set with cnat { maglev-len 1009 } Type: feature Change-Id: I956e19d70bc9f3b997b4f8042831164e4b559d17 Signed-off-by: Nathan Skrzypczak <nathan.skrzypczak@gmail.com>
Diffstat (limited to 'src/plugins/cnat/cnat_api.c')
-rw-r--r--src/plugins/cnat/cnat_api.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/plugins/cnat/cnat_api.c b/src/plugins/cnat/cnat_api.c
index 1c6ef7b6cf4..99d9c729282 100644
--- a/src/plugins/cnat/cnat_api.c
+++ b/src/plugins/cnat/cnat_api.c
@@ -67,6 +67,7 @@ cnat_endpoint_tuple_decode (const vl_api_cnat_endpoint_tuple_t * in,
if (rv)
return rv;
rv = cnat_endpoint_decode (&in->dst_ep, &out->dst_ep);
+ out->ep_flags = in->flags;
return rv;
}
@@ -95,6 +96,7 @@ vl_api_cnat_translation_update_t_handler (vl_api_cnat_translation_update_t
u8 flags;
int rv = 0;
u32 pi, n_paths;
+ cnat_lb_type_t lb_type;
rv = ip_proto_decode (mp->translation.ip_proto, &ip_proto);
@@ -119,7 +121,9 @@ vl_api_cnat_translation_update_t_handler (vl_api_cnat_translation_update_t
flags = mp->translation.flags;
if (!mp->translation.is_real_ip)
flags |= CNAT_FLAG_EXCLUSIVE;
- id = cnat_translation_update (&vip, ip_proto, paths, flags);
+
+ lb_type = (cnat_lb_type_t) mp->translation.lb_type;
+ id = cnat_translation_update (&vip, ip_proto, paths, flags, lb_type);
vec_free (paths);
@@ -172,12 +176,14 @@ cnat_translation_send_details (u32 cti, void *args)
mp->translation.id = clib_host_to_net_u32 (cti);
cnat_endpoint_encode (&ct->ct_vip, &mp->translation.vip);
mp->translation.ip_proto = ip_proto_encode (ct->ct_proto);
+ mp->translation.lb_type = (vl_api_cnat_lb_type_t) ct->lb_type;
path = mp->translation.paths;
vec_foreach (trk, ct->ct_paths)
{
cnat_endpoint_encode (&trk->ct_ep[VLIB_TX], &path->dst_ep);
cnat_endpoint_encode (&trk->ct_ep[VLIB_RX], &path->src_ep);
+ path->flags = trk->ct_flags;
path++;
}