<html>
<head>
<base href="https://bugzilla.netfilter.org/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - Empty parameters generate errors on iptables-restore, even when saved by iptables-save"
href="https://bugzilla.netfilter.org/show_bug.cgi?id=1191">1191</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Empty parameters generate errors on iptables-restore, even when saved by iptables-save
</td>
</tr>
<tr>
<th>Product</th>
<td>iptables
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>All
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P5
</td>
</tr>
<tr>
<th>Component</th>
<td>iptables-restore
</td>
</tr>
<tr>
<th>Assignee</th>
<td>netfilter-buglog@lists.netfilter.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>valeriug@gmail.com
</td>
</tr></table>
<p>
<div>
<pre>Empty comments "" are allowed and working in iptables. iptables-save saves them
correctly, but iptables-restore does not work when it encounters them.
The problem comes from iptables-restore.c function add_param_to_argv(char
*parsestart) which skips the parameters "".
Here is a example how to reproduce the problem:
- add a rule with an empty comment to running iptables
- run iptables-save
- run iptables-restore on the file saved by iptables-save
[root@ip-10-1-1-93 ~]# iptables -t filter -A INPUT -s 1.2.3.4/32 -d 1.2.3.5/32
-m comment --comment "" -j ACCEPT
[root@ip-10-1-1-93 ~]# iptables-save | tee /tmp/ipt-save
# Generated by iptables-save v1.4.21 on Tue Oct 17 07:31:53 2017
*nat
:PREROUTING ACCEPT [270:31944]
:INPUT ACCEPT [266:31784]
:OUTPUT ACCEPT [24586:1567483]
:POSTROUTING ACCEPT [24586:1567483]
COMMIT
# Completed on Tue Oct 17 07:31:53 2017
# Generated by iptables-save v1.4.21 on Tue Oct 17 07:31:53 2017
*filter
:INPUT ACCEPT [149:11200]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [79:7842]
-A INPUT -s 1.2.3.4/32 -d 1.2.3.5/32 -m comment --comment "" -j ACCEPT
COMMIT
# Completed on Tue Oct 17 07:31:53 2017
[root@ip-10-1-1-93 ~]# iptables-restore /tmp/ipt-save
Bad argument `ACCEPT'
Error occurred at line: 14
Try `iptables-restore -h' or 'iptables-restore --help' for more information.
[root@ip-10-1-1-93 ~]#</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are watching all bug changes.</li>
</ul>
</body>
</html>