]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
exthdr: store offset for later use
authorFlorian Westphal <fw@strlen.de>
Wed, 2 Mar 2016 12:56:43 +0000 (13:56 +0100)
committerFlorian Westphal <fw@strlen.de>
Wed, 2 Mar 2016 12:56:43 +0000 (13:56 +0100)
Its possible that we cannot find the template without also
considering an implicit mask.  For this we need to store the offset.

Signed-off-by: Florian Westphal <fw@strlen.de>
Acked-by: Pablo Neira Ayuso <pablo@netfilter.org>
include/expression.h
src/exthdr.c

index eacbb2d5cd1be305a79e220847a7986f39e1b5c6..72b6f69bceabc7ac45c89a36d86942fc0ad196eb 100644 (file)
@@ -264,6 +264,7 @@ struct expr {
                        /* EXPR_EXTHDR */
                        const struct exthdr_desc        *desc;
                        const struct proto_hdr_template *tmpl;
+                       unsigned int                    offset;
                } exthdr;
                struct {
                        /* EXPR_META */
index 9ed0b6ac83ab650b47cb314da382d697df5d0ec2..512de0aedd9a41c0c44fc15dfa70868ea4d88139 100644 (file)
@@ -37,6 +37,7 @@ static void exthdr_expr_clone(struct expr *new, const struct expr *expr)
 {
        new->exthdr.desc = expr->exthdr.desc;
        new->exthdr.tmpl = expr->exthdr.tmpl;
+       new->exthdr.offset = expr->exthdr.offset;
 }
 
 static const struct expr_ops exthdr_expr_ops = {
@@ -86,6 +87,7 @@ void exthdr_init_raw(struct expr *expr, uint8_t type,
        assert(expr->ops->type == EXPR_EXTHDR);
 
        expr->len = len;
+       expr->exthdr.offset = offset;
        expr->exthdr.desc = exthdr_protocols[type];
        assert(expr->exthdr.desc != NULL);