#!/bin/sh

###############
# global vars #
###############

# load common functions
. /usr/share/natfree-common/natfree-common

# get default route iface
GW_IFACE="$(get_gw_iface)"

#############
# functions #
#############
main(){
	# main
	######
	# check environment
	[ "$GW_IFACE" ] || die "Unable to find network gateway iface"
	[ "$IFACE" ] || die "Undefined 'IFACE' environment var. May be not running under networkd-dispatcher?"

	# correct interface up?
	[ "$GW_IFACE" = "$IFACE" ] || exit 0

	natfree-client -i "$GW_IFACE" update
}

################
# main program #
################
main "$@"
exit 0

