diff options
Diffstat (limited to 'src/expr/exthdr.c')
-rw-r--r-- | src/expr/exthdr.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/expr/exthdr.c b/src/expr/exthdr.c index 625dd5d..53a2a80 100644 --- a/src/expr/exthdr.c +++ b/src/expr/exthdr.c @@ -194,6 +194,38 @@ nftnl_expr_exthdr_parse(struct nftnl_expr *e, struct nlattr *attr) return 0; } +static int +nftnl_expr_exthdr_reg_len(const struct nftnl_expr *e) +{ + const struct nftnl_expr_exthdr *exthdr = nftnl_expr_data(e); + + return exthdr->len; +} + +static bool +nftnl_expr_exthdr_reg_cmp(const struct nftnl_reg *reg, + const struct nftnl_expr *e) +{ + const struct nftnl_expr_exthdr *exthdr = nftnl_expr_data(e); + + return reg->exthdr.offset == exthdr->offset && + reg->exthdr.type == exthdr->type && + reg->exthdr.op == exthdr->op && + reg->exthdr.flags == exthdr->flags; +} + +static void +nftnl_expr_exthdr_reg_update(struct nftnl_reg *reg, + const struct nftnl_expr *e) +{ + const struct nftnl_expr_exthdr *exthdr = nftnl_expr_data(e); + + reg->exthdr.offset = exthdr->offset; + reg->exthdr.type = exthdr->type; + reg->exthdr.op = exthdr->op; + reg->exthdr.flags = exthdr->flags; +} + static const char *op2str(uint8_t op) { switch (op) { @@ -268,4 +300,9 @@ struct expr_ops expr_ops_exthdr = { .parse = nftnl_expr_exthdr_parse, .build = nftnl_expr_exthdr_build, .snprintf = nftnl_expr_exthdr_snprintf, + .reg = { + .len = nftnl_expr_exthdr_reg_len, + .cmp = nftnl_expr_exthdr_reg_cmp, + .update = nftnl_expr_exthdr_reg_update, + }, }; |