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.
39 #include "xtables-multi.h"
42 static struct xtables_globals
*xtables_globals_lookup(int family
)
47 return &xtables_globals
;
49 return &arptables_globals
;
51 return &ebtables_globals
;
53 xtables_error(OTHER_PROBLEM
, "Unknown family value %d", family
);
58 xtables_main(int family
, const char *progname
, int argc
, char *argv
[])
60 char *table
= "filter";
64 ret
= xtables_init_all(xtables_globals_lookup(family
), family
);
66 fprintf(stderr
, "%s: Failed to initialize xtables\n", progname
);
69 xt_params
->program_name
= progname
;
86 if (nft_init(&h
, family
) < 0) {
87 fprintf(stderr
, "%s: Failed to initialize nft: %s\n",
88 xt_params
->program_name
, strerror(errno
));
92 ret
= do_commandx(&h
, argc
, argv
, &table
, false);
100 fprintf(stderr
, "%s: %s.%s\n", progname
, nft_strerror(errno
),
102 " Run `dmesg' for more information." : ""));
105 exit(RESOURCE_PROBLEM
);
111 int xtables_ip4_main(int argc
, char *argv
[])
113 return xtables_main(NFPROTO_IPV4
, "iptables", argc
, argv
);
116 int xtables_ip6_main(int argc
, char *argv
[])
118 return xtables_main(NFPROTO_IPV6
, "ip6tables", argc
, argv
);
121 int xtables_arp_main(int argc
, char *argv
[])
123 return xtables_main(NFPROTO_ARP
, "arptables", argc
, argv
);