From 647f609a11e2afb91a5216ca99d0705a3e1212a7 Mon Sep 17 00:00:00 2001 From: Hongjun Ni Date: Tue, 23 Jan 2018 19:17:23 +0800 Subject: 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 --- src/plugins/lb/api.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'src/plugins/lb/api.c') 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; -- cgit 1.2.3-korg