]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
ebtables: Fix for wrong program name in error messages
authorPhil Sutter <phil@nwl.cc>
Thu, 2 Aug 2018 15:05:19 +0000 (17:05 +0200)
committerFlorian Westphal <fw@strlen.de>
Sat, 4 Aug 2018 12:44:43 +0000 (14:44 +0200)
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@nwl.cc>
Signed-off-by: Florian Westphal <fw@strlen.de>
iptables/nft.h
iptables/xtables-eb-standalone.c
iptables/xtables-eb.c
iptables/xtables-restore.c

index a479cf072089deaaf37442b03f24061d94cc2243..6f58de251414f2347f75db9e9b30a0ba6cfd9b73 100644 (file)
@@ -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);
 
index 2248b08d604985c632e22d679d21b327b036a943..069c9aa1d4c94d554198b9eda3d9432d9d6ab996 100644 (file)
@@ -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)
index ab0539c8a54f3f02591603e107a206a0294716c8..a88655ce4e2452351233ff7d27b04952b5222bef 100644 (file)
@@ -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,
index 60e07f78b38dfbf03e3be927d58f454708f88d19..4e46b625d02ee6599c0af3d5f10c6b4ec4686c12 100644 (file)
@@ -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) {