Busybox: Upgrade to 1.21.1 (stable). lsof active.
[tomato.git] / release / src / router / iptables / iptables-standalone.c
blobe5c7841d9ff786fb4d06246e1cb40593adf87041
1 /*
2 * Author: Paul.Russell@rustcorp.com.au and mneuling@radlogic.com.au
4 * Based on the ipchains code by Paul Russell and Michael Neuling
6 * (C) 2000-2002 by the netfilter coreteam <coreteam@netfilter.org>:
7 * Paul 'Rusty' Russell <rusty@rustcorp.com.au>
8 * Marc Boucher <marc+nf@mbsi.ca>
9 * James Morris <jmorris@intercode.com.au>
10 * Harald Welte <laforge@gnumonks.org>
11 * Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
13 * iptables -- IP firewall administration for kernels with
14 * firewall table (aimed for the 2.3 kernels)
16 * See the accompanying manual page iptables(8) for information
17 * about proper usage of this program.
19 * This program is free software; you can redistribute it and/or modify
20 * it under the terms of the GNU General Public License as published by
21 * the Free Software Foundation; either version 2 of the License, or
22 * (at your option) any later version.
24 * This program is distributed in the hope that it will be useful,
25 * but WITHOUT ANY WARRANTY; without even the implied warranty of
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27 * GNU General Public License for more details.
29 * You should have received a copy of the GNU General Public License
30 * along with this program; if not, write to the Free Software
31 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
34 #include <stdio.h>
35 #include <stdlib.h>
36 #include <errno.h>
37 #include <string.h>
38 #include <iptables.h>
40 #ifdef IPTABLES_MULTI
41 int
42 iptables_main(int argc, char *argv[])
43 #else
44 int
45 main(int argc, char *argv[])
46 #endif
48 int ret;
49 char *table = "filter";
50 iptc_handle_t handle = NULL;
52 program_name = "iptables";
53 program_version = IPTABLES_VERSION;
55 lib_dir = getenv("IPTABLES_LIB_DIR");
56 if (!lib_dir)
57 lib_dir = IPT_LIB_DIR;
59 #ifdef NO_SHARED_LIBS
60 init_extensions();
61 #endif
63 ret = do_command(argc, argv, &table, &handle);
64 if (ret)
65 ret = iptc_commit(&handle);
67 if (!ret) {
68 fprintf(stderr, "iptables: %s\n",
69 iptc_strerror(errno));
70 if (errno == EAGAIN) {
71 exit(RESOURCE_PROBLEM);
75 exit(!ret);