blob: 0d97704b9911a5fa2c1f39fe9ff92940c10f951c [file] [log] [blame]
# Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
# Set the ARP gateway.
FLAGS_HELP="Usage:
$(basename $0)
or
$(basename $0) [true | false]
"
FLIMFLAM=org.chromium.flimflam
IMANAGER=$FLIMFLAM.Manager
usage() {
echo $*
echo
echo $FLAGS_HELP
exit 1
}
dbus () {
local obj=$1
local meth=$2
shift 2
dbus-send --system --print-reply --fixed --dest=$FLIMFLAM "$obj" "$meth" "$@"
}
get_manager () {
dbus / $IMANAGER.GetProperties | sed -n "/$1/s/.* //p"
}
display_arpgw () {
local arpgw=$(get_manager ArpGateway)
if [ -n "$arpgw" ] ; then
echo "Current Gateway ARP setting: " $arpgw
exit 0
fi
echo "This Flimflam instance does not support ArpGateway"
exit 0
}
if [ $# -lt 1 ]; then
display_arpgw
fi
set_arpgw=$1
if [ $set_arpgw != false -a $set_arpgw != true ] ; then
usage "Argument must be 'true' or 'false'"
fi
dbus / $IMANAGER.SetProperty string:"ArpGateway" variant:boolean:$set_arpgw