" -a/--handle Output rule handle.\n"
" -I/--includepath <directory> Add <directory> to the paths searched for include files.\n"
#ifdef DEBUG
-" --debug <level [,level...]> Specify debugging level (scanner, parser, eval, netlink, all)\n"
+" --debug <level [,level...]> Specify debugging level (scanner, parser, eval, netlink, proto-ctx, all)\n"
#endif
"\n",
name);
.name = "netlink",
.level = DEBUG_NETLINK,
},
+ {
+ .name = "proto-ctx",
+ .level = DEBUG_PROTO_CTX,
+ },
{
.name = "all",
.level = ~0,
[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)
+{
+#ifdef DEBUG
+ unsigned int i;
+
+ if (!(debug_level & DEBUG_PROTO_CTX))
+ return;
+
+ pr_debug("update %s protocol context:\n", proto_base_names[base]);
+ for (i = PROTO_BASE_LL_HDR; i <= PROTO_BASE_MAX; i++) {
+ pr_debug(" %-20s: %s%s\n",
+ proto_base_names[i],
+ ctx->protocol[i].desc ? ctx->protocol[i].desc->name :
+ "none",
+ i == base ? " <-" : "");
+ }
+ pr_debug("\n");
+#endif
+}
+
/**
* proto_ctx_init - initialize protocol context for a given hook family
*
memset(ctx, 0, sizeof(*ctx));
ctx->family = family;
ctx->protocol[h->base].desc = h->desc;
+
+ proto_ctx_debug(ctx, h->base);
}
/**
{
ctx->protocol[base].location = *loc;
ctx->protocol[base].desc = desc;
+
+ proto_ctx_debug(ctx, base);
}
#define HDR_TEMPLATE(__name, __dtype, __type, __member) \