diff options
Diffstat (limited to 'src/expr/osf.c')
-rw-r--r-- | src/expr/osf.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/expr/osf.c b/src/expr/osf.c index 215a681..666b6b7 100644 --- a/src/expr/osf.c +++ b/src/expr/osf.c @@ -11,6 +11,7 @@ #include <libnftnl/rule.h> #define OSF_GENRE_SIZE 32 +#define NFT_OSF_MAXGENRELEN 16 struct nftnl_expr_osf { enum nft_registers dreg; @@ -125,6 +126,32 @@ nftnl_expr_osf_parse(struct nftnl_expr *e, struct nlattr *attr) } static int +nftnl_expr_osf_reg_len(const struct nftnl_expr *e) +{ + return NFT_OSF_MAXGENRELEN; +} + +static bool +nftnl_expr_osf_reg_cmp(const struct nftnl_reg *reg, + const struct nftnl_expr *e) +{ + const struct nftnl_expr_osf *osf = nftnl_expr_data(e); + + return reg->osf.ttl == osf->ttl && + reg->osf.flags == osf->flags; +} + +static void +nftnl_expr_osf_reg_update(struct nftnl_reg *reg, + const struct nftnl_expr *e) +{ + const struct nftnl_expr_osf *osf = nftnl_expr_data(e); + + reg->osf.ttl = osf->ttl; + reg->osf.flags = osf->flags; +} + +static int nftnl_expr_osf_snprintf(char *buf, size_t len, uint32_t flags, const struct nftnl_expr *e) { @@ -148,4 +175,9 @@ struct expr_ops expr_ops_osf = { .parse = nftnl_expr_osf_parse, .build = nftnl_expr_osf_build, .snprintf = nftnl_expr_osf_snprintf, + .reg = { + .len = nftnl_expr_osf_reg_len, + .cmp = nftnl_expr_osf_reg_cmp, + .update = nftnl_expr_osf_reg_update, + }, }; |