From 20b1131c07acd2fc71803be592430f0e06c4090e Mon Sep 17 00:00:00 2001 From: Patrick McHardy Date: Sun, 24 Apr 2016 11:22:30 +0100 Subject: payload: fix stacked headers protocol context tracking The code contains multiple scattered around fragments to fiddle with the protocol contexts to work around the fact that stacked headers update the context for the incorrect layer. Fix this by updating the correct layer in payload_expr_pctx_update() and also take care of offset adjustments there and only there. Remove all manual protocol context fiddling and change protocol context debugging to also print the offset for stacked headers. All previously successful testcases pass. Signed-off-by: Patrick McHardy --- src/proto.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/proto.c') diff --git a/src/proto.c b/src/proto.c index b54a4c14..329d9919 100644 --- a/src/proto.c +++ b/src/proto.c @@ -148,11 +148,15 @@ static void proto_ctx_debug(const struct proto_ctx *ctx, enum proto_bases base) 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", + pr_debug(" %-20s: %s", proto_base_names[i], ctx->protocol[i].desc ? ctx->protocol[i].desc->name : - "none", - i == base ? " <-" : ""); + "none"); + if (ctx->protocol[i].offset) + pr_debug(" (offset: %u)", ctx->protocol[i].offset); + if (i == base) + pr_debug(" <-"); + pr_debug("\n"); } pr_debug("\n"); #endif -- cgit v1.2.3