|
|
029dc7 |
From dc38548e6f745bcfb141324b36307dbfa941eabd Mon Sep 17 00:00:00 2001
|
|
|
029dc7 |
From: Florian Westphal <fw@strlen.de>
|
|
|
029dc7 |
Date: Fri, 22 Feb 2019 13:26:05 +0100
|
|
|
029dc7 |
Subject: [PATCH] arptables-nft: fix decoding of hlen on bigendian platforms
|
|
|
029dc7 |
|
|
|
029dc7 |
The existing test fail with:
|
|
|
029dc7 |
extensions/libarpt_standard.t: ERROR: line 2 (cannot find: arptables -I INPUT -s 192.168.0.1)
|
|
|
029dc7 |
|
|
|
029dc7 |
... because hlen is 0 instead of expected "6".
|
|
|
029dc7 |
The rule is correct, i.e. this is a decode/display bug: arp_hlen is
|
|
|
029dc7 |
specified as 'unsigned short' instead of uint8_t.
|
|
|
029dc7 |
|
|
|
029dc7 |
On LSB systems, this doesn't matter but on MSB the value then is '0x600'
|
|
|
029dc7 |
instead of '0x006' which becomes 0 when assignment to the u8 header field.
|
|
|
029dc7 |
|
|
|
029dc7 |
Signed-off-by: Florian Westphal <fw@strlen.de>
|
|
|
029dc7 |
Acked-by: Phil Sutter <phil@nwl.cc>
|
|
|
029dc7 |
(cherry picked from commit d68672a641439b72bccfcb39d50f26fe3f915c19)
|
|
|
029dc7 |
Signed-off-by: Phil Sutter <psutter@redhat.com>
|
|
|
029dc7 |
---
|
|
|
029dc7 |
iptables/nft-arp.c | 5 +++--
|
|
|
029dc7 |
1 file changed, 3 insertions(+), 2 deletions(-)
|
|
|
029dc7 |
|
|
|
029dc7 |
diff --git a/iptables/nft-arp.c b/iptables/nft-arp.c
|
|
|
029dc7 |
index 37b0985377bef..b436570291b7c 100644
|
|
|
029dc7 |
--- a/iptables/nft-arp.c
|
|
|
029dc7 |
+++ b/iptables/nft-arp.c
|
|
|
029dc7 |
@@ -338,7 +338,8 @@ static void nft_arp_parse_payload(struct nft_xt_ctx *ctx,
|
|
|
029dc7 |
struct iptables_command_state *cs = data;
|
|
|
029dc7 |
struct arpt_entry *fw = &cs->arp;
|
|
|
029dc7 |
struct in_addr addr;
|
|
|
029dc7 |
- unsigned short int ar_hrd, ar_pro, ar_op, ar_hln;
|
|
|
029dc7 |
+ uint16_t ar_hrd, ar_pro, ar_op;
|
|
|
029dc7 |
+ uint8_t ar_hln;
|
|
|
029dc7 |
bool inv;
|
|
|
029dc7 |
|
|
|
029dc7 |
switch (ctx->payload.offset) {
|
|
|
029dc7 |
@@ -364,7 +365,7 @@ static void nft_arp_parse_payload(struct nft_xt_ctx *ctx,
|
|
|
029dc7 |
fw->arp.invflags |= ARPT_INV_ARPOP;
|
|
|
029dc7 |
break;
|
|
|
029dc7 |
case offsetof(struct arphdr, ar_hln):
|
|
|
029dc7 |
- get_cmp_data(e, &ar_hln, sizeof(ar_op), &inv;;
|
|
|
029dc7 |
+ get_cmp_data(e, &ar_hln, sizeof(ar_hln), &inv;;
|
|
|
029dc7 |
fw->arp.arhln = ar_hln;
|
|
|
029dc7 |
fw->arp.arhln_mask = 0xff;
|
|
|
029dc7 |
if (inv)
|
|
|
029dc7 |
--
|
|
|
029dc7 |
2.21.0
|
|
|
029dc7 |
|