summaryrefslogtreecommitdiffstats
path: root/completions/ebtables
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--completions/ebtables78
1 files changed, 78 insertions, 0 deletions
diff --git a/completions/ebtables b/completions/ebtables
new file mode 100644
index 0000000..de6bc54
--- /dev/null
+++ b/completions/ebtables
@@ -0,0 +1,78 @@
+# bash completion for ebtables -*- shell-script -*-
+
+_ebtables()
+{
+ local cur prev words cword split
+ _init_completion -s || return
+
+ local table chain='s/^Bridge chain: \([^ ,]\{1,\}\).*$/\1/p' \
+ targets='ACCEPT DROP CONTINUE RETURN'
+
+ [[ ${words[*]} =~ [[:space:]]-(t|-table=?)[[:space:]]*([^[:space:]]+) ]] &&
+ table="-t ${BASH_REMATCH[2]}"
+
+ case $prev in
+ -!(-*)[AIDPFXLZ])
+ COMPREPLY=($(compgen -W '`"$1" $table -L 2>/dev/null | \
+ command sed -ne "$chain"`' -- "$cur"))
+ ;;
+ -!(-*)t)
+ COMPREPLY=($(compgen -W 'nat filter broute' -- "$cur"))
+ ;;
+ -!(-*)j)
+ if [[ $table == "-t filter" || -z $table ]]; then
+ COMPREPLY=($(compgen -W '$targets
+ $("$1" $table -L 2>/dev/null | \
+ command sed -n -e "s/INPUT\|OUTPUT\|FORWARD//" \
+ -e "$chain")' \
+ -- "$cur"))
+ elif [[ $table == "-t nat" ]]; then
+ COMPREPLY=($(compgen -W '$targets
+ $("$1" $table -L 2>/dev/null | \
+ command sed -n -e "s/OUTPUT|PREROUTING|POSTROUTING//" \
+ -e "$chain")' \
+ -- "$cur"))
+ elif [[ $table == "-t broute" ]]; then
+ COMPREPLY=($(compgen -W 'ACCEPT DROP
+ $("$1" $table -L 2>/dev/null | \
+ command sed -n -e "s/BROUTING//" -e "$chain")' \
+ -- "$cur"))
+ fi
+ ;;
+ *)
+ if [[ $cur == -* ]]; then
+ COMPREPLY=($(compgen -W '--802_3-sap --802_3-type --among-dst
+ --among-dst-file --among-src --among-src-file --append
+ --arp-gratuitous --arp-htype --arp-ip-dst --arp-ip-src
+ --arp-mac-dst --arp-mac-src --arp-opcode --arp-ptype --arpreply-mac
+ --arpreply-target --atomic-commit --atomic-file --atomic-init
+ --atomic-save --change-counters --concurrent --delete
+ --delete-chain --destination --dnat-target --dst --flush --help
+ --in-if --in-interface --init-table --insert --ip6-destination
+ --ip6-destination-port --ip6-dport --ip6-dst --ip6-icmp-type
+ --ip6-prococol --ip6-proto --ip6-protocol --ip6-source
+ --ip6-source-port --ip6-sport --ip6-src --ip6-tclass
+ --ip-destination --ip-destination-port --ip-dport --ip-dst
+ --ip-proto --ip-protocol --ip-source --ip-source-port --ip-sport
+ --ip-src --ip-tos --jump --Lc --limit --limit-burst --list --Lmac2
+ --Ln --log --log-arp --logical-in --logical-out --log-ip --log-ip6
+ --log-level --log-prefix --Lx --mark --mark-and --mark-or
+ --mark-set --mark-target --mark-xor --modprobe --new-chain --nflog
+ --nflog-group --nflog-prefix --nflog-range --nflog-threshold
+ --out-if --out-interface --pkttype-type --policy --proto --protocol
+ --redirect-target --rename-chain --set-counter --snat-arp
+ --snat-target --source --src --stp-flags --stp-forward-delay
+ --stp-hello-time --stp-max-age --stp-msg-age --stp-port
+ --stp-root-addr --stp-root-cost --stp-root-prio --stp-sender-addr
+ --stp-sender-prio --stp-type --table --to-destination --to-dst
+ --to-source --to-src --ulog --ulog-cprange --ulog-nlgroup
+ --ulog-prefix --ulog-qthreshold --version --vlan-encap --vlan-id
+ --vlan-prio --zero' -- "$cur"))
+ fi
+ ;;
+ esac
+
+} &&
+ complete -F _ebtables ebtables
+
+# ex: filetype=sh