X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fplugins%2Flb%2Fnode.c;h=b33ea22b5c1d4b277a5955dd1014e8784450f731;hb=067cd6229a47ea3ba8b59a2a04090e80afb5bd2c;hp=e19964d2f1c2bfc9d5cff83d59752cd458249dbe;hpb=d92a0b553fd2872b4fcda25994aaa8852d254824;p=vpp.git diff --git a/src/plugins/lb/node.c b/src/plugins/lb/node.c index e19964d2f1c..b33ea22b5c1 100644 --- a/src/plugins/lb/node.c +++ b/src/plugins/lb/node.c @@ -220,7 +220,7 @@ lb_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame, { lb_main_t *lbm = &lb_main; u32 n_left_from, *from, next_index, *to_next, n_left_to_next; - u32 thread_index = vlib_get_thread_index (); + u32 thread_index = vm->thread_index; u32 lb_time = lb_hash_time_now (vm); lb_hash_t *sticky_ht = lb_get_sticky_table (thread_index); @@ -387,22 +387,25 @@ lb_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame, ip4_header_t *ip40; tcp_header_t *th0; ip_csum_t csum; - u32 old_dst; - u32 old_dscp; + u32 old_dst, new_dst; + u8 old_tos, new_tos; ip40 = vlib_buffer_get_current (p0); old_dst = ip40->dst_address.as_u32; - old_dscp = ip40->tos; - ip40->dst_address = lbm->ass[asindex0].address.ip4; + new_dst = lbm->ass[asindex0].address.ip4.as_u32; + ip40->dst_address.as_u32 = lbm->ass[asindex0].address.ip4.as_u32; /* Get and rewrite DSCP bit */ + old_tos = ip40->tos; + new_tos = (u8) ((vip0->encap_args.dscp & 0x3F) << 2); ip40->tos = (u8) ((vip0->encap_args.dscp & 0x3F) << 2); csum = ip40->checksum; - csum = ip_csum_sub_even (csum, old_dst); - csum = ip_csum_sub_even (csum, old_dscp); - csum = ip_csum_add_even (csum, - lbm->ass[asindex0].address.ip4.as_u32); - csum = ip_csum_add_even (csum, ip40->tos); + csum = ip_csum_update (csum, old_tos, new_tos, + ip4_header_t, + tos /* changed member */); + csum = ip_csum_update (csum, old_dst, new_dst, + ip4_header_t, + dst_address /* changed member */); ip40->checksum = ip_csum_fold (csum); /* Recomputing L4 checksum after dst-IP modifying */