netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH nft 1/2] optimize: more robust statement merge with vmap
@ 2022-03-03 12:15 Pablo Neira Ayuso
  2022-03-03 12:15 ` [PATCH nft 2/2] optimize: incorrect assert() for unexpected expression type Pablo Neira Ayuso
  0 siblings, 1 reply; 2+ messages in thread
From: Pablo Neira Ayuso @ 2022-03-03 12:15 UTC (permalink / raw)
  To: netfilter-devel

Check expressions that are expected on the rhs rather than using a
catch-all default case.

Fixes: 1542082e259b ("optimize: merge same selector with different verdict into verdict map")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
 src/optimize.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/optimize.c b/src/optimize.c
index 64c0a4dbe764..9c63f6a98e95 100644
--- a/src/optimize.c
+++ b/src/optimize.c
@@ -445,12 +445,17 @@ static void build_verdict_map(struct expr *expr, struct stmt *verdict, struct ex
 			compound_expr_add(set, mapping);
 		}
 		break;
-	default:
+	case EXPR_VALUE:
+	case EXPR_PREFIX:
+	case EXPR_RANGE:
 		elem = set_elem_expr_alloc(&internal_location, expr_get(expr));
 		mapping = mapping_expr_alloc(&internal_location, elem,
 					     expr_get(verdict->expr));
 		compound_expr_add(set, mapping);
 		break;
+	default:
+		assert(0);
+		break;
 	}
 }
 
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-03-03 12:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-03 12:15 [PATCH nft 1/2] optimize: more robust statement merge with vmap Pablo Neira Ayuso
2022-03-03 12:15 ` [PATCH nft 2/2] optimize: incorrect assert() for unexpected expression type Pablo Neira Ayuso

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).