Skip to content

Commit 4ec5f07

Browse files
committed
cgen: dump the codegen after it has been updated
On bf_cgen_update(), the codegen is dumped (if verbose is enabled) very early in the function, meaning the old (to be replaced) chain is printed. Dump the codegen at the end of the function, when the chain replacement occurred, so the new chain is printed.
1 parent bfe3b5e commit 4ec5f07

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Diff for: src/bpfilter/cgen/cgen.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -242,9 +242,6 @@ int bf_cgen_update(struct bf_cgen *cgen, struct bf_chain **new_chain)
242242

243243
bf_assert(cgen && new_chain);
244244

245-
if (bf_opts_is_verbose(BF_VERBOSE_DEBUG))
246-
bf_cgen_dump(cgen, EMPTY_PREFIX);
247-
248245
r = bf_program_new(&new_prog, (*new_chain)->hook, cgen->front, *new_chain);
249246
if (r < 0)
250247
return bf_err_r(r, "failed to create a new bf_program");
@@ -264,5 +261,8 @@ int bf_cgen_update(struct bf_cgen *cgen, struct bf_chain **new_chain)
264261
bf_swap(cgen->program, new_prog);
265262
bf_swap(cgen->chain, *new_chain);
266263

264+
if (bf_opts_is_verbose(BF_VERBOSE_DEBUG))
265+
bf_cgen_dump(cgen, EMPTY_PREFIX);
266+
267267
return 0;
268268
}

0 commit comments

Comments
 (0)