~ubuntu-branches/ubuntu/karmic/iptables/karmic

« back to all changes in this revision

Viewing changes to extensions/libip6t_REJECT.c

  • Committer: Bazaar Package Importer
  • Author(s): Bhavani Shankar
  • Date: 2009-07-14 15:59:54 UTC
  • mto: This revision was merged to the branch mainline in revision 22.
  • Revision ID: james.westby@ubuntu.com-20090714155954-fu29byrib4zshbaa
Tags: upstream-1.4.4
ImportĀ upstreamĀ versionĀ 1.4.4

Show diffs side-by-side

added added

removed removed

Lines of Context:
43
43
 
44
44
        printf("Valid reject types:\n");
45
45
 
46
 
        for (i = 0; i < sizeof(reject_table)/sizeof(struct reject_names); i++) {
 
46
        for (i = 0; i < ARRAY_SIZE(reject_table); ++i) {
47
47
                printf("    %-25s\t%s\n", reject_table[i].name, reject_table[i].desc);
48
48
                printf("    %-25s\talias\n", reject_table[i].alias);
49
49
        }
79
79
{
80
80
        struct ip6t_reject_info *reject = 
81
81
                (struct ip6t_reject_info *)(*target)->data;
82
 
        unsigned int limit = sizeof(reject_table)/sizeof(struct reject_names);
83
82
        unsigned int i;
84
83
 
85
84
        switch(c) {
87
86
                if (xtables_check_inverse(optarg, &invert, NULL, 0))
88
87
                        xtables_error(PARAMETER_PROBLEM,
89
88
                                   "Unexpected `!' after --reject-with");
90
 
                for (i = 0; i < limit; i++) {
 
89
                for (i = 0; i < ARRAY_SIZE(reject_table); ++i)
91
90
                        if ((strncasecmp(reject_table[i].name, optarg, strlen(optarg)) == 0)
92
91
                            || (strncasecmp(reject_table[i].alias, optarg, strlen(optarg)) == 0)) {
93
92
                                reject->with = reject_table[i].with;
94
93
                                return 1;
95
94
                        }
96
 
                }
97
95
                xtables_error(PARAMETER_PROBLEM, "unknown reject type \"%s\"", optarg);
98
96
        default:
99
97
                /* Fall through */
109
107
                = (const struct ip6t_reject_info *)target->data;
110
108
        unsigned int i;
111
109
 
112
 
        for (i = 0; i < sizeof(reject_table)/sizeof(struct reject_names); i++) {
 
110
        for (i = 0; i < ARRAY_SIZE(reject_table); ++i)
113
111
                if (reject_table[i].with == reject->with)
114
112
                        break;
115
 
        }
116
113
        printf("reject-with %s ", reject_table[i].name);
117
114
}
118
115
 
122
119
                = (const struct ip6t_reject_info *)target->data;
123
120
        unsigned int i;
124
121
 
125
 
        for (i = 0; i < sizeof(reject_table)/sizeof(struct reject_names); i++)
 
122
        for (i = 0; i < ARRAY_SIZE(reject_table); ++i)
126
123
                if (reject_table[i].with == reject->with)
127
124
                        break;
128
125