summaryrefslogtreecommitdiffstats
path: root/src/plugins/lb/node.c
diff options
context:
space:
mode:
authorYusuke Tatsumi <ytatsumi@yahoo-corp.jp>2018-03-05 13:01:04 +0900
committerFlorin Coras <florin.coras@gmail.com>2018-03-06 15:55:07 +0000
commit4707f2257213a56b588fe2aeeed920917a059762 (patch)
treee9c21a7ae22aa0aeedddf0af251d757cb43dc2fe /src/plugins/lb/node.c
parent9691cf2d082727fb2f88e85050068dc6fd761bcd (diff)
LB plugin: Fix Layer-4 checksum error in L3DSR.
Though dst-IP address would be change in LB plugin with L3DSR method, layer-4 checksum would not be recomputed after this change. Related changes: - L3DSR: https://gerrit.fd.io/r/#/c/10203/ Change-Id: I98de7b8d80186ac77608a68050208c08d90b7c3b Signed-off-by: Yusuke Tatsumi <ytatsumi@yahoo-corp.jp>
Diffstat (limited to 'src/plugins/lb/node.c')
-rw-r--r--src/plugins/lb/node.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/plugins/lb/node.c b/src/plugins/lb/node.c
index 22ba3104f92..529da73bcff 100644
--- a/src/plugins/lb/node.c
+++ b/src/plugins/lb/node.c
@@ -306,12 +306,17 @@ lb_node_fn (vlib_main_t * vm,
} else if (encap_type == LB_ENCAP_TYPE_L3DSR) /* encap L3DSR*/
{
ip4_header_t *ip40;
+ tcp_header_t *th0;
ip40 = vlib_buffer_get_current(p0);
ip40->dst_address = lbm->ass[asindex0].address.ip4;
/* Get and rewrite DSCP bit */
ip40->tos = (u8)((vip0->dscp & 0x3F)<<2);
ip40->checksum = ip4_header_checksum (ip40);
+ /* Recomputing L4 checksum after dst-IP modifying */
+ th0 = ip4_next_header(ip40);
+ th0->checksum = 0;
+ th0->checksum = ip4_tcp_udp_compute_checksum(vm, p0, ip40);
}
if (PREDICT_FALSE (p0->flags & VLIB_BUFFER_IS_TRACED))