~ubuntu-branches/ubuntu/precise/iptables/precise-updates

« back to all changes in this revision

Viewing changes to extensions/libxt_sctp.c

  • Committer: Bazaar Package Importer
  • Author(s): Bhavani Shankar
  • Date: 2009-07-14 15:59:54 UTC
  • mfrom: (5.1.7 upstream)
  • Revision ID: james.westby@ubuntu.com-20090714155954-9039kro8cnh6lb1q
Tags: 1.4.4-1ubuntu1
* Merge from debian unstable, remaining changes: LP: #399211
  - 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.
  - 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:
17
17
#include <netinet/in.h>
18
18
#include <xtables.h>
19
19
 
20
 
#ifndef ARRAY_SIZE
21
 
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
22
 
#endif
23
 
 
24
20
#include <linux/netfilter/xt_sctp.h>
25
21
 
26
 
/* Some ZS!#@:$%*#$! has replaced the ELEMCOUNT macro in ipt_sctp.h with
27
 
 * ARRAY_SIZE without noticing that this file is used from userspace,
28
 
 * and userspace doesn't have ARRAY_SIZE */
29
 
 
30
 
#ifndef ELEMCOUNT
31
 
#define ELEMCOUNT ARRAY_SIZE
32
 
#endif
33
 
 
34
22
#if 0
35
23
#define DEBUGP(format, first...) printf(format, ##first)
36
24
#define static
198
186
                        *chunk_flags++ = 0;
199
187
                }
200
188
                
201
 
                for (i = 0; i < ELEMCOUNT(sctp_chunk_names); i++) {
 
189
                for (i = 0; i < ARRAY_SIZE(sctp_chunk_names); ++i)
202
190
                        if (strcasecmp(sctp_chunk_names[i].name, ptr) == 0) {
203
191
                                DEBUGP("Chunk num %d\n", sctp_chunk_names[i].chunk_type);
204
192
                                SCTP_CHUNKMAP_SET(einfo->chunkmap, 
206
194
                                found = 1;
207
195
                                break;
208
196
                        }
209
 
                }
210
197
                if (!found)
211
198
                        xtables_error(PARAMETER_PROBLEM,
212
199
                                   "Unknown sctp chunk `%s'", ptr);
389
376
        else {
390
377
                int i;
391
378
 
392
 
                for (i = 0; i < ELEMCOUNT(sctp_chunk_names); i++) {
 
379
                for (i = 0; i < ARRAY_SIZE(sctp_chunk_names); ++i)
393
380
                        if (sctp_chunk_names[i].chunk_type == chunknum)
394
381
                                printf("%s", sctp_chunk_names[chunknum].name);
395
 
                }
396
382
        }
397
383
}
398
384