diff -up openslp-2.0.0/etc/slpd.all_init.orig openslp-2.0.0/etc/slpd.all_init --- openslp-2.0.0/etc/slpd.all_init.orig 2012-11-28 18:07:04.000000000 +0100 +++ openslp-2.0.0/etc/slpd.all_init 2017-10-04 12:50:36.672953246 +0200 @@ -1,28 +1,5 @@ #!/bin/bash -# -# /etc/rc.d/init.d/slpd -# -# slpd Start/Stop the OpenSLP SA daemon (slpd). -# -# chkconfig: 345 13 87 -# description: OpenSLP daemon for the Service Location Protocol -# processname: slpd - -# Author: Miquel van Smoorenburg, -# Modified for RHS Linux by Damien Neil -# Modified for COL by Raymund Will, -# Modified for OpenSLP by Matt Peterson -# Modified to be distribution agnostic by Bart Whiteley - -#//////////////////////////////////////////////////# -# Does nothing if a route exists that supports # -# multicast traffic. If no routes supporting # -# multicast traffic exists, the function tries to # -# add one. A 0 is returned on success and a 1 # -# on failure. One parameter must be passed in. # -# This variable determins verbosity. If parameter # -# is non-zero debugging will appear # -#//////////////////////////////////////////////////# + multicast_route_set() { PING_OPTIONS_1='-c1 -w1' @@ -36,8 +13,8 @@ multicast_route_set() MSG_FAILED_TO_ADD=' FAILED - Route NOT Added.' MSG_SUCCES_ON_ADD=' SUCCESS - Route Added.' - CMD_GET_INTERFACE="netstat -i | awk 'BEGIN{}(NR>2)&&(!/^lo*/){print \$1}'" - CMD_ADD_ROUTE="route add -net 224.0.0.0 netmask 240.0.0.0" + CMD_GET_INTERFACE="ip -o link show | awk 'BEGIN{FS=\": \"}!/^:digit:+: lo:.*/{print \$2}'" + CMD_ADD_ROUTE="ip route add 224.0.0.0/4 dev" err_unreachable_found=`ping $PING_OPTIONS_1 $MULTICAST_ADDRESS 2>&1 1>/dev/null` @@ -91,94 +68,11 @@ multicast_route_set() return $retval } -NAME=slpd -DAEMON=/usr/sbin/$NAME -SUSE=0 - -# Change to root -OLDDIR=`pwd` -cd / - -# Source function library. -if [ -f /etc/rc.d/init.d/functions ]; then - . /etc/rc.d/init.d/functions -else - SUSE=1 -fi - -test -x $DAEMON || exit 0 - -if [ ! "$SVIlock" = "" ]; then - unset LOCK -else - LOCK=/var/lock/subsys/slpd +multicast_route_set 1 +multicast_enabled=$? +if [ "$multicast_enabled" != "0" ] ; then + echo "Failure: No Route Available for Multicast Traffic" + exit 1 fi -RETVAL=0 - -# -# See how we were called. -# -case "$1" in - start) - # Check if atd is already running - # RH style - if [ $SUSE -eq 0 ] && [ ! "$LOCK" = "" ] && [ -f $LOCK ]; then - exit 0 - fi - # Caldera Style - if [ ! "$SVIlock" = "" ] && [ -f $SVIlock ]; then - exit 0 - fi - echo -n 'Starting slpd: ' - - multicast_route_set 1 - multicast_enabled=$? - if [ "$multicast_enabled" != "0" ] ; then - echo "Failure: No Route Available for Multicast Traffic" - exit 1 - fi - if [ $SUSE -eq 0 ]; then - if [ -x /sbin/ssd ]; then - ssd -S -n $NAME -x $DAEMON -- $OPTIONS - [ ! "$SVIlock" = "" ] && touch $SVIlock - else - daemon $DAEMON - RETVAL=$? - fi - else - startproc $DAEMON $OPTIONS - fi - [ $SUSE -eq 0 ] && [ ! "$LOCK" = "" ] && [ $RETVAL -eq 0 ] && touch $LOCK - echo - ;; - stop) - echo -n 'Stopping slpd: ' - - if [ -x /sbin/ssd ]; then - ssd -K -p /var/run/$NAME.pid -n $NAME - [ ! "$SVIlock" = "" ] && rm -f $SVIlock - else - killproc $DAEMON - RETVAL=$? - fi - [ ! "$LOCK" = "" ] && [ $RETVAL -eq 0 ] && rm -f $LOCK - echo - ;; - reload|restart) - cd $OLDDIR - $0 stop - $0 start - cd / - RETVAL=$? - ;; - status) - status /usr/sbin/slpd - RETVAL=$? - ;; - *) - echo "Usage: /etc/rc.d/init.d/slpd {start|stop|restart|reload|status}" - exit 1 -esac - -exit $RETVAL +exit 0