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

« back to all changes in this revision

Viewing changes to extensions/libxt_quota.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:
16
16
        { .name = NULL }
17
17
};
18
18
 
19
 
/* print usage */
20
19
static void quota_help(void)
21
20
{
22
21
        printf("quota match options:\n"
23
22
               " --quota quota                  quota (bytes)\n");
24
23
}
25
24
 
26
 
/* print matchinfo */
27
25
static void
28
26
quota_print(const void *ip, const struct xt_entry_match *match, int numeric)
29
27
{
31
29
        printf("quota: %llu bytes", (unsigned long long) q->quota);
32
30
}
33
31
 
34
 
/* save matchinfo */
35
32
static void
36
33
quota_save(const void *ip, const struct xt_entry_match *match)
37
34
{
49
46
        printf("Quota: %llu\n", *quota);
50
47
#endif
51
48
 
52
 
        if (*quota == (u_int64_t)-1)
53
 
                exit_error(PARAMETER_PROBLEM, "quota invalid: '%s'\n", s);
 
49
        if (*quota == UINT64_MAX)
 
50
                xtables_error(PARAMETER_PROBLEM, "quota invalid: '%s'\n", s);
54
51
        else
55
52
                return 1;
56
53
}
57
54
 
58
 
/* parse all options, returning true if we found any for us */
59
55
static int
60
56
quota_parse(int c, char **argv, int invert, unsigned int *flags,
61
57
            const void *entry, struct xt_entry_match **match)
64
60
 
65
61
        switch (c) {
66
62
        case '1':
67
 
                if (check_inverse(optarg, &invert, NULL, 0))
68
 
                        exit_error(PARAMETER_PROBLEM, "quota: unexpected '!'");
 
63
                if (xtables_check_inverse(optarg, &invert, NULL, 0))
 
64
                        xtables_error(PARAMETER_PROBLEM, "quota: unexpected '!'");
69
65
                if (!parse_quota(optarg, &info->quota))
70
 
                        exit_error(PARAMETER_PROBLEM,
 
66
                        xtables_error(PARAMETER_PROBLEM,
71
67
                                   "bad quota: '%s'", optarg);
72
68
                break;
73
69