aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/lb/api.c
diff options
context:
space:
mode:
authorHongjun Ni <hongjun.ni@intel.com>2019-02-18 23:26:48 +0800
committerDamjan Marion <dmarion@me.com>2019-03-07 10:25:26 +0000
commit313f1b9e5b964fc2e6f654576e2dd50a904846d6 (patch)
treebaed47ac7694f51192fd5e782467a0deca2eca85 /src/plugins/lb/api.c
parentf8d2e860999784739a5ea99b7c1f97d19673256a (diff)
Add VAT support for LB
Change-Id: I61d8c35f48a059968909fc8523bd313fc4799389 Signed-off-by: Hongjun Ni <hongjun.ni@intel.com>
Diffstat (limited to 'src/plugins/lb/api.c')
-rw-r--r--src/plugins/lb/api.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/plugins/lb/api.c b/src/plugins/lb/api.c
index c392123c792..07476be70fd 100644
--- a/src/plugins/lb/api.c
+++ b/src/plugins/lb/api.c
@@ -109,11 +109,10 @@ vl_api_lb_add_del_vip_t_handler
int rv = 0;
lb_vip_add_args_t args;
- if((mp->protocol != IP_PROTOCOL_TCP)
- && (mp->protocol != IP_PROTOCOL_UDP))
+ /* if port == 0, it means all-port VIP */
+ if (mp->port == 0)
{
mp->protocol = ~0;
- mp->port = 0;
}
memcpy (&(args.prefix.ip6), mp->ip_prefix, sizeof(args.prefix.ip6));
@@ -121,7 +120,7 @@ vl_api_lb_add_del_vip_t_handler
if (mp->is_del) {
u32 vip_index;
if (!(rv = lb_vip_find_index(&(args.prefix), mp->prefix_length,
- mp->protocol, mp->port, &vip_index)))
+ mp->protocol, ntohs(mp->port), &vip_index)))
rv = lb_vip_del(vip_index);
} else {
u32 vip_index;
@@ -146,6 +145,8 @@ vl_api_lb_add_del_vip_t_handler
}
args.plen = mp->prefix_length;
+ args.protocol = mp->protocol;
+ args.port = ntohs(mp->port);
args.type = type;
args.new_length = ntohl(mp->new_flows_table_length);
@@ -214,7 +215,7 @@ vl_api_lb_add_del_as_t_handler
sizeof(as_address.ip6));
if ((rv = lb_vip_find_index(&vip_ip_prefix, mp->vip_prefix_length,
- mp->protocol, mp->port, &vip_index)))
+ mp->protocol, ntohs(mp->port), &vip_index)))
goto done;
if (mp->is_del)
@@ -260,7 +261,7 @@ vl_api_lb_flush_vip_t_handler
vip_plen = mp->prefix_length;
rv = lb_vip_find_index(&vip_prefix, vip_plen, mp->protocol,
- (u16)mp->port, &vip_index);
+ ntohs(mp->port), &vip_index);
rv = lb_flush_vip_as(vip_index, ~0);