Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 924417 - net-firewall/ipset-7.19-r1 & -7.20 fails to restore state
Summary: net-firewall/ipset-7.19-r1 & -7.20 fails to restore state
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Mike Pagano
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-02-13 09:12 UTC by Attila Tóth
Modified: 2024-02-13 23:18 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 Attila Tóth 2024-02-13 09:12:47 UTC
I've just noticed ipset could not restore state after reboot, error messages produced by fail2ban alerted me about the problem.
Upon inspection it turns out iptables save produces a file in "plain" format, while restore expects it to be in "save" format.

Reproducible: Always
Comment 1 Attila Tóth 2024-02-13 09:16:11 UTC
As a workaround I've changed the ipset init file to reflect this observation:
# diff -urNp /usr/portage/net-firewall/ipset/files/ipset.initd-r5 /etc/init.d/ipset
--- /usr/portage/net-firewall/ipset/files/ipset.initd-r5        2023-06-17 20:10:26.000000000 +0200
+++ /etc/init.d/ipset   2024-02-11 09:42:45.062922827 +0100
@@ -100,6 +100,6 @@ reload() {
 save() {
     ebegin "Saving ipset session"
     checkpath --file --mode 0600 "${IPSET_SAVE}"
-    ipset save > "${IPSET_SAVE}"
+    ipset -output save list > "${IPSET_SAVE}"
     eend $?
 }

I'm not sure about the exact time and reason ipset started behaving like this. I could successfully recover after processing a previous saved state file.
Comment 2 Larry the Git Cow gentoo-dev 2024-02-13 23:18:18 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0baf77a9399a23c01de5dccbdbd9b5a39994b9b6

commit 0baf77a9399a23c01de5dccbdbd9b5a39994b9b6
Author:     Mike Pagano <mpagano@gentoo.org>
AuthorDate: 2024-02-13 23:17:29 +0000
Commit:     Mike Pagano <mpagano@gentoo.org>
CommitDate: 2024-02-13 23:17:29 +0000

    net-firewall/ipset: Fix saving rules, thanks to Attila Tóth
    
    Closes: https://bugs.gentoo.org/924417
    
    Signed-off-by: Mike Pagano <mpagano@gentoo.org>

 net-firewall/ipset/files/ipset.initd-r6 | 105 ++++++++++++++++++++++++++++++++
 net-firewall/ipset/ipset-7.20.ebuild    |   2 +-
 2 files changed, 106 insertions(+), 1 deletion(-)