#!/bin/sh PATH=/sbin:/usr/sbin:/bin:/usr/bin cd /etc/sysconfig/network-scripts . network-functions CONFIG=$1 [ -f "$CONFIG" ] || CONFIG=ifcfg-$1 source_config file=/var/run/$DEVICE.pid if [ -f $file ]; then PID=`cat $file` if [ -n "$PID" -a -d /proc/$PID ]; then echo "device ${DEVICE} is already up using ciped-cb pid ${PID}" exit 1 fi fi NAME=$(basename `echo $CONFIG | sed 's/ifcfg-//g'`) if [ "$2" = "boot" -a "${ONBOOT}" = "no" ]; then exit fi [ -x /usr/sbin/ciped-cb ] || { echo "/usr/sbin/ciped-cb does not exist or is not executable" echo "ifup-cipcb for $DEVICE exiting" logger -p daemon.info -t ifup-cipcb \ "/usr/sbin/ciped-cb does not exist or is not executable for $DEVICE" exit 1 } if [ ! -f /etc/cipe/options.$NAME ]; then echo "/etc/cipe/options.$NAME missing for device $DEVICE" exit 1 fi if [ -x /sbin/ifup-pre-local ]; then /sbin/ifup-pre-local ${DEVICE} fi cipeconfig=/etc/cipe/options.$NAME if [ -z "$IPADDR" ] && ! grep "^ipaddr[ ]" $cipeconfig > /dev/null; then echo "Missing required ipaddr setting" exit 1 fi if [ -z "$PTPADDR" ] && ! grep "^ptpaddr[ ]" $cipeconfig > /dev/null; then echo "Missing required ptpaddr setting" exit 1 fi if [ -z "$PEER" ] && ! grep "^peer[ ]" $cipeconfig > /dev/null; then echo "Missing required peer setting" exit 1 fi if ! grep "^key[ ]" $cipeconfig > /dev/null; then echo "Missing required cipe key in $cipeconfig" exit 1 fi if [ -z "$ME" ] && ! grep "^me[ ]" $cipeconfig > /dev/null; then ME=0.0.0.0 # ME=$(/sbin/findroute `echo ${PEER} | sed 's/:.*//'` 2> /dev/null) if [ -z "$ME" ]; then echo "Unable to find a suitable route to peer ${PEER}" exit 1 fi fi if [ -n "$MYPORT" ]; then ME="${ME}:${MYPORT}" fi if [ -n "$ME" ] ; then CIPE_OPTS="${CIPE_OPTS} me=${ME}" fi if [ -n "$PEER" ] ; then CIPE_OPTS="${CIPE_OPTS} peer=${PEER}" fi if [ -n "$IPADDR" ] ; then CIPE_OPTS="${CIPE_OPTS} ipaddr=${IPADDR}" fi if [ -n "$PTPADDR" ] ; then CIPE_OPTS="${CIPE_OPTS} ptpaddr=${PTPADDR}" fi if [ -n "$DEVICE" ] ; then CIPE_OPTS="${CIPE_OPTS} device=${DEVICE}" fi (logger -p daemon.info -t ifup-cipcb "cipcb started for $DEVICE" &)& HOTPLUG=`cat /proc/sys/kernel/hotplug` echo "/bin/true" > /proc/sys/kernel/hotplug /usr/sbin/ciped-cb ${CIPE_OPTS} -o /etc/cipe/options.$NAME echo $HOTPLUG > /proc/sys/kernel/hotplug exec /etc/sysconfig/network-scripts/ifup-post ${CONFIG} ${2}