diff options
author | Nobuhiro MIKI <nmiki@yahoo-corp.jp> | 2022-09-28 15:53:17 +0900 |
---|---|---|
committer | Beno�t Ganne <bganne@cisco.com> | 2023-01-18 10:53:23 +0000 |
commit | 613e6dc0bf928def5d337312d522e1a15df87b00 (patch) | |
tree | 04e592643029774fadcbfc8f8e82df778b867df9 /src/plugins/lb/cli.c | |
parent | 893a0c3130e1d868c939db6dcde258da1277cf41 (diff) |
lb: add source ip based sticky load balancing
This patch adds source ip based sticky session, which is already
implemented in many hardware LBs and software LBs. Note that sticky
sessions may be reset if the hash is recalculated as ASs are added
or deleted.
Since this feature is unrelated to the other existing options, the
lb_add_del_vip API version has been upgraded to v2 and a new option
"src_ip_sticky" has been added.
Type: feature
Signed-off-by: Nobuhiro MIKI <nmiki@yahoo-corp.jp>
Change-Id: I3eb3680a28defbc701f28c873933ec2fb54544ab
Diffstat (limited to 'src/plugins/lb/cli.c')
-rw-r--r-- | src/plugins/lb/cli.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/plugins/lb/cli.c b/src/plugins/lb/cli.c index 7b5dc5c8549..31152cd01f4 100644 --- a/src/plugins/lb/cli.c +++ b/src/plugins/lb/cli.c @@ -32,6 +32,7 @@ lb_vip_command_fn (vlib_main_t * vm, clib_error_t *error = 0; args.new_length = 1024; + args.src_ip_sticky = 0; if (!unformat_user (input, unformat_line_input, line_input)) return 0; @@ -49,6 +50,8 @@ lb_vip_command_fn (vlib_main_t * vm, ; else if (unformat(line_input, "del")) del = 1; + else if (unformat (line_input, "src_ip_sticky")) + args.src_ip_sticky = 1; else if (unformat(line_input, "protocol tcp")) { args.protocol = (u8)IP_PROTOCOL_TCP; @@ -177,6 +180,7 @@ done: return error; } +/* clang-format off */ VLIB_CLI_COMMAND (lb_vip_command, static) = { .path = "lb vip", @@ -185,9 +189,10 @@ VLIB_CLI_COMMAND (lb_vip_command, static) = "[encap (gre6|gre4|l3dsr|nat4|nat6)] " "[dscp <n>] " "[type (nodeport|clusterip) target_port <n>] " - "[new_len <n>] [del]", + "[new_len <n>] [src_ip_sticky] [del]", .function = lb_vip_command_fn, }; +/* clang-format on */ static clib_error_t * lb_as_command_fn (vlib_main_t * vm, |