From 9283066f1216276116b3f4f85abf18bd673a7b11 Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Tue, 25 Jun 2013 11:56:55 +0200 Subject: xtables: do not proceed if nft_init fails Fix a crash if nft_init fails, it happens if nfnetlink support is not available in your Linux kernel. Signed-off-by: Pablo Neira Ayuso --- iptables/xtables-restore.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'iptables/xtables-restore.c') diff --git a/iptables/xtables-restore.c b/iptables/xtables-restore.c index 4f196fc6..a5d2a65d 100644 --- a/iptables/xtables-restore.c +++ b/iptables/xtables-restore.c @@ -193,7 +193,13 @@ xtables_restore_main(int argc, char *argv[]) init_extensions4(); #endif - nft_init(&h); + if (nft_init(&h) < 0) { + fprintf(stderr, "%s/%s Failed to initialize nft: %s\n", + xtables_globals.program_name, + xtables_globals.program_version, + strerror(errno)); + exit(EXIT_FAILURE); + } while ((c = getopt_long(argc, argv, "bcvthnM:T:46", options, NULL)) != -1) { switch (c) { -- cgit v1.2.3