aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/ikev2
diff options
context:
space:
mode:
authorAleksander Djuric <aleksander.djuric@gmail.com>2019-11-11 15:30:24 +0300
committerAndrew Yourtchenko <ayourtch@gmail.com>2020-02-13 12:18:44 +0000
commit6255d30069a937477e23c8b1a7d9fcbb5f8e45b1 (patch)
tree803e209703137c019cc7b3af44b44242380931d5 /src/plugins/ikev2
parentd3f6dc69bea7ffacbf5455a1f923c0a1af2ead23 (diff)
ikev2: correct byte order in api handlers
Type: fix Signed-off-by: Aleksander Djuric <aleksander.djuric@gmail.com> Change-Id: I186286b8959ae138528a5171c22d3e1b00f46baf Signed-off-by: Aleksander Djuric <aleksander.djuric@gmail.com> (cherry picked from commit 50c99b4a8679e6c0d6f48677a5b91455bb612c86)
Diffstat (limited to 'src/plugins/ikev2')
-rw-r--r--src/plugins/ikev2/ikev2_api.c31
1 files changed, 21 insertions, 10 deletions
diff --git a/src/plugins/ikev2/ikev2_api.c b/src/plugins/ikev2/ikev2_api.c
index b7b8d6ddcee..bff13ac4626 100644
--- a/src/plugins/ikev2/ikev2_api.c
+++ b/src/plugins/ikev2/ikev2_api.c
@@ -176,9 +176,12 @@ vl_api_ikev2_profile_set_ts_t_handler (vl_api_ikev2_profile_set_ts_t * mp)
vlib_main_t *vm = vlib_get_main ();
clib_error_t *error;
u8 *tmp = format (0, "%s", mp->name);
- error = ikev2_set_profile_ts (vm, tmp, mp->proto, mp->start_port,
- mp->end_port, (ip4_address_t) mp->start_addr,
- (ip4_address_t) mp->end_addr, mp->is_local);
+ error =
+ ikev2_set_profile_ts (vm, tmp, mp->proto,
+ clib_net_to_host_u16 (mp->start_port),
+ clib_net_to_host_u16 (mp->end_port),
+ (ip4_address_t) mp->start_addr,
+ (ip4_address_t) mp->end_addr, mp->is_local);
vec_free (tmp);
if (error)
rv = VNET_API_ERROR_UNSPECIFIED;
@@ -223,7 +226,7 @@ vl_api_ikev2_set_responder_t_handler (vl_api_ikev2_set_responder_t * mp)
ip4_address_t ip4;
clib_memcpy (&ip4, mp->address, sizeof (ip4));
- error = ikev2_set_profile_responder (vm, tmp, mp->sw_if_index, ip4);
+ error = ikev2_set_profile_responder (vm, tmp, ntohl (mp->sw_if_index), ip4);
vec_free (tmp);
if (error)
rv = VNET_API_ERROR_UNSPECIFIED;
@@ -248,8 +251,10 @@ vl_api_ikev2_set_ike_transforms_t_handler (vl_api_ikev2_set_ike_transforms_t *
u8 *tmp = format (0, "%s", mp->name);
error =
- ikev2_set_profile_ike_transforms (vm, tmp, mp->crypto_alg, mp->integ_alg,
- mp->dh_group, mp->crypto_key_size);
+ ikev2_set_profile_ike_transforms (vm, tmp, ntohl (mp->crypto_alg),
+ ntohl (mp->integ_alg),
+ ntohl (mp->dh_group),
+ ntohl (mp->crypto_key_size));
vec_free (tmp);
if (error)
rv = VNET_API_ERROR_UNSPECIFIED;
@@ -274,8 +279,10 @@ vl_api_ikev2_set_esp_transforms_t_handler (vl_api_ikev2_set_esp_transforms_t *
u8 *tmp = format (0, "%s", mp->name);
error =
- ikev2_set_profile_esp_transforms (vm, tmp, mp->crypto_alg, mp->integ_alg,
- mp->dh_group, mp->crypto_key_size);
+ ikev2_set_profile_esp_transforms (vm, tmp, ntohl (mp->crypto_alg),
+ ntohl (mp->integ_alg),
+ ntohl (mp->dh_group),
+ ntohl (mp->crypto_key_size));
vec_free (tmp);
if (error)
rv = VNET_API_ERROR_UNSPECIFIED;
@@ -299,8 +306,12 @@ vl_api_ikev2_set_sa_lifetime_t_handler (vl_api_ikev2_set_sa_lifetime_t * mp)
u8 *tmp = format (0, "%s", mp->name);
error =
- ikev2_set_profile_sa_lifetime (vm, tmp, mp->lifetime, mp->lifetime_jitter,
- mp->handover, mp->lifetime_maxdata);
+ ikev2_set_profile_sa_lifetime (vm, tmp,
+ clib_net_to_host_u64 (mp->lifetime),
+ ntohl (mp->lifetime_jitter),
+ ntohl (mp->handover),
+ clib_net_to_host_u64
+ (mp->lifetime_maxdata));
vec_free (tmp);
if (error)
rv = VNET_API_ERROR_UNSPECIFIED;