expression: don't trim off unary expression on delinearization
Pablo Neira Ayuso
maintainerPATCH 1/2 expression: don't trim off unary expression on delinearization
This transformation introduces an unnecessary asymmetry between the linearization and delinearization steps that prevent rule deletion from definition to work fine.
Moreover, do not print htonl and ntonl from unary expression, this syntax is not allowed by the parser.
Signed-off-by Pablo Neira Ayuso <[email protected]>
--- src/expression.c | 3 --- src/netlink_delinearize.c | 5 +---- 2 files changed, 1 insertion(+), 7 deletions(-)
src/expression.c +0 -3
@@ -460,10 +460,7 @@ const char *expr_op_symbols[] = {static void unary_expr_print (const struct expr *expr) { -if (expr_op_symbols[expr->op] !=NULL ) -printf ("%s(" , expr_op_symbols[expr->op]);expr_print (expr->arg); -printf (")" ); }static void unary_expr_clone (struct expr *new,const struct expr *expr)
src/netlink_delinearize.c +1 -4
@@ -1759,10 +1759,7 @@ static void expr_postprocess(struct rule_pp_ctx *ctx, struct expr **exprp) }case EXPR_UNARY :expr_postprocess (ctx, &expr->arg); -expr_set_type (expr->arg, expr->arg->dtype, !expr->arg->byteorder); - - *exprp =expr_get (expr->arg); -expr_free (expr); +expr_set_type (expr, expr->arg->dtype, !expr->arg->byteorder);break ;case EXPR_BINOP :expr_postprocess (ctx, &expr->left);
Signature · 1 line
2.1.4
Pablo Neira Ayuso
maintainerPATCH 2/2 tests: py: flush stdout on each test run
Useful when redirecting output to file and tail -f it.
Signed-off-by Pablo Neira Ayuso <[email protected]>
--- tests/py/nft-test.py | 2 ++ 1 file changed, 2 insertions(+)
tests/py/nft-test.py +2 -0
@@ -955,6 +955,8 @@ def run_test_file(filename, force_all_family_option, specific_file): tests = passed = total_unit_run = total_warning = total_error = 0 for lineno, line in enumerate(f): + sys.stdout.flush() + if signal_received == 1: print "\nSignal received. Cleaning up and Exitting..." cleanup_on_exit()
Signature · 1 line
2.1.4