diff mbox

[iptables] extensions: libipt_realm: fix order of mask and id when do nft translation

Message ID 1467035845-28485-1-git-send-email-zlpnobody@163.com
State Accepted
Delegated to: Pablo Neira
Headers show

Commit Message

Liping Zhang June 27, 2016, 1:57 p.m. UTC
From: Liping Zhang <liping.zhang@spreadtrum.com>

Before:
  # iptables-translate -A INPUT -m realm --realm 1/0xf
  nft add rule ip filter INPUT rtclassid and 0x1 == 0xf counter

Apply this patch:
  # iptables-translate -A INPUT -m realm --realm 1/0xf
  nft add rule ip filter INPUT rtclassid and 0xf == 0x1 counter

Cc: Shivani Bhardwaj <shivanib134@gmail.com>
Signed-off-by: Liping Zhang <liping.zhang@spreadtrum.com>
---
 extensions/libipt_realm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Pablo Neira Ayuso July 1, 2016, 2:19 p.m. UTC | #1
On Mon, Jun 27, 2016 at 09:57:25PM +0800, Liping Zhang wrote:
> From: Liping Zhang <liping.zhang@spreadtrum.com>
> 
> Before:
>   # iptables-translate -A INPUT -m realm --realm 1/0xf
>   nft add rule ip filter INPUT rtclassid and 0x1 == 0xf counter
> 
> Apply this patch:
>   # iptables-translate -A INPUT -m realm --realm 1/0xf
>   nft add rule ip filter INPUT rtclassid and 0xf == 0x1 counter

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

Patch

diff --git a/extensions/libipt_realm.c b/extensions/libipt_realm.c
index beb2491..0a4bc3b 100644
--- a/extensions/libipt_realm.c
+++ b/extensions/libipt_realm.c
@@ -115,8 +115,8 @@  print_realm_xlate(unsigned long id, unsigned long mask,
 	const char *name = NULL;
 
 	if (mask != 0xffffffff)
-		xt_xlate_add(xl, " and 0x%lx %s 0x%lx ", id,
-			   op == XT_OP_EQ ? "==" : "!=", mask);
+		xt_xlate_add(xl, " and 0x%lx %s 0x%lx ", mask,
+			   op == XT_OP_EQ ? "==" : "!=", id);
 	else {
 		if (numeric == 0)
 			name = xtables_lmap_id2name(realms, id);