• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Author: Paul.Russell@rustcorp.com.au and mneuling@radlogic.com.au
3  *
4  * Based on the ipchains code by Paul Russell and Michael Neuling
5  *
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>
12  *
13  *	arptables -- IP firewall administration for kernels with
14  *	firewall table (aimed for the 2.3 kernels)
15  *
16  *	See the accompanying manual page arptables(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>
35 #include <stdlib.h>
36 #include <errno.h>
37 #include <string.h>
38 #include <xtables.h>
39 #include "nft.h"
40 #include <linux/netfilter_arp/arp_tables.h>
41 
42 #include "xtables-multi.h"
43 
44 extern struct xtables_globals arptables_globals;
45 
xtables_arp_main(int argc,char * argv[])46 int xtables_arp_main(int argc, char *argv[])
47 {
48 	int ret;
49 	char *table = "filter";
50 	struct nft_handle h = {
51 		.family = NFPROTO_ARP,
52 	};
53 
54 	arptables_globals.program_name = "arptables";
55 	ret = xtables_init_all(&arptables_globals, NFPROTO_ARP);
56 	if (ret < 0) {
57 		fprintf(stderr, "%s/%s Failed to initialize arptables-compat\n",
58 			arptables_globals.program_name,
59 			arptables_globals.program_version);
60 		exit(1);
61 	}
62 
63 #if defined(ALL_INCLUSIVE) || defined(NO_SHARED_LIBS)
64 	init_extensionsa();
65 #endif
66 
67 	ret = do_commandarp(&h, argc, argv, &table);
68 	if (ret)
69 		ret = nft_commit(&h);
70 
71 	nft_fini(&h);
72 
73 	if (!ret)
74 		fprintf(stderr, "arptables: %s\n", nft_strerror(errno));
75 
76 	exit(!ret);
77 }
78