diff options
author | Quentin Armitage <quentin@armitage.org.uk> | 2022-08-11 17:52:18 +0100 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2022-08-16 23:38:37 +0200 |
commit | e1b60b2a93356c313cccb2abfdae4b58d530e02b (patch) | |
tree | 27ca7de796923e91809d93199db8ceb2cd48f2e1 /src/ipset.c | |
parent | be7f6099feb7b5d34715b06f9308877cdcdc404a (diff) |
ipset-translate: allow invoking with a path name
Executing /usr/sbin/ipset-translate results in the ipset functionality being run, rather than the ipset-translate functionality.
# ipset-translate destroy fred
This command is not supported, use `ipset-translate restore < file'
# /usr/sbin/ipset-translate destroy fred
ipset v7.15: The set with the given name does not exist
use basename() to resolve the issue.
Closes: https://bugzilla.netfilter.org/show_bug.cgi?id=1626
Signed-off-by: Quentin Armitage <quentin@armitage.org.uk>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/ipset.c')
-rw-r--r-- | src/ipset.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/ipset.c b/src/ipset.c index 6d42b60..162f477 100644 --- a/src/ipset.c +++ b/src/ipset.c @@ -6,6 +6,7 @@ * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ +#define _GNU_SOURCE #include <assert.h> /* assert */ #include <stdio.h> /* fprintf */ #include <stdlib.h> /* exit */ @@ -31,7 +32,7 @@ main(int argc, char *argv[]) exit(1); } - if (!strcmp(argv[0], "ipset-translate")) { + if (!strcmp(basename(argv[0]), "ipset-translate")) { ret = ipset_xlate_argv(ipset, argc, argv); } else { ret = ipset_parse_argv(ipset, argc, argv); |