blob: 102c0f39811758a97d207186197e2276123266ab [file] [log] [blame]
Marc Bouchere6869a82000-03-20 06:03:29 +00001/*
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 * iptables -- IP firewall administration for kernels with
7 * firewall table (aimed for the 2.3 kernels)
8 *
9 * See the accompanying manual page iptables(8) for information
10 * about proper usage of this program.
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 */
26
27#include <stdio.h>
Rusty Russelldb780472000-12-19 05:17:50 +000028#include <stdlib.h>
Marc Bouchere6869a82000-03-20 06:03:29 +000029#include <errno.h>
Harald Welted8e65632001-01-05 15:20:07 +000030#include <string.h>
Marc Bouchere6869a82000-03-20 06:03:29 +000031#include <iptables.h>
32
33int
34main(int argc, char *argv[])
35{
36 int ret;
37 char *table = "filter";
Harald Welteae1ff9f2000-12-01 14:26:20 +000038 iptc_handle_t *handle;
39
40 handle = (iptc_handle_t *) malloc(sizeof(iptc_handle_t));
41 if (!handle) {
42 fprintf(stderr, "out of memory\n");
43 exit(1);
44 }
45 memset(handle, 0, sizeof(iptc_handle_t));
Marc Bouchere6869a82000-03-20 06:03:29 +000046
47 program_name = "iptables";
48 program_version = NETFILTER_VERSION;
49
Harald Welteae1ff9f2000-12-01 14:26:20 +000050 ret = do_command(argc, argv, &table, handle);
Marc Bouchere6869a82000-03-20 06:03:29 +000051 if (ret)
Harald Welteae1ff9f2000-12-01 14:26:20 +000052 ret = iptc_commit(handle);
Marc Bouchere6869a82000-03-20 06:03:29 +000053
54 if (!ret)
55 fprintf(stderr, "iptables: %s\n",
56 iptc_strerror(errno));
57
58 exit(!ret);
59}