lb: Fix src_ip_sticky evaluation bug in per-port-vip case. 62/39162/2
authorNobuhiro MIKI <nmiki@yahoo-corp.jp>
Wed, 28 Jun 2023 06:15:58 +0000 (15:15 +0900)
committerMohammed HAWARI <momohawari@gmail.com>
Thu, 13 Jul 2023 08:10:26 +0000 (08:10 +0000)
commit95c2da7c251a87a4a9e8c618d76df0502e7b24f4
tree8b5b929c95572ec187f66cd1663bae3ac342db47
parentdf4d342d7618b959d9d2ac87aa70d47049b911bc
lb: Fix src_ip_sticky evaluation bug in per-port-vip case.

Before this fix, the src_ip_sticky flag was passed as an argument to
the lb_node_get_hash function, which computes a hash value for a packet.
However, in per-port-vip case, the value of src_ip_sticky flag may be
different for each port number. As a result, the value is the same for
all port numbers, even though it is a per-port-vip case.

This commit fixes the src_ip_sticky evaluation by delaying it until the
packet is received, so that the correct value is obtained. Also, the
unit test case has been enhanced for this bug fix.

The steps to reproduce this bug are described below:
https://lists.fd.io/g/vpp-dev/message/23248

Type: fix
Fixes: 613e6dc0bf92 ("lb: add source ip based sticky load balancing")
Change-Id: I483492b214a1768e7a21fd86edd5151b3c46528b
Signed-off-by: Nobuhiro MIKI <nmiki@yahoo-corp.jp>
src/plugins/lb/lb.c
src/plugins/lb/lb.h
src/plugins/lb/node.c
test/test_lb.py