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

« back to all changes in this revision

Viewing changes to extensions/libip6t_HL.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:
5
5
 * This program is distributed under the terms of GNU GPL
6
6
 */
7
7
 
 
8
#include <getopt.h>
8
9
#include <stdio.h>
9
10
#include <string.h>
10
11
#include <stdlib.h>
11
 
#include <getopt.h>
12
 
#include <ip6tables.h>
 
12
#include <xtables.h>
13
13
 
14
 
#include <linux/netfilter_ipv6/ip6_tables.h>
15
14
#include <linux/netfilter_ipv6/ip6t_HL.h>
16
15
 
17
16
#define IP6T_HL_USED    1
32
31
        unsigned int value;
33
32
 
34
33
        if (*flags & IP6T_HL_USED) {
35
 
                exit_error(PARAMETER_PROBLEM, 
 
34
                xtables_error(PARAMETER_PROBLEM,
36
35
                                "Can't specify HL option twice");
37
36
        }
38
37
 
39
38
        if (!optarg) 
40
 
                exit_error(PARAMETER_PROBLEM, 
 
39
                xtables_error(PARAMETER_PROBLEM,
41
40
                                "HL: You must specify a value");
42
41
 
43
 
        if (check_inverse(optarg, &invert, NULL, 0))
44
 
                exit_error(PARAMETER_PROBLEM,
 
42
        if (xtables_check_inverse(optarg, &invert, NULL, 0))
 
43
                xtables_error(PARAMETER_PROBLEM,
45
44
                                "HL: unexpected `!'");
46
45
        
47
 
        if (string_to_number(optarg, 0, 255, &value) == -1)     
48
 
                exit_error(PARAMETER_PROBLEM,   
 
46
        if (!xtables_strtoui(optarg, NULL, &value, 0, UINT8_MAX))
 
47
                xtables_error(PARAMETER_PROBLEM,
49
48
                           "HL: Expected value between 0 and 255");
50
49
 
51
50
        switch (c) {
56
55
 
57
56
                case '2':
58
57
                        if (value == 0) {
59
 
                                exit_error(PARAMETER_PROBLEM,
 
58
                                xtables_error(PARAMETER_PROBLEM,
60
59
                                        "HL: decreasing by 0?");
61
60
                        }
62
61
 
65
64
 
66
65
                case '3':
67
66
                        if (value == 0) {
68
 
                                exit_error(PARAMETER_PROBLEM,
 
67
                                xtables_error(PARAMETER_PROBLEM,
69
68
                                        "HL: increasing by 0?");
70
69
                        }
71
70
 
86
85
static void HL_check(unsigned int flags)
87
86
{
88
87
        if (!(flags & IP6T_HL_USED))
89
 
                exit_error(PARAMETER_PROBLEM,
 
88
                xtables_error(PARAMETER_PROBLEM,
90
89
                                "HL: You must specify an action");
91
90
}
92
91
 
141
140
static struct xtables_target hl_tg6_reg = {
142
141
        .name           = "HL",
143
142
        .version        = XTABLES_VERSION,
144
 
        .family         = PF_INET6,
 
143
        .family         = NFPROTO_IPV6,
145
144
        .size           = XT_ALIGN(sizeof(struct ip6t_HL_info)),
146
145
        .userspacesize  = XT_ALIGN(sizeof(struct ip6t_HL_info)),
147
146
        .help           = HL_help,