Correct PPTP server firewall rules chain.
[tomato/davidwu.git] / release / src / router / ebtables / extensions / ebt_standard.c
blob67d4d7cc7046b8106ccaf200860e0f58e7bc3c63
1 /* ebt_standard
3 * Authors:
4 * Bart De Schuymer <bdschuym@pandora.be>
6 * April, 2002
7 */
9 #include <stdio.h>
10 #include <stdlib.h>
11 #include <getopt.h>
12 #include "../include/ebtables_u.h"
14 static struct option opts[] =
16 {0}
19 static void print_help()
21 printf("Standard targets: DROP, ACCEPT, RETURN or CONTINUE;\n"
22 "The target can also be a user defined chain.\n");
25 static void init(struct ebt_entry_target *t)
27 ((struct ebt_standard_target *)t)->verdict = EBT_CONTINUE;
30 static int parse(int c, char **argv, int argc, const struct ebt_u_entry *entry,
31 unsigned int *flags, struct ebt_entry_target **target)
33 return 0;
36 static void final_check(const struct ebt_u_entry *entry,
37 const struct ebt_entry_target *target, const char *name,
38 unsigned int hookmask, unsigned int time)
42 static void print(const struct ebt_u_entry *entry,
43 const struct ebt_entry_target *target)
45 int verdict = ((struct ebt_standard_target *)target)->verdict;
47 if (verdict >= 0) {
48 struct ebt_u_entries *entries;
50 entries = entry->replace->chains[verdict + NF_BR_NUMHOOKS];
51 printf("%s", entries->name);
52 return;
54 if (verdict == EBT_CONTINUE)
55 printf("CONTINUE ");
56 else if (verdict == EBT_ACCEPT)
57 printf("ACCEPT ");
58 else if (verdict == EBT_DROP)
59 printf("DROP ");
60 else if (verdict == EBT_RETURN)
61 printf("RETURN ");
62 else
63 ebt_print_bug("Bad standard target");
66 static int compare(const struct ebt_entry_target *t1,
67 const struct ebt_entry_target *t2)
69 return ((struct ebt_standard_target *)t1)->verdict ==
70 ((struct ebt_standard_target *)t2)->verdict;
73 static struct ebt_u_target standard =
75 .name = "standard",
76 .size = sizeof(struct ebt_standard_target) -
77 sizeof(struct ebt_entry_target),
78 .help = print_help,
79 .init = init,
80 .parse = parse,
81 .final_check = final_check,
82 .print = print,
83 .compare = compare,
84 .extra_ops = opts,
87 void _init(void)
89 ebt_register_target(&standard);