From e391b72b611403d184bbb26e3d076d543c7ea7c6 Mon Sep 17 00:00:00 2001 From: Florian Westphal Date: Fri, 20 Sep 2013 16:01:33 +0200 Subject: meta: iif/oifname should be host byte order src/nft add rule filter output meta oifname eth0 doesn't work on x86. Problem is that nft declares these as BYTEORDER_INVALID, but when converting the string mpz_import_data treats INVALID like BIG_ENDIAN. [ cmp eq reg 1 0x00000000 0x00000000 0x65000000 0x00306874 ] as kernel nft_cmp_eval basically boils down to memcmp(reg, skb->dev->name, sizeof(reg) comparision fails. with patch: [ cmp eq reg 1 0x30687465 0x00000000 0x00000000 0x00000000 ] Signed-off-by: Florian Westphal Signed-off-by: Pablo Neira Ayuso --- src/datatype.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/datatype.c') diff --git a/src/datatype.c b/src/datatype.c index c4fc131d..4c5a70f2 100644 --- a/src/datatype.c +++ b/src/datatype.c @@ -258,7 +258,7 @@ static void string_type_print(const struct expr *expr) unsigned int len = div_round_up(expr->len, BITS_PER_BYTE); char data[len]; - mpz_export_data(data, expr->value, BYTEORDER_BIG_ENDIAN, len); + mpz_export_data(data, expr->value, BYTEORDER_HOST_ENDIAN, len); printf("\"%s\"", data); } @@ -266,7 +266,7 @@ static struct error_record *string_type_parse(const struct expr *sym, struct expr **res) { *res = constant_expr_alloc(&sym->location, &string_type, - BYTEORDER_INVALID, + BYTEORDER_HOST_ENDIAN, (strlen(sym->identifier) + 1) * BITS_PER_BYTE, sym->identifier); return NULL; -- cgit v1.2.3