aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVratko Polak <vrpolak@cisco.com>2019-09-20 18:56:49 +0200
committerPaul Vinciguerra <pvinci@vinciconsulting.com>2019-10-30 00:36:02 +0000
commit40680c6601b8d02b820540461f805a46a3e354a8 (patch)
tree2f8907f5a5857229596a2eb7a0ff6af65bbccfb0
parent97ea2f4ec0ec337a4d391f5225e89d12ba2ddb38 (diff)
lb: refactor ntohl in lb_conf handler
Type: refactor Change-Id: Ibe8f3c1ed5c04d1800fea9b9a90772816aa38d65 Signed-off-by: Vratko Polak <vrpolak@cisco.com>
-rw-r--r--src/plugins/lb/api.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/plugins/lb/api.c b/src/plugins/lb/api.c
index cafa212a710..67a26d54902 100644
--- a/src/plugins/lb/api.c
+++ b/src/plugins/lb/api.c
@@ -48,19 +48,19 @@ vl_api_lb_conf_t_handler
{
lb_main_t *lbm = &lb_main;
vl_api_lb_conf_reply_t * rmp;
+ u32 sticky_buckets_per_core, flow_timeout;
int rv = 0;
- if (mp->sticky_buckets_per_core == ~0) {
- mp->sticky_buckets_per_core = htonl(lbm->per_cpu_sticky_buckets);
- }
- if (mp->flow_timeout == ~0) {
- mp->flow_timeout = htonl(lbm->flow_timeout);
- }
+ sticky_buckets_per_core = mp->sticky_buckets_per_core == ~0
+ ? lbm->per_cpu_sticky_buckets
+ : ntohl(mp->sticky_buckets_per_core);
+ flow_timeout = mp->flow_timeout == ~0
+ ? lbm->flow_timeout
+ : ntohl(mp->flow_timeout);
rv = lb_conf((ip4_address_t *)&mp->ip4_src_address,
- (ip6_address_t *)&mp->ip6_src_address,
- ntohl(mp->sticky_buckets_per_core),
- ntohl(mp->flow_timeout));
+ (ip6_address_t *)&mp->ip6_src_address,
+ sticky_buckets_per_core, flow_timeout);
REPLY_MACRO (VL_API_LB_CONF_REPLY);
}