All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] iptables-translate: Initializing comment member in xt_xlate structure
@ 2016-03-28 19:04 Guruswamy Basavaiah
  2016-03-29 10:58 ` Pablo Neira Ayuso
  0 siblings, 1 reply; 2+ messages in thread
From: Guruswamy Basavaiah @ 2016-03-28 19:04 UTC (permalink / raw)
  To: netfilter-devel

Initializing comment member in xt_xlate structure. 

Because of not initializing, when translating iptables command with multiple
ip addresses, In the translated commands --comment field is getting added.

Before fix:
inbhdhcp21574:basavaia$>sudo ./iptables-translate -A INPUT --source "40.0.0.1, 30.0.0.1" --dest "20.0.0.1, 60.0.0.1" -j ACCEPT
nft add rule ip filter INPUT ip saddr 40.0.0.1 ip daddr 20.0.0.1 counter accept
add rule ip filter INPUT ip saddr 40.0.0.1 ip daddr 60.0.0.1 counter comment \" \" accept
add rule ip filter INPUT ip saddr 30.0.0.1 ip daddr 20.0.0.1 counter comment \" \" accept
add rule ip filter INPUT ip saddr 30.0.0.1 ip daddr 60.0.0.1 counter comment \" \" accept

After fix:
inbhdhcp21574:basavaia$>sudo ./iptables-translate -A INPUT --source "40.0.0.1, 30.0.0.1" --dest "20.0.0.1, 60.0.0.1" -j ACCEPT
nft add rule ip filter INPUT ip saddr 40.0.0.1 ip daddr 20.0.0.1 counter accept
add rule ip filter INPUT ip saddr 40.0.0.1 ip daddr 60.0.0.1 counter accept
add rule ip filter INPUT ip saddr 30.0.0.1 ip daddr 20.0.0.1 counter accept
add rule ip filter INPUT ip saddr 30.0.0.1 ip daddr 60.0.0.1 counter accept

Signed-off-by: Guruswamy Basavaiah <guru2018@gmail.com>
---
 libxtables/xtables.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libxtables/xtables.c b/libxtables/xtables.c
index fe24caa..cdb56c0 100644
--- a/libxtables/xtables.c
+++ b/libxtables/xtables.c
@@ -2014,6 +2014,7 @@ struct xt_xlate *xt_xlate_alloc(int size)
 	xl->buf.size = size;
 	xl->buf.rem = size;
 	xl->buf.off = 0;
+	bzero(xl->comment, NFT_USERDATA_MAXLEN);
 
 	return xl;
 }
-- 
2.5.0


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

* Re: [PATCH] iptables-translate: Initializing comment member in xt_xlate structure
  2016-03-28 19:04 [PATCH] iptables-translate: Initializing comment member in xt_xlate structure Guruswamy Basavaiah
@ 2016-03-29 10:58 ` Pablo Neira Ayuso
  0 siblings, 0 replies; 2+ messages in thread
From: Pablo Neira Ayuso @ 2016-03-29 10:58 UTC (permalink / raw)
  To: Guruswamy Basavaiah; +Cc: netfilter-devel

On Tue, Mar 29, 2016 at 12:34:36AM +0530, Guruswamy Basavaiah wrote:
> Initializing comment member in xt_xlate structure. 
> 
> Because of not initializing, when translating iptables command with multiple
> ip addresses, In the translated commands --comment field is getting added.
> 
> Before fix:
> inbhdhcp21574:basavaia$>sudo ./iptables-translate -A INPUT --source "40.0.0.1, 30.0.0.1" --dest "20.0.0.1, 60.0.0.1" -j ACCEPT
> nft add rule ip filter INPUT ip saddr 40.0.0.1 ip daddr 20.0.0.1 counter accept
> add rule ip filter INPUT ip saddr 40.0.0.1 ip daddr 60.0.0.1 counter comment \" \" accept
> add rule ip filter INPUT ip saddr 30.0.0.1 ip daddr 20.0.0.1 counter comment \" \" accept
> add rule ip filter INPUT ip saddr 30.0.0.1 ip daddr 60.0.0.1 counter comment \" \" accept

Thanks, I already pushed something similar yesterday.

http://git.netfilter.org/iptables/commit/?id=c93850d1d78c7040709d78aee5514c5c5035c4ab

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

end of thread, other threads:[~2016-03-29 10:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-28 19:04 [PATCH] iptables-translate: Initializing comment member in xt_xlate structure Guruswamy Basavaiah
2016-03-29 10:58 ` Pablo Neira Ayuso

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.