[PATCH nft 2/4] netlink_delinearize: fix bogus offset w exthdr expressions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Need to fetch the offset from the exthdr template.

Signed-off-by: Florian Westphal <fw@xxxxxxxxx>
---
 src/netlink_linearize.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/netlink_linearize.c b/src/netlink_linearize.c
index 07f70e0..49b4676 100644
--- a/src/netlink_linearize.c
+++ b/src/netlink_linearize.c
@@ -320,19 +320,24 @@ static void netlink_gen_range(struct netlink_linearize_ctx *ctx,
 
 static void payload_shift_value(const struct expr *left, struct expr *right)
 {
+	unsigned int offset;
+
 	if (right->ops->type != EXPR_VALUE)
 		return;
 
 	switch (left->ops->type) {
 	case EXPR_PAYLOAD:
+		offset = left->payload.offset;
+		break;
 	case EXPR_EXTHDR:
+		offset = left->exthdr.tmpl->offset;
 		break;
 	default:
 		return;
 	}
 
 	mpz_lshift_ui(right->value,
-			payload_shift_calc(left, left->payload.offset));
+			payload_shift_calc(left, offset));
 }
 
 static struct expr *netlink_gen_prefix(struct netlink_linearize_ctx *ctx,
-- 
2.4.10

--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux