diff --git a/src/netlink.c b/src/netlink.c index 890e9b9..761c7b4 100644 --- a/src/netlink.c +++ b/src/netlink.c @@ -2234,6 +2234,8 @@ restart: tmp = constant_expr_splice(rhs, lhs->len); expr_set_type(tmp, lhs->dtype, lhs->byteorder); + if (tmp->byteorder == BYTEORDER_HOST_ENDIAN) + mpz_switch_byteorder(tmp->value, tmp->len / BITS_PER_BYTE); /* Skip unknown and filtered expressions */ desc = lhs->payload.desc; @@ -2290,6 +2292,7 @@ static void trace_print_packet(const struct nftnl_trace *nlt) struct list_head stmts = LIST_HEAD_INIT(stmts); struct payload_dep_ctx pctx = {}; struct proto_ctx ctx; + uint32_t nfproto; uint16_t dev_type; struct stmt *stmt, *next; @@ -2306,6 +2309,13 @@ static void trace_print_packet(const struct nftnl_trace *nlt) NFT_META_OIF)); proto_ctx_init(&ctx, nftnl_trace_get_u32(nlt, NFTNL_TRACE_FAMILY)); + if (ctx.protocol[PROTO_BASE_LL_HDR].desc == &proto_inet && + nftnl_trace_is_set(nlt, NFTNL_TRACE_NFPROTO)) { + nfproto = nftnl_trace_get_u32(nlt, NFTNL_TRACE_NFPROTO); + proto_ctx_update(&ctx, PROTO_BASE_LL_HDR, &netlink_location, NULL); + proto_ctx_update(&ctx, PROTO_BASE_NETWORK_HDR, &netlink_location, + proto_find_upper(&proto_inet, nfproto)); + } if (ctx.protocol[PROTO_BASE_LL_HDR].desc == NULL && nftnl_trace_is_set(nlt, NFTNL_TRACE_IIFTYPE)) { dev_type = nftnl_trace_get_u16(nlt, NFTNL_TRACE_IIFTYPE);