diff options
author | Stefan Tomanek <stefan.tomanek@wertarbyte.de> | 2016-07-25 23:15:45 +0200 |
---|---|---|
committer | Stefan Tomanek <stefan.tomanek@wertarbyte.de> | 2016-07-25 23:32:46 +0200 |
commit | e9e4ca02630da1bf6313f1ad41f0ec1918c36dac (patch) | |
tree | 08ae9ff51e882868c9d593818bfdc65e67596948 | |
parent | 9d934704a5dbc365f40b04d55aef3f986de017c7 (diff) |
add preference switching options to ipv6pref.sh
-rw-r--r-- | bash_completion/ipv6pref | 13 | ||||
-rw-r--r-- | ipv6pref.pod | 19 | ||||
-rwxr-xr-x | scripts/ipv6pref.sh | 17 |
3 files changed, 45 insertions, 4 deletions
diff --git a/bash_completion/ipv6pref b/bash_completion/ipv6pref index 0840faf..e0c8eef 100644 --- a/bash_completion/ipv6pref +++ b/bash_completion/ipv6pref @@ -1,9 +1,18 @@ # bash completion for ipv6pref(1) _ipv6pref() { + local cur prev words cword _init_completion || return for (( i=1; i <= COMP_CWORD; i++ )); do - _command_offset $i + if [[ ${COMP_WORDS[i]} != -* ]]; then + _command_offset $i + return + fi done -} && complete -F _ipv6pref ipv6pref v6pub v6tmp + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-p -t' -- "$cur" ) ) + return + fi + +} && complete -F _ipv6pref ipv6pref.sh ipv6pref v6pub v6tmp diff --git a/ipv6pref.pod b/ipv6pref.pod index 7ca7240..38e0533 100644 --- a/ipv6pref.pod +++ b/ipv6pref.pod @@ -6,7 +6,7 @@ ipv6pref -- set IPv6 address selection preference =head1 SYNOPSIS -B<ipv6pref> F<< <cmd> >> +B<ipv6pref> [B<-p> | B<-t>] F<< <cmd> >> B<v6pub> F<< <cmd> >> @@ -24,6 +24,23 @@ IPv6 Privacy Extensions. =back +=head1 OPTIONS + +=over + +=item B<-p> + +Instruct the called program to use the public IPv6 address for outgoing +connections. This is the default if the wrapper is called by the name B<v6pub>. + +=item B<-t> + +Instruct the called program to use the temporary, randomly generated IPv6 +addresses for outgoing connections. This is the default if the wrapper is +called by the name B<v6tmp>. + +=back + =head1 AUTHOR Stefan Tomanek E<lt>stefan.tomanek@wertarbyte.deE<gt> diff --git a/scripts/ipv6pref.sh b/scripts/ipv6pref.sh index a7e583b..3d0af01 100755 --- a/scripts/ipv6pref.sh +++ b/scripts/ipv6pref.sh @@ -39,17 +39,32 @@ if ! [ "${IPV6PREF_WAS_HERE:-}" ]; then export LD_PRELOAD="${LIB} ${LD_PRELOAD}" fi + # check wrapper name WRAPPER="$(basename $0)" case "$WRAPPER" in v6pub) - dbg "Using public address" + dbg "Using public address by default" export IPV6PREF_ADDR="pub" ;; v6tmp) + dbg "Using temporary address by default" + export IPV6PREF_ADDR="tmp" + ;; + esac + # check for argument + case "${1:-}" in + "-p") + dbg "Using public address" + export IPV6PREF_ADDR="pub" + shift + ;; + "-t") dbg "Using temporary address" export IPV6PREF_ADDR="tmp" + shift ;; esac + fi IPV6PREF_WAS_HERE=1 exec "$@" |