All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH iptables] libxtables: fix wrong naddr when using localhost
@ 2017-03-07 23:28 Alexander Alemayhu
  2017-03-08  9:55 ` Pablo Neira Ayuso
  0 siblings, 1 reply; 3+ messages in thread
From: Alexander Alemayhu @ 2017-03-07 23:28 UTC (permalink / raw)
  To: netfilter-devel; +Cc: Alexander Alemayhu

$ iptables-translate -A INPUT -p tcp -s localhost --dport 8000 -j ACCEPT

gives

 nft add rule ip filter INPUT ip saddr 127.0.0.1 tcp dport 8000 counter accept
 add rule ip filter INPUT ip saddr 127.0.0.1 tcp dport 8000 counter accept

with this patch we get

 nft add rule ip filter INPUT ip saddr 127.0.0.1 tcp dport 8000 counter accept

Signed-off-by: Alexander Alemayhu <alexander@alemayhu.com>
---
 libxtables/xtables.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libxtables/xtables.c b/libxtables/xtables.c
index d43f97066ea9..defc57414de3 100644
--- a/libxtables/xtables.c
+++ b/libxtables/xtables.c
@@ -1376,7 +1376,7 @@ static struct in_addr *host_to_ipaddr(const char *name, unsigned int *naddr)
 		return NULL;
 	} else {
 		for (p = res; p != NULL; p = p->ai_next)
-			++*naddr;
+			*naddr++;
 		addr = xtables_calloc(*naddr, sizeof(struct in_addr));
 		for (i = 0, p = res; p != NULL; p = p->ai_next)
 			memcpy(&addr[i++],
-- 
2.9.3


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-03-08 11:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-07 23:28 [PATCH iptables] libxtables: fix wrong naddr when using localhost Alexander Alemayhu
2017-03-08  9:55 ` Pablo Neira Ayuso
2017-03-08 11:10   ` Alexander Alemayhu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.