summaryrefslogtreecommitdiff
path: root/contrib/iptables
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/iptables')
-rw-r--r--contrib/iptables14
1 files changed, 7 insertions, 7 deletions
diff --git a/contrib/iptables b/contrib/iptables
index 849fd543..bd0e4622 100644
--- a/contrib/iptables
+++ b/contrib/iptables
@@ -6,9 +6,8 @@ _iptables()
local cur prev table chain
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
- chain='s/^Chain \([^ ]\+\).*$/\1/p'
+ _get_comp_words_by_ref cur prev
+ chain='s/^Chain \([^ ]\{1,\}\).*$/\1/p'
if [[ $COMP_LINE == *-t\ *filter* ]]; then
table="-t filter"
@@ -20,16 +19,16 @@ _iptables()
_split_longopt
- case "$prev" in
+ case $prev in
-*[AIDRPFXLZ])
COMPREPLY=( $( compgen -W '`iptables $table -nL | \
- sed -ne "s/^Chain \([^ ]\+\).*$/\1/p"`' -- "$cur" ) )
+ sed -ne "s/^Chain \([^ ]\{1,\}\).*$/\1/p"`' -- "$cur" ) )
;;
-*t)
COMPREPLY=( $( compgen -W 'nat filter mangle' -- "$cur" ) )
;;
-j)
- if [ "$table" = "-t filter" -o "$table" = "" ]; then
+ if [[ "$table" == "-t filter" || -z "$table" ]]; then
COMPREPLY=( $( compgen -W 'ACCEPT DROP LOG ULOG REJECT \
`iptables $table -nL | sed -ne "$chain" \
-e "s/INPUT|OUTPUT|FORWARD|PREROUTING|POSTROUTING//"`' -- \
@@ -48,7 +47,8 @@ _iptables()
;;
*)
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-i -o -s -d -p -f -m --append \
+ COMPREPLY=( $( compgen -W '--in-interface --out-interface --source \
+ --destination --protocol --fragment --match --append \
--delete --insert --replace --list --flush --zero --new \
--delete-chain --policy --rename-chain --proto --source \
--destination --in-interface --jump --match --numeric \