aboutsummaryrefslogtreecommitdiffstats
path: root/iptables-standalone.c
diff options
context:
space:
mode:
authorSteve Kondik <shade@chemlab.org>2010-03-19 15:55:41 -0400
committerSteve Kondik <shade@chemlab.org>2010-07-13 21:18:07 -0400
commitd287acf7d7347b5eea6918884de72cb249389557 (patch)
treed7a6e20e392e45cb658b2cc26878ce63f492c658 /iptables-standalone.c
parent278d26e1424418cff04742f4c5a841da05a0ab08 (diff)
downloadandroid_external_iptables-d287acf7d7347b5eea6918884de72cb249389557.tar.gz
android_external_iptables-d287acf7d7347b5eea6918884de72cb249389557.tar.bz2
android_external_iptables-d287acf7d7347b5eea6918884de72cb249389557.zip
Update iptables to 1.4.7.master
Change-Id: I6dcb783aee47f54eaaf42ecc2a7f47a287cdabf3
Diffstat (limited to 'iptables-standalone.c')
-rw-r--r--iptables-standalone.c36
1 files changed, 23 insertions, 13 deletions
diff --git a/iptables-standalone.c b/iptables-standalone.c
index e5c7841..1f60e31 100644
--- a/iptables-standalone.c
+++ b/iptables-standalone.c
@@ -36,6 +36,7 @@
#include <errno.h>
#include <string.h>
#include <iptables.h>
+#include "iptables-multi.h"
#ifdef IPTABLES_MULTI
int
@@ -47,26 +48,35 @@ main(int argc, char *argv[])
{
int ret;
char *table = "filter";
- iptc_handle_t handle = NULL;
+ struct iptc_handle *handle = NULL;
- program_name = "iptables";
- program_version = IPTABLES_VERSION;
-
- lib_dir = getenv("IPTABLES_LIB_DIR");
- if (!lib_dir)
- lib_dir = IPT_LIB_DIR;
-
-#ifdef NO_SHARED_LIBS
+ iptables_globals.program_name = "iptables";
+ ret = xtables_init_all(&iptables_globals, NFPROTO_IPV4);
+ if (ret < 0) {
+ fprintf(stderr, "%s/%s Failed to initialize xtables\n",
+ iptables_globals.program_name,
+ iptables_globals.program_version);
+ exit(1);
+ }
+#if defined(ALL_INCLUSIVE) || defined(NO_SHARED_LIBS)
init_extensions();
#endif
ret = do_command(argc, argv, &table, &handle);
- if (ret)
- ret = iptc_commit(&handle);
+ if (ret) {
+ ret = iptc_commit(handle);
+ iptc_free(handle);
+ }
if (!ret) {
- fprintf(stderr, "iptables: %s\n",
- iptc_strerror(errno));
+ if (errno == EINVAL) {
+ fprintf(stderr, "iptables: %s. "
+ "Run `dmesg' for more information.\n",
+ iptc_strerror(errno));
+ } else {
+ fprintf(stderr, "iptables: %s.\n",
+ iptc_strerror(errno));
+ }
if (errno == EAGAIN) {
exit(RESOURCE_PROBLEM);
}