<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 - v1.8.2 iptables-nft-restore incorrectly handles multiple replace commands"
href="https://bugzilla.netfilter.org/show_bug.cgi?id=1348">1348</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>v1.8.2 iptables-nft-restore incorrectly handles multiple replace commands
</td>
</tr>
<tr>
<th>Product</th>
<td>iptables
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>x86_64
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</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>shaun@tigera.io
</td>
</tr></table>
<p>
<div>
<pre>Our project uses iptables-nft-restore in noflush mode as a way to run lots of
iptables commands quickly. We've found that, in nft mode, if we use -R to
replace rules, then the rule that gets replaced is only correct for the first
-R. Subsequent replaces seem to replace the same rule again:
$ iptables-save
# Generated by xtables-save v1.8.2 on Thu Jul 4 13:13:27 2019
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
:test - [0:0]
-A test -m comment --<a href="show_bug.cgi?id=1348#c1">comment 1</a>
-A test -m comment --<a href="show_bug.cgi?id=1348#c2">comment 2</a>
COMMIT
$ iptables-restore --noflush
*filter
-R test 1 -m comment --<a href="show_bug.cgi?id=1348#c1">comment 1</a>a
-R test 2 -m comment --<a href="show_bug.cgi?id=1348#c2">comment 2</a>a
COMMIT
With legacy mode, I get this, as expected, both rules are replaced:
# Generated by iptables-save v1.8.2 on Thu Jul 4 13:19:00 2019
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
:test - [0:0]
-A test -m comment --<a href="show_bug.cgi?id=1348#c1">comment 1</a>a
-A test -m comment --<a href="show_bug.cgi?id=1348#c2">comment 2</a>a
COMMIT
# Completed on Thu Jul 4 13:19:00 2019
But with nft mode, we get
$ iptables-save
# Generated by xtables-save v1.8.2 on Thu Jul 4 13:14:09 2019
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
:test - [0:0]
-A test -m comment --<a href="show_bug.cgi?id=1348#c2">comment 2</a>a
-A test -m comment --<a href="show_bug.cgi?id=1348#c2">comment 2</a>
COMMIT
The first rule has been doubly replaced.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are watching all bug changes.</li>
</ul>
</body>
</html>