Verify seqno early in sptps_verify_datagram().
[tinc] / bash_completion.d / tinc
1 _tinc() {
2         local cur prev opts confvars commands nets
3         COMPREPLY=()
4         cur="${COMP_WORDS[COMP_CWORD]}"
5         prev="${COMP_WORDS[COMP_CWORD-1]}"
6         opts="-c -d -D -K -n -o -L -R -U --config --no-detach --debug --net --option --mlock --logfile --pidfile --chroot --user --help --version"
7         confvars="Address AddressFamily BindToAddress BindToInterface Broadcast Cipher ClampMSS Compression ConnectTo DecrementTTL Device DeviceType Digest DirectOnly Ed25519PrivateKeyFile Ed25519PublicKey Ed25519PublicKeyFile ExperimentalProtocol Forwarding GraphDumpFile Hostnames IffOneQueue IndirectData Interface KeyExpire ListenAddress LocalDiscovery MACExpire MACLength MaxOutputBufferSize MaxTimeout Mode Name PMTU PMTUDiscovery PingInterval PingTimeout Port PriorityInheritance PrivateKeyFile ProcessPriority Proxy PublicKeyFile ReplayWindow StrictSubnets Subnet TCPOnly TunnelServer UDPRcvBuf UDPSndBuf VDEGroup VDEPort Weight"
8         commands="add connect debug del disconnect dump edit export export-all generate-ed25519-keys generate-keys generate-rsa-keys get help import info init invite join log network pcap pid purge reload restart retry set start stop top version"
9
10         case ${prev} in
11                 -c|--config)
12                 compopt -o dirnames 2>/dev/null
13                 return 0
14                 ;;
15                 -n|--net)
16                 nets=""
17                 pushd /etc/tinc >/dev/null 2>/dev/null
18                 for dir in *; do
19                         if [[ -f "$dir/tinc.conf" ]]; then
20                                 nets="$nets $dir"
21                         fi
22                 done
23                 popd >/dev/null 2>/dev/null
24                 COMPREPLY=( $(compgen -W "${nets}" -- ${cur}) )
25                 return 0
26                 ;;
27                 -o|--option)
28                 compopt -o nospace
29                 COMPREPLY=( $(compgen -W "${confvars}" -- ${cur}) )
30                 if [[ ${#COMPREPLY[*]} == 1 ]] ; then
31                         COMPREPLY=$COMPREPLY=
32                 fi
33                 return 0
34                 ;;
35                 -U|--user)
36                 COMPREPLY=( $(compgen -u ${cur}) )
37                 return 0
38                 ;;
39                 --logfile|--pidfile)
40                 compopt -o filenames 2>/dev/null
41                 COMPREPLY=( $(compgen -f ${cur}) )
42                 return 0
43         esac
44         if [[ ${cur} == -* ]] ; then
45                 COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
46                 return 0
47         fi
48         if [[ $1 == "d" ]]; then
49                 if [[ -z ${cur} ]] ; then 
50                         COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
51                 fi
52                 return 0
53         fi
54         COMPREPLY=( $(compgen -W "${commands}" -- ${cur}) )
55         case $prev in
56                 get|set|add|del)
57                 COMPREPLY=( $(compgen -W "${confvars}" -- ${cur}) )
58                 return 0
59                 ;;
60                 dump|reachable)
61                 COMPREPLY=( $(compgen -W "reachable nodes edges subnets connections graph" -- ${cur}) )
62                 return 0
63                 ;;
64                 network)
65                 nets=""
66                 pushd /etc/tinc >/dev/null 2>/dev/null
67                 for dir in *; do
68                         if [[ -f "$dir/tinc.conf" ]]; then
69                                 nets="$nets $dir"
70                         fi
71                 done
72                 popd >/dev/null 2>/dev/null
73                 COMPREPLY=( $(compgen -W "${nets}" -- ${cur}) )
74                 return 0
75                 ;;
76         esac
77         if [[ -z ${cur} ]] ; then 
78                 COMPREPLY=( $(compgen -W "${opts} ${commands}" -- ${cur}) )
79         fi
80         return 0
81 }
82
83 _tincd() {
84         _tinc d;
85 }
86
87 _tincctl() {
88         _tinc ctl;
89 }
90
91 complete -F _tincd tincd
92 complete -F _tincctl tinc