Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 378883 - net-firewall/iptables-1.4.11.1-r2: iptables-save misses space
Summary: net-firewall/iptables-1.4.11.1-r2: iptables-save misses space
Status: RESOLVED INVALID
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: High normal
Assignee: Peter Volkov (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-08-12 09:03 UTC by cilly
Modified: 2011-09-03 13:15 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description cilly 2011-08-12 09:03:03 UTC
There is a bug in iptables-save command:

Error message is:


/etc/portage/patches/net-firewall/iptables # /etc/init.d/iptables restart
 * Caching service dependencies ...                                                                                                                                                                                                                                          [ ok ]
 * Loading iptables state and starting firewall ...
iptables-restore v1.4.11.1: Couldn't load match `layer7--l7proto':No such file or directory

Error occurred at line: 178
Try `iptables-restore -h' or 'iptables-restore --help' for more information.                                                                                                                                                                                                 [ !! ]
 * ERROR: iptables failed to start

above rule is added as:

iptables -A public-network-filter -m layer7 --l7proto bittorrent  -j DROP

The rule works fine.

After iptables save the above error-messages appears and there is a missing space in saved rules:

grep l7proto /var/lib/iptables/rules-save 
-A public-network-filter -m layer7--l7proto bittorrent  -j DROP

Manually editing the file and adding the space back so the above line reads as:

-A public-network-filter -m layer7 --l7proto bittorrent  -j DROP

and the rule is loading and working after /etc/init.d/iptables restart
Comment 1 Peter Volkov (RETIRED) gentoo-dev 2011-09-03 13:04:39 UTC
This is not bug in iptables but in l7filters. iptables developers changed indentation, so ... you'll have to update libxt_layer7.c to match newer iptables. Just check the following function there:

static void save(const void *ip, const struct xt_entry_match *match)
{
        const struct xt_layer7_info *info =
            (const struct xt_layer7_info*) match->data;

        printf("--l7proto %s%s ", (info->invert)? "! ":"", info->protocol);
}

and update printf accordingly (I guess space before --l7proto should be enough).

In any case no package in our tree provides this match, so ... invalid.
Comment 2 cilly 2011-09-03 13:15:04 UTC
Thx, for helping.

In my opinion iptables is crippled, since it does not use the same parser for add, list and save process. This won't be a gentoo bug, either. ;)