## -*- mode: shell-script; -*- 
##
## To be able to make changes to the part of configuration created
## from this configlet you need to copy this file to the directory
## fwbuilder/configlets/bsd/ in your home directory and modify it.
## Double "##" comments are removed during processing but single "#"
## comments are be retained and appear in the generated script. Empty
## lines are removed as well.  
##
## Configlets support simple macro language with these constructs:
## {{$var}} is variable expansion
## {{if var}} is conditional operator.

log() {
    echo "$1"
    test -x "$LOGGER" && $LOGGER -p info "$1"
}

add_addr() {
  addr=$1
  nm=$2
  dev=$3
  ( ifconfig $dev | egrep -q "inet +${addr} " ) || 
    { 
      echo "$dev: $addr/$nm"
      ifconfig $dev inet $addr netmask $nm alias
    } 
}

{{if dyn_addr}}
getaddr() {
  intf=$1
  varname=$2
  L=`ifconfig $1 | grep 'inet '`
  if [ -z "$L" ]; then
      L="inet 0.0.0.0/32"
  fi
  set $L
  a=$2
  eval "$varname=$a"
}

{{$get_dyn_addr_commands}}

{{endif}}
