Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpf: lb: deal with stale rev_nat_index after svc lookup in fallback path #24757

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 4 additions & 2 deletions bpf/lib/lb.h
Original file line number Diff line number Diff line change
Expand Up @@ -935,13 +935,14 @@ static __always_inline int lb6_local(const void *map, struct __ctx_buff *ctx,
goto drop_no_service;
state->backend_id = backend_id;
ct_update_backend_id(map, tuple, state);
state->rev_nat_index = svc->rev_nat_index;
ct_update_rev_nat_index(map, tuple, state);
}
update_state:
/* Restore flags so that SERVICE flag is only used in used when the
* service lookup happens and future lookups use EGRESS or INGRESS.
*/
tuple->flags = flags;
state->rev_nat_index = svc->rev_nat_index;
#ifdef ENABLE_SESSION_AFFINITY
if (lb6_svc_is_affinity(svc))
lb6_update_affinity_by_addr(svc, &client_id,
Expand Down Expand Up @@ -1619,6 +1620,8 @@ static __always_inline int lb4_local(const void *map, struct __ctx_buff *ctx,
goto drop_no_service;
state->backend_id = backend_id;
ct_update_backend_id(map, tuple, state);
state->rev_nat_index = svc->rev_nat_index;
ct_update_rev_nat_index(map, tuple, state);
}
update_state:
#ifdef ENABLE_CLUSTER_AWARE_ADDRESSING
Expand All @@ -1629,7 +1632,6 @@ static __always_inline int lb4_local(const void *map, struct __ctx_buff *ctx,
* service lookup happens and future lookups use EGRESS or INGRESS.
*/
tuple->flags = flags;
state->rev_nat_index = svc->rev_nat_index;
state->addr = backend->address;
#ifdef ENABLE_SESSION_AFFINITY
if (lb4_svc_is_affinity(svc))
Expand Down
4 changes: 2 additions & 2 deletions bpf/lib/nodeport.h
Original file line number Diff line number Diff line change
Expand Up @@ -1028,7 +1028,7 @@ static __always_inline int nodeport_lb6(struct __ctx_buff *ctx,
case CT_REOPENED:
case CT_ESTABLISHED:
if (unlikely(ct_state.rev_nat_index !=
svc->rev_nat_index))
ct_state_new.rev_nat_index))
julianwiedmann marked this conversation as resolved.
Show resolved Hide resolved
goto redo;
break;
default:
Expand Down Expand Up @@ -2279,7 +2279,7 @@ static __always_inline int nodeport_lb4(struct __ctx_buff *ctx,
* belongs to a flow which target a different svc.
*/
if (unlikely(ct_state.rev_nat_index !=
svc->rev_nat_index))
ct_state_new.rev_nat_index))
goto redo;
break;
default:
Expand Down