~ubuntu-branches/ubuntu/quantal/iptables/quantal-proposed

« back to all changes in this revision

Viewing changes to extensions/libip6t_REJECT.c

  • Committer: Bazaar Package Importer
  • Author(s): Nicolas Valcárcel Scerpella
  • Date: 2009-05-06 16:35:21 UTC
  • mfrom: (5.1.6 upstream) (2.1.2 lenny)
  • Revision ID: james.westby@ubuntu.com-20090506163521-2hbruo0m33h04wxf
Tags: 1.4.3.2-2ubuntu1
* Merge from debian unstable (LP: #372920), remaining changes:
  - Don't fail to run iptables-save if iptables module isn't loaded.
  - debian/patches/0901-build-libipq_pic.a.patch - Build libipq_pic.a with
    -fPIC. Upstream changed build system and patch modified accordingly.
  - Revert changes between 1.4.1.1-3 and 1.4.1.1-4, thus bringing back
    the howtos.
* Droped unexistent patches from debian/patches/series
* Droped 0903-autoload-module-in-iptables-save.diff, fixed upstream
* Added linuxdoc-tools to Build-Depends
* Modified debian/iptables{,-dev}.install to match DM syntax 
  (removed debian/tmp)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Shared library add-on to iptables to add customized REJECT support.
 
1
/* Shared library add-on to ip6tables to add customized REJECT support.
2
2
 *
3
3
 * (C) 2000 Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
4
4
 * 
9
9
#include <string.h>
10
10
#include <stdlib.h>
11
11
#include <getopt.h>
12
 
#include <ip6tables.h>
13
 
#include <linux/netfilter_ipv6/ip6_tables.h>
 
12
#include <xtables.h>
14
13
#include <linux/netfilter_ipv6/ip6t_REJECT.h>
15
14
 
16
15
struct reject_names {
51
50
        printf("\n");
52
51
}
53
52
 
54
 
/* Saves the union ipt_targinfo in parsable form to stdout. */
55
 
 
56
 
/* Function which prints out usage message. */
57
53
static void REJECT_help(void)
58
54
{
59
55
        printf(
69
65
        { .name = NULL }
70
66
};
71
67
 
72
 
/* Allocate and initialize the target. */
73
68
static void REJECT_init(struct xt_entry_target *t)
74
69
{
75
70
        struct ip6t_reject_info *reject = (struct ip6t_reject_info *)t->data;
79
74
 
80
75
}
81
76
 
82
 
/* Function which parses command options; returns true if it
83
 
   ate an option */
84
77
static int REJECT_parse(int c, char **argv, int invert, unsigned int *flags,
85
78
                        const void *entry, struct xt_entry_target **target)
86
79
{
91
84
 
92
85
        switch(c) {
93
86
        case '1':
94
 
                if (check_inverse(optarg, &invert, NULL, 0))
95
 
                        exit_error(PARAMETER_PROBLEM,
 
87
                if (xtables_check_inverse(optarg, &invert, NULL, 0))
 
88
                        xtables_error(PARAMETER_PROBLEM,
96
89
                                   "Unexpected `!' after --reject-with");
97
90
                for (i = 0; i < limit; i++) {
98
91
                        if ((strncasecmp(reject_table[i].name, optarg, strlen(optarg)) == 0)
101
94
                                return 1;
102
95
                        }
103
96
                }
104
 
                exit_error(PARAMETER_PROBLEM, "unknown reject type `%s'",optarg);
 
97
                xtables_error(PARAMETER_PROBLEM, "unknown reject type \"%s\"", optarg);
105
98
        default:
106
99
                /* Fall through */
107
100
                break;
109
102
        return 0;
110
103
}
111
104
 
112
 
/* Prints out ipt_reject_info. */
113
105
static void REJECT_print(const void *ip, const struct xt_entry_target *target,
114
106
                         int numeric)
115
107
{
124
116
        printf("reject-with %s ", reject_table[i].name);
125
117
}
126
118
 
127
 
/* Saves ipt_reject in parsable form to stdout. */
128
119
static void REJECT_save(const void *ip, const struct xt_entry_target *target)
129
120
{
130
121
        const struct ip6t_reject_info *reject
141
132
static struct xtables_target reject_tg6_reg = {
142
133
        .name = "REJECT",
143
134
        .version        = XTABLES_VERSION,
144
 
        .family         = PF_INET6,
 
135
        .family         = NFPROTO_IPV6,
145
136
        .size           = XT_ALIGN(sizeof(struct ip6t_reject_info)),
146
137
        .userspacesize  = XT_ALIGN(sizeof(struct ip6t_reject_info)),
147
138
        .help           = REJECT_help,