summaryrefslogtreecommitdiffstats
path: root/src/osf.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/osf.c')
-rw-r--r--src/osf.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/osf.c b/src/osf.c
index 9252934d..f0c22393 100644
--- a/src/osf.c
+++ b/src/osf.c
@@ -19,17 +19,22 @@ static void osf_expr_print(const struct expr *expr, struct output_ctx *octx)
{
const char *ttl_str = osf_ttl_int_to_str(expr->osf.ttl);
- nft_print(octx, "osf %sname", ttl_str);
+ if (expr->osf.flags & NFT_OSF_F_VERSION)
+ nft_print(octx, "osf %sversion", ttl_str);
+ else
+ nft_print(octx, "osf %sname", ttl_str);
}
static void osf_expr_clone(struct expr *new, const struct expr *expr)
{
new->osf.ttl = expr->osf.ttl;
+ new->osf.flags = expr->osf.flags;
}
static bool osf_expr_cmp(const struct expr *e1, const struct expr *e2)
{
- return e1->osf.ttl == e2->osf.ttl;
+ return (e1->osf.ttl == e2->osf.ttl) &&
+ (e1->osf.flags == e2->osf.flags);
}
const struct expr_ops osf_expr_ops = {
@@ -41,7 +46,8 @@ const struct expr_ops osf_expr_ops = {
.json = osf_expr_json,
};
-struct expr *osf_expr_alloc(const struct location *loc, const uint8_t ttl)
+struct expr *osf_expr_alloc(const struct location *loc, const uint8_t ttl,
+ const uint32_t flags)
{
unsigned int len = NFT_OSF_MAXGENRELEN * BITS_PER_BYTE;
const struct datatype *type = &string_type;
@@ -50,6 +56,7 @@ struct expr *osf_expr_alloc(const struct location *loc, const uint8_t ttl)
expr = expr_alloc(loc, EXPR_OSF, type,
BYTEORDER_HOST_ENDIAN, len);
expr->osf.ttl = ttl;
+ expr->osf.flags = flags;
return expr;
}