?rev1line? |
?rev2line? |
|
#!/bin/sh
|
|
#
|
|
# Modified in order to implement the NEMO Basic Support Protocol
|
|
# Nicolas Kerneis
|
|
# Laurent Monminoux
|
|
#
|
|
# Load MIPL Mobile IPv6 module
|
|
#
|
|
# chkconfig: 345 75 05
|
|
# description: Automatically loads MIPL Mobile IPv6 kernel module and
|
|
# configures it. See http://www.mipl.mediapoli.com/ for more information.
|
|
# config: /etc/sysconfig/network-mip6.conf
|
|
#
|
|
# Generated automatically from mobile-ip6.in by configure.
|
|
|
|
MIPV6_BASE_MODULE=mip6_base
|
|
MIPV6_MN_MODULE=mip6_mn
|
|
MIPV6_HA_MODULE=mip6_ha
|
|
MIPV6_MODULE=
|
|
|
|
prefix=
|
|
exec_prefix=${prefix}
|
|
initdir=/etc/rc.d/init.d
|
|
sysconfdir=${prefix}/etc
|
|
|
|
CONFIG_FILE=/etc/sysconfig/network-mip6.conf
|
|
MIPDIAG=${exec_prefix}/sbin/mipdiag
|
|
SUBSYS=$1
|
|
LOCKDIR=/var/lock/subsys
|
|
|
|
MODPROBE=${exec_prefix}/sbin/modprobe
|
|
LSMOD=${exec_prefix}/sbin/lsmod
|
|
|
|
# Test if 'functions' exists. If not, define our own 'action'
|
|
if test -x /etc/rc.d/init.d/functions ; then
|
|
. /etc/rc.d/init.d/functions
|
|
elif test -x /etc/rc.config ; then
|
|
. /etc/rc.config
|
|
else
|
|
action() {
|
|
msg=$1
|
|
shift
|
|
eval "$*" >/dev/null 2>&1
|
|
ret=$?
|
|
if test $ret = 0 -a "x$*" != "x" ; then
|
|
msg=$msg" OK"
|
|
else
|
|
msg=$msg" Failed"
|
|
fi
|
|
logger $msg
|
|
echo $msg
|
|
}
|
|
fi
|
|
|
|
if [ -r $CONFIG_FILE ] ; then
|
|
. $CONFIG_FILE
|
|
else
|
|
echo "Cannot read configuration file: $CONFIG_FILE"
|
|
exit 1
|
|
fi
|
|
|
|
for file in $MIPDIAG $MODPROBE $LSMOD ; do
|
|
if [ ! -x $file ] ; then
|
|
echo "Cannot execute: $file"
|
|
exit 1
|
|
fi
|
|
done
|
|
|
|
if [ "$FUNCTIONALITY" = "mn" ] ; then
|
|
MIPV6_MODULE=$MIPV6_MN_MODULE
|
|
elif [ "$FUNCTIONALITY" = "ha" ] ; then
|
|
MIPV6_MODULE=$MIPV6_HA_MODULE
|
|
else
|
|
MIPV6_MODULE=$MIPV6_BASE_MODULE
|
|
fi
|
|
|
|
if [ -z "$HOMEADDRESS" -a "$FUNCTIONALITY" = "mn" ] ; then
|
|
echo "Home address not set for mobile node"
|
|
exit 1
|
|
fi
|
|
|
|
case "$1" in
|
|
start)
|
|
$LSMOD | grep $MIPV6_MODULE &>/dev/null && \
|
|
echo "$MIPV6_MODULE already installed" && exit 1
|
|
|
|
INSMOD_ARGS=
|
|
# NEMO implementation
|
|
INSMOD_MR_ARGS=
|
|
INSMOD_HA_ARGS=
|
|
|
|
if [ -n "$DEBUGLEVEL" ] ; then
|
|
INSMOD_ARGS="$INSMOD_ARGS mipv6_debug=$DEBUGLEVEL"
|
|
fi
|
|
|
|
# NEMO implementation
|
|
if [ "$MR" = "yes" ] ; then
|
|
INSMOD_MR_ARGS="$INSMOD_MR_ARGS mipv6_is_MR=1"
|
|
else
|
|
INSMOD_MR_ARGS="$INSMOD_MR_ARGS mipv6_is_MR=0"
|
|
fi
|
|
# NEMO implementation
|
|
if [ "$NEMO_HA_CAPABLE" = "yes" ] ; then
|
|
INSMOD_HA_ARGS="$INSMOD_HA_ARGS nemo_ha_capability=1"
|
|
else
|
|
INSMOD_HA_ARGS="$INSMOD_HA_ARGS nemo_ha_capability=0"
|
|
fi
|
|
|
|
$MODPROBE $MIPV6_BASE_MODULE $INSMOD_ARGS &> /dev/null
|
|
status=$?
|
|
|
|
# NEMO implementation
|
|
if [ "$FUNCTIONALITY" = "ha" ] ; then
|
|
$MODPROBE $MIPV6_MODULE $INSMOD_HA_ARGS &> /dev/null
|
|
fi
|
|
# NEMO implementation
|
|
if [ "$FUNCTIONALITY" = "mn" ] ; then
|
|
$MODPROBE $MIPV6_MODULE $INSMOD_MR_ARGS &> /dev/null
|
|
fi
|
|
|
|
action "Starting Mobile IPv6:" [ $status -eq 0 ] || exit 1
|
|
|
|
touch $LOCKDIR/mobile-ip6
|
|
|
|
# Temporary kludge to control get the new sysctls working.
|
|
# Should probably be integrated into mipdiag at some time.
|
|
|
|
if [ "$FUNCTIONALITY" = "ha" ] ; then
|
|
if [ -n "$MIN_TUNNEL_NR" ] ; then
|
|
echo $MIN_TUNNEL_NR > /proc/sys/net/ipv6/mobility/min_tnls
|
|
fi
|
|
|
|
if [ -n "$MAX_TUNNEL_NR" ] ; then
|
|
echo $MAX_TUNNEL_NR > /proc/sys/net/ipv6/mobility/max_tnls
|
|
fi
|
|
fi
|
|
|
|
if [ "$FUNCTIONALITY" = "mn" ] ; then
|
|
[ -n "$HOMEADDRESS" ] && \
|
|
$MIPDIAG -i $HOMEDEV -h $HOMEADDRESS -H$HOMEAGENT
|
|
fi
|
|
|
|
if [ "$FUNCTIONALITY" = "ha" -a -n "$TUNNEL_SITELOCAL" ] ; then
|
|
$MIPDIAG -t$TUNNEL_SITELOCAL
|
|
fi
|
|
|
|
if [ "$FUNCTIONALITY" = "ha" ] ; then
|
|
echo 1 > /proc/sys/net/ipv6/conf/all/forwarding
|
|
fi
|
|
;;
|
|
|
|
stop)
|
|
action "Stopping Mobile IPv6:" [ -f $LOCKDIR/mobile-ip6 ] || exit 1
|
|
|
|
$MODPROBE -r $MIPV6_MODULE
|
|
|
|
rm -f $LOCKDIR/mobile-ip6
|
|
exit $?
|
|
;;
|
|
|
|
restart)
|
|
$0 stop
|
|
$0 start
|
|
exit $?
|
|
;;
|
|
|
|
status)
|
|
$LSMOD | grep $MIPV6_MODULE > /dev/null
|
|
if [ $? -eq 0 ]; then
|
|
echo "$MIPV6_MODULE module is installed..."
|
|
exit 0
|
|
fi
|
|
# See if lock in $LOCKDIR exists
|
|
if [ -f $LOCKDIR/mobile-ip6 ]; then
|
|
echo "$MIPV6_MODULE module not installed but subsys locked"
|
|
exit 2
|
|
fi
|
|
|
|
echo "$MIPV6_MODULE module is not installed"
|
|
exit 3
|
|
;;
|
|
|
|
*)
|
|
echo "Usage mobile-ip6 {start|stop|status|restart}"
|
|
exit 1
|
|
;;
|
|
esac
|