#!/bin/bash -e
#
# pwanbirdc - Bird client for private WAN
#

if [ ! -z "$1" ] ; then
    if [ "$1" != "-" ] ; then
        space="$1"
    fi
    shift
fi

# For private WAN routers only, other nodes use the default bird socket
if [ ! -z "$space" ] ; then
    socket="-s /var/run/bonding/pwan-bird-$space.sock"
elif [ -e /var/run/bonding/pwan-outside-bird.sock ]; then
    socket="-s /var/run/bonding/pwan-outside-bird.sock"
fi

/usr/sbin/birdc $socket $@
