Re: [PATCH] iptables-translate: Moving printing of nft to individual commands.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Mar 31, 2016 at 03:56:55PM +0530, Guruswamy Basavaiah wrote:
> Moving printing of "nft" to individual commands.
> 
> At present the "nft" is not printed, if iptables command is translated into
> multiple commads.
> 
> Before this patch:
> 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
> 
> After this patch:
> 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
> nft add rule ip filter INPUT ip saddr 40.0.0.1 ip daddr 60.0.0.1 counter accept
> nft add rule ip filter INPUT ip saddr 30.0.0.1 ip daddr 20.0.0.1 counter accept
> nft 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@xxxxxxxxx>
> ---
>  iptables/xtables-translate.c | 15 +++++++--------
>  1 file changed, 7 insertions(+), 8 deletions(-)
> 
> diff --git a/iptables/xtables-translate.c b/iptables/xtables-translate.c
> index 354357c..569c26e 100644
> --- a/iptables/xtables-translate.c
> +++ b/iptables/xtables-translate.c
> @@ -107,10 +107,10 @@ static int nft_rule_xlate_add(struct nft_handle *h,
>  	int ret;
>  
>  	if (append) {
> -		xt_xlate_add(xl, "add rule %s %s %s ",
> +		xt_xlate_add(xl, "nft add rule %s %s %s ",
>  			   family2str[h->family], p->table, p->chain);

This breaks iptables-restore-translate:

# iptables-restore-translate -f my-iptables-ruleset

Actually this is currently broken, could you send a patch that fixes
this in first place.

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



[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux