blob: 1bb81bc66f00e83a2085f67a3fc2d6978d597c15 [file] [log] [blame]
Rusty Russell5eed48a2000-06-02 20:12:24 +00001/*
2 * Author: Paul.Russell@rustcorp.com.au and mneuling@radlogic.com.au
3 *
Harald Welte10a907f2002-08-07 09:07:41 +00004 * (C) 2000-2002 by the netfilter coreteam <coreteam@netfilter.org>:
5 * Paul 'Rusty' Russell <rusty@rustcorp.com.au>
6 * Marc Boucher <marc+nf@mbsi.ca>
7 * James Morris <jmorris@intercode.com.au>
8 * Harald Welte <laforge@gnumonks.org>
9 * Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
10 *
Rusty Russell5eed48a2000-06-02 20:12:24 +000011 * Based on the ipchains code by Paul Russell and Michael Neuling
12 *
13 * iptables -- IP firewall administration for kernels with
14 * firewall table (aimed for the 2.3 kernels)
15 *
16 * See the accompanying manual page iptables(8) for information
17 * about proper usage of this program.
18 *
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.
23 *
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.
28 *
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.
32 */
33
34#include <stdio.h>
Harald Welted8e65632001-01-05 15:20:07 +000035#include <stdlib.h>
Rusty Russell5eed48a2000-06-02 20:12:24 +000036#include <errno.h>
37#include <ip6tables.h>
Jan Engelhardt33690a12008-02-11 00:54:00 +010038#include "ip6tables-multi.h"
Rusty Russell5eed48a2000-06-02 20:12:24 +000039
Hann-Huei Chiou4bc48332007-10-23 14:22:34 +000040#ifdef IPTABLES_MULTI
41int
42ip6tables_main(int argc, char *argv[])
43#else
Rusty Russell5eed48a2000-06-02 20:12:24 +000044int
45main(int argc, char *argv[])
Hann-Huei Chiou4bc48332007-10-23 14:22:34 +000046#endif
Rusty Russell5eed48a2000-06-02 20:12:24 +000047{
48 int ret;
49 char *table = "filter";
Fabrice MARIE8a5eb6d2001-05-05 21:37:47 +000050 ip6tc_handle_t handle = NULL;
Rusty Russell5eed48a2000-06-02 20:12:24 +000051
52 program_name = "ip6tables";
Harald Welte80fe35d2002-05-29 13:08:15 +000053 program_version = IPTABLES_VERSION;
Rusty Russell5eed48a2000-06-02 20:12:24 +000054
Jan Engelhardt21b41ee2008-02-11 01:02:00 +010055 lib_dir = getenv("XTABLES_LIBDIR");
56 if (lib_dir == NULL) {
57 lib_dir = getenv("IP6TABLES_LIB_DIR");
58 if (lib_dir != NULL)
59 fprintf(stderr, "IP6TABLES_LIB_DIR is deprecated\n");
60 }
61 if (lib_dir == NULL)
62 lib_dir = XTABLES_LIBDIR;
Martin Josefsson357d59d2004-12-27 19:49:28 +000063
Harald Welte3efb6ea2001-08-06 18:50:21 +000064#ifdef NO_SHARED_LIBS
65 init_extensions();
66#endif
67
Rusty Russell5eed48a2000-06-02 20:12:24 +000068 ret = do_command6(argc, argv, &table, &handle);
69 if (ret)
70 ret = ip6tc_commit(&handle);
71
72 if (!ret)
Philip Blundell57e07af2000-06-04 17:25:33 +000073 fprintf(stderr, "ip6tables: %s\n",
Rusty Russell5eed48a2000-06-02 20:12:24 +000074 ip6tc_strerror(errno));
75
76 exit(!ret);
77}