~cosmos-door/ubuntu/oneiric/zsh/fix-ftbfs-841489

« back to all changes in this revision

Viewing changes to Completion/BSD/Command/_pfctl

  • Committer: Bazaar Package Importer
  • Author(s): Angel Abad
  • Date: 2011-01-09 23:10:24 UTC
  • mfrom: (2.1.25 sid)
  • Revision ID: james.westby@ubuntu.com-20110109231024-7egfs040r26fq7fa
Tags: 4.3.11-1ubuntu1
* Merge from debian unstable. (LP: #700695) Remaining changes:
  - debian/zshrc: Enable completions by default, unless
    skip_global_compinit is set

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#compdef pfctl
 
2
 
 
3
local pfctl_flush_modifiers pfctl_optimizer_level pfctl_show_modifiers pfctl_tables_command pfctl_debug_level
 
4
 
 
5
pfctl_flush_modifiers=(
 
6
    'all:flush all'
 
7
    'info:flush the filter information'
 
8
    'nat:flush the NAT rules'
 
9
    'osfp:flush the passive operating system fingerprints'
 
10
    'queue:flush the queue rules'
 
11
    'rules:flush the filter rules'
 
12
    'state:flush the stable table'
 
13
    'Sources:flush the source tracking table'
 
14
    'Tables:flush the tables'
 
15
)
 
16
 
 
17
pfctl_show_modifiers=(
 
18
    'nat:show the currently loaded NAT rules'
 
19
    'queue:show the currently loaded queue rules'
 
20
    'rules:show the currently loaded filter rules'
 
21
    'Anchors:show the currently loaded anchors directly attached to the main ruleset'
 
22
    'state:show the contents of the state table'
 
23
    'Sources:show the contents of the source tracking table'
 
24
    'info:show filter information'
 
25
    'labels:show per-rule statistics of filter rules with labels'
 
26
    'timeouts:show the current global timeouts'
 
27
    'memory:show the current pool memory hard limits'
 
28
    'Tables:show the list of tables'
 
29
    'osfp:show the list of operating system fingerprints'
 
30
    'Interfaces:show the list of interfaces and interface drivers available to PF'
 
31
    'all:show all except for the lists of interfaces and operating system fingerprints'
 
32
)
 
33
 
 
34
pfctl_optimizer_level=(
 
35
    'none:disable the ruleset optimizer'
 
36
    'basic:enable basic ruleset optimizations'
 
37
    'profile:enable basic ruleset optimizations with profiling'
 
38
)
 
39
pfctl_tables_command=(
 
40
    'kill:kill a table'
 
41
    'flush:flush all addresses of a table'
 
42
    'add:add one or more addresses in a table'
 
43
    'delete:delete one or more addresses from a table'
 
44
    'expire:delete addresses which had their statistics cleared more than number seconds ago'
 
45
    'replace:replace the addresses of the table'
 
46
    'show:show the content (addresses) of a table'
 
47
    'test:test if the given addresses match a table'
 
48
    'zero:clear all the statistics of a table'
 
49
    'load:load only the table definitions from pf.conf(5)'
 
50
)
 
51
pfctl_debug_level=(
 
52
    "none:don\'t generate debug messages" 
 
53
    'urgent:generate debug messages only for serious errors' 
 
54
    'misc:generate debug messages for various errors' 
 
55
    'loud:generate debug messages for common conditions'
 
56
)
 
57
_iface() {
 
58
    local pfctl_iface
 
59
    pfctl_iface=($(pfctl -s Interfaces))
 
60
    compadd $pfctl_iface
 
61
}
 
62
_tables() {
 
63
    local pfctl_tables
 
64
    pfctl_tables=($(pfctl -s Tables))
 
65
     compadd $pfctl_tables
 
66
}
 
67
# TODO:
 
68
# Missing -a
 
69
#
 
70
_arguments -s \
 
71
    '-F[flush the filter parameters specified by modifier]:modifier:(($pfctl_flush_modifiers))' \
 
72
    '-A[load only the queue rules present in the rule file]' \
 
73
    '-D[define macro to be set to value]:macro:' \
 
74
    '-d[disable the packet filter]' \
 
75
    '-e[enable the packet filter]' \
 
76
    '-f[load the rules contained in a file]:configuration file:_files' \
 
77
    '-g[include output helpful for debugging]' \
 
78
    '-h[help]' \
 
79
    '-i[restrict the operation to the given interface]:interface:_iface' \
 
80
    '-K[kill all of the source tracking entries originating from the specified host or network]:host or network:_hosts' \
 
81
    '-k[kill all of the state entries originating from the specified host or network]:host or network:_hosts' \
 
82
    '-m[merge in explicitly given options]' \
 
83
    '-N[load only the NAT rules present in the rule file]' \
 
84
    '-n[do not actually load rules, just parse them]' \
 
85
    '-O[load only the options present in the rule file]' \
 
86
    '-o[control the ruleset optimizer]:level:(($pfctl_optimizer_level))' \
 
87
    '-p[use the device file device instead of the default /dev/pf]:device:_files' \
 
88
    '-q[only print errors and warnings]' \
 
89
    '-R[load only the filter rules present in the rule file]' \
 
90
    '-r[perform reverse DNS lookups on states when displaying them]' \
 
91
    '-s[show the filter parameters specified by modifier]:modifier:(($pfctl_show_modifiers ))' \
 
92
    '-T[specify the command to apply to the table]:command:(($pfctl_tables_command))' \
 
93
    '-t[specify the name of the table]:table:_tables' \
 
94
    '-v[produce more verbose output]' \
 
95
    '-x[set the debug level]:debug level:(($pfctl_debug_level))' \
 
96
    '-z[clear per-rule statistics]'