So we can use the 'redirect' reserve word as constant from the rhs expression. Thus, we can use it as icmp type. Signed-off-by: Pablo Neira Ayuso <pablo@xxxxxxxxxxxxx> --- include/datatype.h | 1 + src/parser_bison.y | 7 +++++++ src/proto.c | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/include/datatype.h b/include/datatype.h index 07fedce..91ca2dd 100644 --- a/include/datatype.h +++ b/include/datatype.h @@ -207,6 +207,7 @@ extern const struct datatype arphrd_type; extern const struct datatype inet_protocol_type; extern const struct datatype inet_service_type; extern const struct datatype mark_type; +extern const struct datatype icmp_type_type; extern const struct datatype icmp_code_type; extern const struct datatype icmpv6_code_type; extern const struct datatype icmpx_code_type; diff --git a/src/parser_bison.y b/src/parser_bison.y index be1c740..d42bd2f 100644 --- a/src/parser_bison.y +++ b/src/parser_bison.y @@ -2101,6 +2101,13 @@ primary_rhs_expr : symbol_expr { $$ = $1; } BYTEORDER_HOST_ENDIAN, sizeof(data) * BITS_PER_BYTE, &data); } + | REDIRECT + { + uint8_t data = ICMP_REDIRECT; + $$ = constant_expr_alloc(&@$, &icmp_type_type, + BYTEORDER_HOST_ENDIAN, + sizeof(data) * BITS_PER_BYTE, &data); + } ; relational_op : EQ { $$ = OP_EQ; } diff --git a/src/proto.c b/src/proto.c index 3282271..65ee158 100644 --- a/src/proto.c +++ b/src/proto.c @@ -303,7 +303,7 @@ static const struct symbol_table icmp_type_tbl = { }, }; -static const struct datatype icmp_type_type = { +const struct datatype icmp_type_type = { .type = TYPE_ICMP_TYPE, .name = "icmp_type", .desc = "ICMP type", -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html