aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/lb/api.c
diff options
context:
space:
mode:
authorHongjun Ni <hongjun.ni@intel.com>2018-01-23 19:17:23 +0800
committerHongjun Ni <hongjun.ni@intel.com>2018-02-02 02:20:46 +0000
commit647f609a11e2afb91a5216ca99d0705a3e1212a7 (patch)
tree149ab0443d42a8d8a7620c8bce917ec87edf1ae7 /src/plugins/lb/api.c
parent91389ac2c28ae10f2b7f766e4dfe7a7fd96dc5e0 (diff)
Add L3DSR feature in LB plugin
L3DSR is used to overcome Layer 2 limitations of Direct Server Return Load Balancing. It maps VIP to DSCP bits, and reuse TOS bits to transfer it to server, and then server will get VIP from DSCP-to-VIP mapping. Please refer to https://www.nanog.org/meetings/nanog51/presentations/Monday/NANOG51.Talk45.nanog51-Schaumann.pdf Change-Id: I403ffeadfb04ed0265086eb2dc41f2e17f8f34cb Signed-off-by: Hongjun Ni <hongjun.ni@intel.com>
Diffstat (limited to 'src/plugins/lb/api.c')
-rw-r--r--src/plugins/lb/api.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/src/plugins/lb/api.c b/src/plugins/lb/api.c
index 7eb49ff6c26..28af6daa421 100644
--- a/src/plugins/lb/api.c
+++ b/src/plugins/lb/api.c
@@ -116,14 +116,23 @@ vl_api_lb_add_del_vip_t_handler
rv = lb_vip_del(vip_index);
} else {
u32 vip_index;
- lb_vip_type_t type;
+ lb_vip_type_t type = 0;
+
if (ip46_prefix_is_ip4(&prefix, mp->prefix_length)) {
- type = mp->is_gre4?LB_VIP_TYPE_IP4_GRE4:LB_VIP_TYPE_IP4_GRE6;
+ if (mp->encap == LB_ENCAP_TYPE_GRE4)
+ type = LB_VIP_TYPE_IP4_GRE4;
+ else if (mp->encap == LB_ENCAP_TYPE_GRE6)
+ type = LB_VIP_TYPE_IP4_GRE6;
+ else if (mp->encap == LB_ENCAP_TYPE_L3DSR)
+ type = LB_VIP_TYPE_IP4_L3DSR;
} else {
- type = mp->is_gre4?LB_VIP_TYPE_IP6_GRE4:LB_VIP_TYPE_IP6_GRE6;
+ if (mp->encap == LB_ENCAP_TYPE_GRE4)
+ type = LB_VIP_TYPE_IP6_GRE4;
+ else if (mp->encap == LB_ENCAP_TYPE_GRE6)
+ type = LB_VIP_TYPE_IP6_GRE6;
}
- rv = lb_vip_add(&prefix, mp->prefix_length, type,
+ rv = lb_vip_add(&prefix, mp->prefix_length, type, mp->dscp,
mp->new_flows_table_length, &vip_index);
}
REPLY_MACRO (VL_API_LB_CONF_REPLY);
@@ -136,7 +145,9 @@ static void *vl_api_lb_add_del_vip_t_print
s = format (0, "SCRIPT: lb_add_del_vip ");
s = format (s, "%U ", format_ip46_prefix,
(ip46_address_t *)mp->ip_prefix, mp->prefix_length, IP46_TYPE_ANY);
- s = format (s, "%s ", mp->is_gre4?"gre4":"gre6");
+
+ s = format (s, "%s ", (mp->encap==LB_ENCAP_TYPE_GRE4)?
+ "gre4":(mp->encap==LB_ENCAP_TYPE_GRE6)?"gre6":"l3dsr");
s = format (s, "%u ", mp->new_flows_table_length);
s = format (s, "%s ", mp->is_del?"del":"add");
FINISH;