aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet
diff options
context:
space:
mode:
Diffstat (limited to 'src/vnet')
-rw-r--r--src/vnet/ip/ip.c4
-rwxr-xr-xsrc/vnet/session/session_api.c12
-rw-r--r--src/vnet/session/session_rules_table.c18
3 files changed, 18 insertions, 16 deletions
diff --git a/src/vnet/ip/ip.c b/src/vnet/ip/ip.c
index 0c4687d81a1..b6825c30709 100644
--- a/src/vnet/ip/ip.c
+++ b/src/vnet/ip/ip.c
@@ -254,8 +254,8 @@ ip6_mask_to_preflen (ip6_address_t * mask)
u8 first1, first0;
if (mask->as_u64[0] == 0 && mask->as_u64[1] == 0)
return 0;
- first1 = log2_first_set (mask->as_u64[1]);
- first0 = log2_first_set (mask->as_u64[0]);
+ first1 = log2_first_set (clib_net_to_host_u64 (mask->as_u64[1]));
+ first0 = log2_first_set (clib_net_to_host_u64 (mask->as_u64[0]));
if (first1 != 0)
return 128 - first1;
diff --git a/src/vnet/session/session_api.c b/src/vnet/session/session_api.c
index e987854bc73..f15d2f6e830 100755
--- a/src/vnet/session/session_api.c
+++ b/src/vnet/session/session_api.c
@@ -834,8 +834,8 @@ vl_api_session_rule_add_del_t_handler (vl_api_session_rule_add_del_t * mp)
table_args->lcl.fp_proto = fib_proto;
table_args->rmt.fp_len = mp->rmt_plen;
table_args->rmt.fp_proto = fib_proto;
- table_args->lcl_port = clib_net_to_host_u16 (mp->lcl_port);
- table_args->rmt_port = clib_net_to_host_u16 (mp->rmt_port);
+ table_args->lcl_port = mp->lcl_port;
+ table_args->rmt_port = mp->rmt_port;
table_args->action_index = clib_net_to_host_u32 (mp->action_index);
table_args->is_add = mp->is_add;
mp->tag[sizeof (mp->tag) - 1] = 0;
@@ -879,8 +879,8 @@ send_session_rule_details4 (mma_rule_16_t * rule, u8 is_local,
clib_memcpy (rmp->rmt_ip, &match->rmt_ip, sizeof (match->rmt_ip));
rmp->lcl_plen = ip4_mask_to_preflen (&mask->lcl_ip);
rmp->rmt_plen = ip4_mask_to_preflen (&mask->rmt_ip);
- rmp->lcl_port = clib_host_to_net_u16 (match->lcl_port);
- rmp->rmt_port = clib_host_to_net_u16 (match->rmt_port);
+ rmp->lcl_port = match->lcl_port;
+ rmp->rmt_port = match->rmt_port;
rmp->action_index = clib_host_to_net_u32 (rule->action_index);
rmp->scope =
is_local ? SESSION_RULE_SCOPE_LOCAL : SESSION_RULE_SCOPE_GLOBAL;
@@ -916,8 +916,8 @@ send_session_rule_details6 (mma_rule_40_t * rule, u8 is_local,
clib_memcpy (rmp->rmt_ip, &match->rmt_ip, sizeof (match->rmt_ip));
rmp->lcl_plen = ip6_mask_to_preflen (&mask->lcl_ip);
rmp->rmt_plen = ip6_mask_to_preflen (&mask->rmt_ip);
- rmp->lcl_port = clib_host_to_net_u16 (match->lcl_port);
- rmp->rmt_port = clib_host_to_net_u16 (match->rmt_port);
+ rmp->lcl_port = match->lcl_port;
+ rmp->rmt_port = match->rmt_port;
rmp->action_index = clib_host_to_net_u32 (rule->action_index);
rmp->scope =
is_local ? SESSION_RULE_SCOPE_LOCAL : SESSION_RULE_SCOPE_GLOBAL;
diff --git a/src/vnet/session/session_rules_table.c b/src/vnet/session/session_rules_table.c
index fa8a056fbf0..abe2a2bb7af 100644
--- a/src/vnet/session/session_rules_table.c
+++ b/src/vnet/session/session_rules_table.c
@@ -128,10 +128,11 @@ format_session_rule4 (u8 * s, va_list * args)
s = format (s, "[%d] rule: %U/%d %d %U/%d %d action: %d tag: %v", ri,
format_ip4_address, &match->lcl_ip,
- ip4_mask_to_preflen (&mask->lcl_ip), match->lcl_port,
- format_ip4_address, &match->rmt_ip,
- ip4_mask_to_preflen (&mask->rmt_ip), match->rmt_port,
- sr->action_index, tag ? tag : null_tag);
+ ip4_mask_to_preflen (&mask->lcl_ip),
+ clib_net_to_host_u16 (match->lcl_port), format_ip4_address,
+ &match->rmt_ip, ip4_mask_to_preflen (&mask->rmt_ip),
+ clib_net_to_host_u16 (match->rmt_port), sr->action_index,
+ tag ? tag : null_tag);
if (vec_len (sr->next_indices))
{
s = format (s, "\n children: ");
@@ -161,10 +162,11 @@ format_session_rule6 (u8 * s, va_list * args)
s = format (s, "[%d] rule: %U/%d %d %U/%d %d action: %d tag: %v", ri,
format_ip6_address, &match->lcl_ip,
- ip6_mask_to_preflen (&mask->lcl_ip), match->lcl_port,
- format_ip6_address, &match->rmt_ip,
- ip6_mask_to_preflen (&mask->rmt_ip), match->rmt_port,
- sr->action_index, tag ? tag : null_tag);
+ ip6_mask_to_preflen (&mask->lcl_ip),
+ clib_net_to_host_u16 (match->lcl_port), format_ip6_address,
+ &match->rmt_ip, ip6_mask_to_preflen (&mask->rmt_ip),
+ clib_net_to_host_u16 (match->rmt_port), sr->action_index,
+ tag ? tag : null_tag);
if (vec_len (sr->next_indices))
{
s = format (s, "\n children: ");