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

« back to all changes in this revision

Viewing changes to extensions/libipt_set.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:
24
24
static void set_help(void)
25
25
{
26
26
        printf("set match options:\n"
27
 
               " [!] --set     name flags\n"
28
 
               "                'name' is the set name from to match,\n" 
29
 
               "                'flags' are the comma separated list of\n"
30
 
               "                'src' and 'dst'.\n");
 
27
               " [!] --match-set name flags\n"
 
28
               "                 'name' is the set name from to match,\n" 
 
29
               "                 'flags' are the comma separated list of\n"
 
30
               "                 'src' and 'dst' specifications.\n");
31
31
}
32
32
 
33
33
static const struct option set_opts[] = {
34
 
        {"set", 1, NULL, '1'},
35
 
        { }
 
34
        { .name = "match-set", .has_arg = true, .val = '1'},
 
35
        { .name = "set",       .has_arg = true, .val = '2'},
 
36
        { .name = NULL }
36
37
};
37
38
 
38
39
static void set_init(struct xt_entry_match *match)
53
54
        struct ipt_set_info *info = &myinfo->match_set;
54
55
 
55
56
        switch (c) {
56
 
        case '1':               /* --set <set> <flag>[,<flag> */
 
57
        case '2':
 
58
#if 0
 
59
                fprintf(stderr,
 
60
                        "--set option deprecated, please use --match-set\n");
 
61
#endif
 
62
        case '1':               /* --match-set <set> <flag>[,<flag> */
57
63
                if (info->flags[0])
58
64
                        xtables_error(PARAMETER_PROBLEM,
59
 
                                   "--set can be specified only once");
 
65
                                   "--match-set can be specified only once");
60
66
 
61
67
                xtables_check_inverse(optarg, &invert, &optind, 0);
62
68
                if (invert)
66
72
                    || argv[optind][0] == '-'
67
73
                    || argv[optind][0] == '!')
68
74
                        xtables_error(PARAMETER_PROBLEM,
69
 
                                   "--set requires two args.");
 
75
                                   "--match-set requires two args.");
70
76
 
71
77
                if (strlen(argv[optind-1]) > IP_SET_MAXNAMELEN - 1)
72
78
                        xtables_error(PARAMETER_PROBLEM,
92
98
{
93
99
        if (!flags)
94
100
                xtables_error(PARAMETER_PROBLEM,
95
 
                           "You must specify `--set' with proper arguments");
 
101
                           "You must specify `--match-set' with proper arguments");
96
102
        DEBUGP("final check OK\n");
97
103
}
98
104
 
121
127
static void set_print(const void *ip, const struct xt_entry_match *match,
122
128
                      int numeric)
123
129
{
124
 
        struct ipt_set_info_match *info = 
125
 
                (struct ipt_set_info_match *) match->data;
 
130
        const struct ipt_set_info_match *info = (const void *)match->data;
126
131
 
127
 
        print_match("set", &info->match_set);
 
132
        print_match("match-set", &info->match_set);
128
133
}
129
134
 
130
135
static void set_save(const void *ip, const struct xt_entry_match *match)
131
136
{
132
 
        struct ipt_set_info_match *info = 
133
 
                (struct ipt_set_info_match *) match->data;
 
137
        const struct ipt_set_info_match *info = (const void *)match->data;
134
138
 
135
 
        print_match("--set", &info->match_set);
 
139
        print_match("--match-set", &info->match_set);
136
140
}
137
141
 
138
142
static struct xtables_match set_mt_reg = {