summaryrefslogtreecommitdiffstats
path: root/src/plugins/lb/api.c
diff options
context:
space:
mode:
authorHongjun Ni <hongjun.ni@intel.com>2018-06-28 20:14:19 +0800
committerDamjan Marion <dmarion@me.com>2018-08-31 16:00:17 +0000
commit219cc90cb435cfcfb5154c6c0e49bd4d60aae769 (patch)
treefdb5a73307ee5d27073781228a18f9b38b0c6080 /src/plugins/lb/api.c
parentd69f4396bfe6b41ca04b7fc1496475f0a635b0da (diff)
Support lb on both vip and per-port-vip case
Previously, a service is specified by vip. This patch extend that a service is specified by both vip and per-port-vip cases. Change-Id: Icbfd1f972c6bafde7d85c6abb498576bd9ba250d Signed-off-by: Hongjun Ni <hongjun.ni@intel.com>
Diffstat (limited to 'src/plugins/lb/api.c')
-rw-r--r--src/plugins/lb/api.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/plugins/lb/api.c b/src/plugins/lb/api.c
index afaf61c459a..18aae43b11d 100644
--- a/src/plugins/lb/api.c
+++ b/src/plugins/lb/api.c
@@ -109,11 +109,19 @@ 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))
+ {
+ mp->protocol = ~0;
+ mp->port = 0;
+ }
+
memcpy (&(args.prefix.ip6), mp->ip_prefix, sizeof(args.prefix.ip6));
if (mp->is_del) {
u32 vip_index;
- if (!(rv = lb_vip_find_index(&(args.prefix), mp->prefix_length, &vip_index)))
+ if (!(rv = lb_vip_find_index(&(args.prefix), mp->prefix_length,
+ mp->protocol, mp->port, &vip_index)))
rv = lb_vip_del(vip_index);
} else {
u32 vip_index;
@@ -147,9 +155,7 @@ vl_api_lb_add_del_vip_t_handler
else if ((mp->encap == LB_ENCAP_TYPE_NAT4)
||(mp->encap == LB_ENCAP_TYPE_NAT6)) {
args.encap_args.srv_type = mp->type;
- args.encap_args.port = ntohs(mp->port);
args.encap_args.target_port = ntohs(mp->target_port);
- args.encap_args.node_port = ntohs(mp->node_port);
}
rv = lb_vip_add(args, &vip_index);
@@ -182,7 +188,6 @@ static void *vl_api_lb_add_del_vip_t_print
s = format (s, "type %u ", mp->type);
s = format (s, "port %u ", mp->port);
s = format (s, "target_port %u ", mp->target_port);
- s = format (s, "node_port %u ", mp->node_port);
}
s = format (s, "%u ", mp->new_flows_table_length);
@@ -208,7 +213,8 @@ vl_api_lb_add_del_as_t_handler
memcpy(&as_address.ip6, mp->as_address,
sizeof(as_address.ip6));
- if ((rv = lb_vip_find_index(&vip_ip_prefix, mp->vip_prefix_length, &vip_index)))
+ if ((rv = lb_vip_find_index(&vip_ip_prefix, mp->vip_prefix_length,
+ mp->protocol, mp->port, &vip_index)))
goto done;
if (mp->is_del)