From be441e1ffdc2495162399b61053a8f8c18ebc5b6 Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Tue, 22 Aug 2017 18:45:52 +0200 Subject: src: add debugging mask to context structure So this toggle is not global anymore. Update name that fits better with the semantics of this variable. Signed-off-by: Pablo Neira Ayuso --- src/proto.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src/proto.c') diff --git a/src/proto.c b/src/proto.c index 045f2d81..5bd50b7b 100644 --- a/src/proto.c +++ b/src/proto.c @@ -138,11 +138,12 @@ const struct hook_proto_desc hook_proto_desc[] = { [NFPROTO_ARP] = HOOK_PROTO_DESC(PROTO_BASE_NETWORK_HDR, &proto_arp), }; -static void proto_ctx_debug(const struct proto_ctx *ctx, enum proto_bases base) +static void proto_ctx_debug(const struct proto_ctx *ctx, enum proto_bases base, + unsigned int debug_mask) { unsigned int i; - if (!(debug_level & DEBUG_PROTO_CTX)) + if (!(debug_mask & DEBUG_NETLINK)) return; pr_debug("update %s protocol context:\n", proto_base_names[base]); @@ -165,16 +166,19 @@ static void proto_ctx_debug(const struct proto_ctx *ctx, enum proto_bases base) * * @ctx: protocol context * @family: hook family + * @debug_mask: display debugging information */ -void proto_ctx_init(struct proto_ctx *ctx, unsigned int family) +void proto_ctx_init(struct proto_ctx *ctx, unsigned int family, + unsigned int debug_mask) { const struct hook_proto_desc *h = &hook_proto_desc[family]; memset(ctx, 0, sizeof(*ctx)); ctx->family = family; ctx->protocol[h->base].desc = h->desc; + ctx->debug_mask = debug_mask; - proto_ctx_debug(ctx, h->base); + proto_ctx_debug(ctx, h->base, debug_mask); } /** @@ -192,7 +196,7 @@ void proto_ctx_update(struct proto_ctx *ctx, enum proto_bases base, ctx->protocol[base].location = *loc; ctx->protocol[base].desc = desc; - proto_ctx_debug(ctx, base); + proto_ctx_debug(ctx, base, ctx->debug_mask); } #define HDR_TEMPLATE(__name, __dtype, __type, __member) \ -- cgit v1.2.3