[iptables PATCH 12/27] ebtables: Fix for wrong program name in error messages

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Since nft_init_eb() is shared among standalone ebtables and
ebtables-restore, allow for callers to pass the program name.

Signed-off-by: Phil Sutter <phil@xxxxxx>
---
 iptables/nft.h                   | 2 +-
 iptables/xtables-eb-standalone.c | 2 +-
 iptables/xtables-eb.c            | 4 ++--
 iptables/xtables-restore.c       | 2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/iptables/nft.h b/iptables/nft.h
index a479cf072089d..6f58de251414f 100644
--- a/iptables/nft.h
+++ b/iptables/nft.h
@@ -145,7 +145,7 @@ int do_commandx(struct nft_handle *h, int argc, char *argv[], char **table, bool
 /* For xtables-arptables.c */
 int do_commandarp(struct nft_handle *h, int argc, char *argv[], char **table);
 /* For xtables-eb.c */
-int nft_init_eb(struct nft_handle *h);
+int nft_init_eb(struct nft_handle *h, const char *pname);
 int ebt_get_current_chain(const char *chain);
 int do_commandeb(struct nft_handle *h, int argc, char *argv[], char **table);
 
diff --git a/iptables/xtables-eb-standalone.c b/iptables/xtables-eb-standalone.c
index 2248b08d60498..069c9aa1d4c94 100644
--- a/iptables/xtables-eb-standalone.c
+++ b/iptables/xtables-eb-standalone.c
@@ -47,7 +47,7 @@ int xtables_eb_main(int argc, char *argv[])
 	char *table = "filter";
 	struct nft_handle h;
 
-	nft_init_eb(&h);
+	nft_init_eb(&h, "ebtables");
 
 	ret = do_commandeb(&h, argc, argv, &table);
 	if (ret)
diff --git a/iptables/xtables-eb.c b/iptables/xtables-eb.c
index ab0539c8a54f3..a88655ce4e245 100644
--- a/iptables/xtables-eb.c
+++ b/iptables/xtables-eb.c
@@ -732,9 +732,9 @@ void ebt_add_watcher(struct xtables_target *watcher,
 		cs->match_list->next = newnode;
 }
 
-int nft_init_eb(struct nft_handle *h)
+int nft_init_eb(struct nft_handle *h, const char *pname)
 {
-	ebtables_globals.program_name = "ebtables";
+	ebtables_globals.program_name = pname;
 	if (xtables_init_all(&ebtables_globals, NFPROTO_BRIDGE) < 0) {
 		fprintf(stderr, "%s/%s Failed to initialize ebtables-compat\n",
 			ebtables_globals.program_name,
diff --git a/iptables/xtables-restore.c b/iptables/xtables-restore.c
index 60e07f78b38df..4e46b625d02ee 100644
--- a/iptables/xtables-restore.c
+++ b/iptables/xtables-restore.c
@@ -515,7 +515,7 @@ int xtables_eb_restore_main(int argc, char *argv[])
 	const char *table = NULL;
 	struct nft_handle h;
 
-	nft_init_eb(&h);
+	nft_init_eb(&h, "ebtables-restore");
 
 	while ((c = getopt_long(argc, argv, "n",
 				ebt_restore_options, NULL)) != -1) {
-- 
2.18.0

--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux