This service will be undergoing maintenance at 00:00 UTC, 2016-09-28. It is expected to last about 1 hours
Bug 27669 - iptables-restore complains that --dport is a bad argument
iptables-restore complains that --dport is a bad argument
Status: CLOSED DEFERRED
Product: Red Hat Linux
Classification: Retired
Component: iptables (Show other bugs)
7.1
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Bernhard Rosenkraenzer
David Lawrence
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2001-02-14 17:01 EST by Derrick Hamner
Modified: 2007-04-18 12:31 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2001-02-15 20:12:01 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description Derrick Hamner 2001-02-14 17:01:30 EST
From Bugzilla Helper:
User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0)


iptables-save uses the option --dport in creating an input file for 
iptables-restore. iptables-restore complains that --dport is a bad 
argument.

Reproducible: Always
Steps to Reproduce:
1. iptables -A FORWARD -p tcp --dport 137:139 -j REJECT
2. iptables-save > iptables
3. iptables -F
4. iptables-restore < iptables
5. iptables -L

Actual Results:  Bad argument `dport'
The FORWARD chain is not recreated.

Expected Results:  The FORWARD chain should have been recreated.

iptables-1.2.0-4
Comment 1 Glen Foster 2001-02-15 20:11:57 EST
We (Red Hat) should really try to resolve this before next release.
Comment 2 Karsten Hopp 2001-02-20 10:12:03 EST
iptables-save / iptables-restore development was discontinued a few month
ago. The parameters --dport / --destination-port and probably some of the
rarely used others are not supported by iptables-restore.
Comment 3 Nadav Har'El 2001-08-19 09:46:29 EDT
I don't understand why you call "--dport" a "rarely used" option: half my
packet-filtering rules use it, and also some of my NAT rules! (sure, if you only
use the "state" module, you won't need --dport).

iptables-restore (from iptables-1.2.1a-1) also dumps core on some format errors
(e.g., when you forget the [0:0] counter on the :... chain policy line).

Will iptables-restore (and /etc/init.d/iptables) work correctly in Redhat 7.2?
If not, I wrote a very simple zsh script to replace iptables-restore, and I
suggest you do something similar (note that my simple script doesn't restore
counters and is not atomic). I can't believe I'm the only one who sets up a
firewall by putting commands in /etc/sysconfig/iptables....

#!/bin/zsh
# this is a simple replacement to iptables-restore, because that one is
# buggy (doesn't accept --dport, core dumps on errors, etc.)
set -e
while read a
do
        table="filter"   # iptables-restore starts with "", BTW
        case $a in
        \**) table=${a#\*};;
        -*) iptables -t "$table" ${=a};;
        :*) iptables -t "$table" -P ${${a#:}%% *} ${${a#* }%% *};;
        COMMIT);; # what should we do with that?
        esac
done </etc/sysconfig/iptables

# this is a simple replacement to iptables-restore, because that one is
# buggy (doesn't accept --dport, core dumps on errors, etc.)
set -e

Note You need to log in before you can comment on or make changes to this bug.