## -*- 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/ipcop/ 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"
}

check_file() {
    test -r "$2" || {
        echo "Can not find file $2 referenced by AddressTable object $1"
        exit 1
    }
}

getInterfaceVarName() {
    echo $1 | sed 's/\./_/'
}

# function getinterfaces is used to process wildcard interfaces
getinterfaces() {
    NAME=$1
    $IP link show | grep ": $NAME" | while read L; do
        OIFS=$IFS
        IFS=" :"
        set $L
        IFS=$OIFS
        echo $2
    done
}

