Skip to contentSkip to conversation

dynset prefix support

PATCH New Pablo Neira Ayuso 1 participant 1 message Aug 23, 2016 netfilter

lore
Share & tools
lore

Pablo Neira Ayuso

author maintainer
#0 lore raw

PATCH 1/1 dynset prefix support

table ip filter {
        chain input {
                type filter hook input priority 0;

                flow table xyz { ip saddr & 255.255.255.0 counter packets 0 bytes 0}
        }
}
---
 src/evaluate.c     | 14 +++++++++-----
 src/parser_bison.y |  6 ++++++
 2 files changed, 15 insertions(+), 5 deletions(-)
src/evaluate.c +9 -5
index 8116735..d9984e5 100644
@@ -656,12 +656,16 @@ static int expr_evaluate_prefix(struct eval_ctx *ctx, struct expr **expr)
 	if (expr_evaluate(ctx, &prefix->prefix) < 0)
 		return -1;
 	base = prefix->prefix;
-	assert(expr_is_constant(base));
 
-	prefix->dtype	  = base->dtype;
-	prefix->byteorder = base->byteorder;
-	prefix->len	  = base->len;
-	prefix->flags	 |= EXPR_F_CONSTANT;
+	if (expr_is_constant(base)) {
+		prefix->dtype	  = base->dtype;
+		prefix->byteorder = base->byteorder;
+		prefix->len	  = base->len;
+		prefix->flags	 |= EXPR_F_CONSTANT;
+	} else {
+		*expr = base;
+	}
+
 	return 0;
 }
 
src/parser_bison.y +6 -0
index e16b8a3..f06df6f 100644
@@ -1950,6 +1950,12 @@ concat_expr		:	basic_expr
 				}
 				compound_expr_add($$, $3);
 			}
+			|	basic_expr	SLASH	NUM
+			{
+				$$ = prefix_expr_alloc(&@$, $1, $3);
+			}
+			;
+
 			;
 
 prefix_rhs_expr		:	basic_rhs_expr	SLASH	NUM
Signature · 1 line
2.1.4