summaryrefslogtreecommitdiffstats
path: root/iptables
diff options
context:
space:
mode:
Diffstat (limited to 'iptables')
-rw-r--r--iptables/nft-cmd.c1
-rw-r--r--iptables/nft-cmd.h3
-rw-r--r--iptables/nft.c2
-rw-r--r--iptables/xtables-restore.c2
4 files changed, 7 insertions, 1 deletions
diff --git a/iptables/nft-cmd.c b/iptables/nft-cmd.c
index fcd01bd0..f16ea0e6 100644
--- a/iptables/nft-cmd.c
+++ b/iptables/nft-cmd.c
@@ -24,6 +24,7 @@ struct nft_cmd *nft_cmd_new(struct nft_handle *h, int command,
struct nft_cmd *cmd;
cmd = xtables_calloc(1, sizeof(struct nft_cmd));
+ cmd->error.lineno = h->error.lineno;
cmd->command = command;
cmd->table = xtables_strdup(table);
if (chain)
diff --git a/iptables/nft-cmd.h b/iptables/nft-cmd.h
index b5a99ef7..c0f84636 100644
--- a/iptables/nft-cmd.h
+++ b/iptables/nft-cmd.h
@@ -24,6 +24,9 @@ struct nft_cmd {
struct xt_counters counters;
const char *rename;
int counters_save;
+ struct {
+ unsigned int lineno;
+ } error;
};
struct nft_cmd *nft_cmd_new(struct nft_handle *h, int command,
diff --git a/iptables/nft.c b/iptables/nft.c
index ee003511..fd552506 100644
--- a/iptables/nft.c
+++ b/iptables/nft.c
@@ -3360,6 +3360,8 @@ static int nft_prepare(struct nft_handle *h)
nft_cache_build(h);
list_for_each_entry_safe(cmd, next, &h->cmd_list, head) {
+ h->error.lineno = cmd->error.lineno;
+
switch (cmd->command) {
case NFT_COMPAT_TABLE_FLUSH:
ret = nft_table_flush(h, cmd->table);
diff --git a/iptables/xtables-restore.c b/iptables/xtables-restore.c
index 052a80c2..c9d4ffbf 100644
--- a/iptables/xtables-restore.c
+++ b/iptables/xtables-restore.c
@@ -250,7 +250,7 @@ static void xtables_restore_parse_line(struct nft_handle *h,
return;
if (!ret) {
fprintf(stderr, "%s: line %u failed",
- xt_params->program_name, line);
+ xt_params->program_name, h->error.lineno);
if (errno)
fprintf(stderr, ": %s.", nft_strerror(errno));
fprintf(stderr, "\n");