@@ -171,7 +171,8 @@ extern const struct proto_desc *proto_dev_desc(uint16_t type);
/**
* struct proto_ctx - protocol context
*
- * debug_mask: display debugging information
+ * @debug_mask: display debugging information
+ * @options option flags to control proto decoding
* @family: hook family
* @location: location of the relational expression defining the context
* @desc: protocol description for this layer
@@ -183,6 +184,7 @@ extern const struct proto_desc *proto_dev_desc(uint16_t type);
*/
struct proto_ctx {
unsigned int debug_mask;
+ uint8_t options;
uint8_t family;
union {
struct {
@@ -202,7 +204,7 @@ struct proto_ctx {
};
extern void proto_ctx_init(struct proto_ctx *ctx, unsigned int family,
- unsigned int debug_mask);
+ unsigned int debug_mask, unsigned int proto_options);
extern void proto_ctx_update(struct proto_ctx *ctx, enum proto_bases base,
const struct location *loc,
const struct proto_desc *desc);
@@ -4090,7 +4090,8 @@ static int rule_evaluate(struct eval_ctx *ctx, struct rule *rule,
struct stmt *stmt, *tstmt = NULL;
struct error_record *erec;
- proto_ctx_init(&ctx->pctx, rule->handle.family, ctx->nft->debug_mask);
+ proto_ctx_init(&ctx->pctx, rule->handle.family, ctx->nft->debug_mask,
+ 0);
memset(&ctx->ectx, 0, sizeof(ctx->ectx));
ctx->rule = rule;
@@ -1868,7 +1868,7 @@ static void trace_print_packet(const struct nftnl_trace *nlt,
meta_expr_alloc(&netlink_location,
NFT_META_OIF), octx);
- proto_ctx_init(&ctx, nftnl_trace_get_u32(nlt, NFTNL_TRACE_FAMILY), 0);
+ proto_ctx_init(&ctx, nftnl_trace_get_u32(nlt, NFTNL_TRACE_FAMILY), 0, 0);
ll_desc = ctx.protocol[PROTO_BASE_LL_HDR].desc;
if ((ll_desc == &proto_inet || ll_desc == &proto_netdev) &&
nftnl_trace_is_set(nlt, NFTNL_TRACE_NFPROTO)) {
@@ -2820,7 +2820,7 @@ static void rule_parse_postprocess(struct netlink_parse_ctx *ctx, struct rule *r
struct stmt *stmt, *next;
memset(&rctx, 0, sizeof(rctx));
- proto_ctx_init(&rctx.pctx, rule->handle.family, ctx->debug_mask);
+ proto_ctx_init(&rctx.pctx, rule->handle.family, ctx->debug_mask, 0);
list_for_each_entry_safe(stmt, next, &rule->stmts, list) {
enum stmt_types type = stmt->ops->type;
@@ -169,7 +169,8 @@ static void proto_ctx_debug(const struct proto_ctx *ctx, enum proto_bases base,
* @debug_mask: display debugging information
*/
void proto_ctx_init(struct proto_ctx *ctx, unsigned int family,
- unsigned int debug_mask)
+ unsigned int debug_mask,
+ unsigned int proto_options)
{
const struct hook_proto_desc *h = &hook_proto_desc[family];
@@ -177,6 +178,7 @@ void proto_ctx_init(struct proto_ctx *ctx, unsigned int family,
ctx->family = family;
ctx->protocol[h->base].desc = h->desc;
ctx->debug_mask = debug_mask;
+ ctx->options = proto_options;
proto_ctx_debug(ctx, h->base, debug_mask);
}
Add new option flag member and the needed function signature changes to initialise it. No changes in behaviour. Signed-off-by: Florian Westphal <fw@strlen.de> --- include/proto.h | 6 ++++-- src/evaluate.c | 3 ++- src/netlink.c | 2 +- src/netlink_delinearize.c | 2 +- src/proto.c | 4 +++- 5 files changed, 11 insertions(+), 6 deletions(-)