diff options
Diffstat (limited to 'iptables-save.c')
-rw-r--r-- | iptables-save.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/iptables-save.c b/iptables-save.c index 55cfe6a1..6000b494 100644 --- a/iptables-save.c +++ b/iptables-save.c @@ -28,6 +28,7 @@ static const struct option options[] = { {.name = "counters", .has_arg = false, .val = 'c'}, {.name = "dump", .has_arg = false, .val = 'd'}, {.name = "table", .has_arg = true, .val = 't'}, + {.name = "modprobe", .has_arg = true, .val = 'M'}, {NULL}, }; @@ -40,9 +41,7 @@ static int for_each_table(int (*func)(const char *tablename)) procfile = fopen("/proc/net/ip_tables_names", "r"); if (!procfile) - xtables_error(OTHER_PROBLEM, - "Unable to open /proc/net/ip_tables_names: %s\n", - strerror(errno)); + return ret; while (fgets(tablename, sizeof(tablename), procfile)) { if (tablename[strlen(tablename) - 1] != '\n') @@ -66,6 +65,10 @@ static int do_output(const char *tablename) return for_each_table(&do_output); h = iptc_init(tablename); + if (h == NULL) { + xtables_load_ko(xtables_modprobe_program, false); + h = iptc_init(tablename); + } if (!h) xtables_error(OTHER_PROBLEM, "Cannot initialize: %s\n", iptc_strerror(errno)); @@ -162,6 +165,9 @@ main(int argc, char *argv[]) /* Select specific table. */ tablename = optarg; break; + case 'M': + xtables_modprobe_program = optarg; + break; case 'd': do_output(tablename); exit(0); |