Skip to content

Commit

Permalink
fix: must_rules causes match_set modification
Browse files Browse the repository at this point in the history
  • Loading branch information
LostAttractor committed Dec 23, 2024
1 parent d9101f4 commit 7e91fee
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions control/kern/tproxy.c
Original file line number Diff line number Diff line change
Expand Up @@ -829,15 +829,14 @@ static int route_loop_cb(__u32 index, void *data)
OUTBOUND_MUST_RULES)) {
ctx->isdns_must_goodsubrule_badrule |= 0b100;
} else {
if (ctx->isdns_must_goodsubrule_badrule & 0b100)
match_set->must = true;
if (!match_set->must &&
bool must = ctx->isdns_must_goodsubrule_badrule & 0b100 || match_set->must;
if (!must &&
(ctx->isdns_must_goodsubrule_badrule &
0b1000)) {
ctx->result =
(__s64)OUTBOUND_CONTROL_PLANE_ROUTING |
((__s64)match_set->mark << 8) |
((__s64)match_set->must << 40);
((__s64)must << 40);
#ifdef __DEBUG_ROUTING
bpf_printk(
"OUTBOUND_CONTROL_PLANE_ROUTING: %ld",
Expand All @@ -847,7 +846,7 @@ static int route_loop_cb(__u32 index, void *data)
}
ctx->result = (__s64)match_set->outbound |
((__s64)match_set->mark << 8) |
((__s64)match_set->must << 40);
((__s64)must << 40);
#ifdef __DEBUG_ROUTING
bpf_printk("outbound %u: %ld",
match_set->outbound, ctx->result);
Expand Down

0 comments on commit 7e91fee

Please sign in to comment.