Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iptables save problem #311

Closed
fatihusta opened this issue Dec 10, 2019 · 1 comment
Closed

iptables save problem #311

fatihusta opened this issue Dec 10, 2019 · 1 comment
Milestone

Comments

@fatihusta
Copy link

@fatihusta fatihusta commented Dec 10, 2019

[root@jool ~]# jool instance add --pool6=64:ff9a::/96 --iptables "example"
[root@jool ~]# jool instance display
+--------------------+-----------------+-----------+
|          Namespace |            Name | Framework |
+--------------------+-----------------+-----------+
|   ffffffff80e868c0 |         example |  iptables |
+--------------------+-----------------+-----------+
[root@jool ~]# iptables  -t mangle -A PREROUTING -j JOOL --instance example
[root@jool ~]# iptables-save > iptables.jool.save
[root@jool ~]# iptables-restore < iptables.jool.save 
Bad argument `example'
Error occurred at line: 14
Try `iptables-restore -h' or 'iptables-restore --help' for more information.
[root@jool ~]# cat iptables.jool.save 
# Generated by iptables-save v1.6.0 on Tue Dec 10 09:45:36 2019
....

*mangle
:PREROUTING ACCEPT [171:13511]
:INPUT ACCEPT [161:12914]
:FORWARD ACCEPT [10:597]
:OUTPUT ACCEPT [144:13647]
:POSTROUTING ACCEPT [154:14244]
-A PREROUTING -j JOOL--instance example 
COMMIT
# Completed on Tue Dec 10 09:45:36 2019

....

As you can see. JOOL and instance together.

-A PREROUTING -j JOOL--instance example

When I edit iptables.jool.save file like this.

-A PREROUTING -j JOOL --instance example

There is no problem during the restore.

[root@root ~]# vim iptables.jool.save 
[root@root ~]# iptables-restore < iptables.jool.save 
[root@root ~]# echo $?
0
@fatihusta

This comment has been minimized.

Copy link
Author

@fatihusta fatihusta commented Dec 10, 2019

Minor fix.

diff -aur a/src/usr/iptables/common.c b/src/usr/iptables/common.c
--- a/src/usr/iptables/common.c	2019-12-10 10:35:08.000000000 +0200
+++ b/src/usr/iptables/common.c	2019-12-10 10:35:37.000000000 +0200
@@ -88,7 +88,7 @@
 static void jool_tg_save(const void *ip, const struct xt_entry_target *target)
 {
 	struct target_info *info = (struct target_info *)target->data;
-	printf("--" OPTNAME_INAME " %s ", info->iname);
+	printf(" --" OPTNAME_INAME " %s ", info->iname);
 }
 
 static struct xtables_target targets[] = {
@ydahhrk ydahhrk closed this in cfa601a Dec 10, 2019
@ydahhrk ydahhrk added this to the 4.0.7 milestone Dec 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.