Репозиторий Sisyphus
Последнее обновление: 1 октября 2023 | Пакетов: 18631 | Посещений: 37041606
en ru br
Репозитории ALT

Группа :: Безопасность/Сети
Пакет: shapercontrol

 Главная   Изменения   Спек   Патчи   Sources   Загрузить   Gear   Bugs and FR  Repocop 

Патч: shapercontrol-1.5.7-alt2.patch
Скачать


 Makefile |   4 +--
 sc       |  10 +++---
 sc.init  | 106 +++++++++++++++++++++++++++++++++++++--------------------------
 3 files changed, 69 insertions(+), 51 deletions(-)
diff --git a/Makefile b/Makefile
index c7ea51e..a169f5c 100644
--- a/Makefile
+++ b/Makefile
@@ -31,8 +31,8 @@ help:
 	 echo "  uninstall  uninstall program"
 
 install: $(PROG) $(PROG).init $(PROG).conf.5 $(PROG).8 $(PROG).conf
-	install -D -m 755 $(PROG) $(DESTDIR)$(SBINDIR)
-	install -D -m 644 $(PROG).8 $(DESTDIR)$(MANDIR)/man8/$(PROG).8
+	install -D -m 755 $(PROG) $(DESTDIR)$(SBINDIR)/shapercontrol
+	install -D -m 644 $(PROG).8 $(DESTDIR)$(MANDIR)/man8/shapercontrol.8
 	install -D -m 644 $(PROG).conf.5 $(DESTDIR)$(MANDIR)/man5/$(PROG).conf.5
 	install -D -m 755 $(PROG).init $(DESTDIR)$(INITDIR)/$(SERVICE)
 	install -D -m 644 $(PROG).conf $(DESTDIR)$(CONFDIR)/$(PROG).conf.default
diff --git a/sc b/sc
index 8975650..bb316a4 100755
--- a/sc
+++ b/sc
@@ -1144,7 +1144,7 @@ sub shaper_dev_init
 	if ($default_policy eq 'block' || $default_policy eq 'block-all') {
 		$TC->(
 			"filter add dev $dev parent 1:0 protocol ip pref $pref_default ".
-			'u32 match u32 0 0 at 0 police mtu 1 drop'
+			'u32 match u32 0 0 at 0 action drop'
 		);
 	}
 	if ($default_policy eq 'pass') {
@@ -1492,7 +1492,7 @@ sub policer_dev_init
 		$TC->(
 			"filter add dev $dev parent $ingress_cid: protocol ip ".
 			"pref $pref_default u32 match u32 0 0 at 0 ".
-			"police mtu 1 drop"
+			"action drop"
 		);
 	}
 	return $?;
@@ -2110,11 +2110,11 @@ __END__
 
 =head1 NAME
 
-B<sc> - administration tool for ISP traffic shaper
+B<shaperconrol> - administration tool for ISP traffic shaper
 
 =head1 SYNOPSIS
 
-B<sc> [options] B<command> [ip] [rate]
+B<shaperconrol> [options] B<command> [ip] [rate]
 
 =head1 DESCRIPTION
 
@@ -2512,7 +2512,7 @@ C<sc reset>
 
 =head1 CONFIGURATION
 
-By default B<sc> reads configuration from F</etc/sc/sc.conf> file and uses
+By default B<shaperconrol> reads configuration from F</etc/sc/sc.conf> file and uses
 SQLite database at F</etc/sc/sc.db>.
 See sc.conf(5) for details.
 
diff --git a/sc.init b/sc.init
index ea97111..df05a1c 100755
--- a/sc.init
+++ b/sc.init
@@ -1,4 +1,8 @@
 #!/bin/sh
+# chkconfig: - 15 85
+# description: starts the Shaper Control Tool
+# processname: /usr/sbin/shapercontrol
+# config: /etc/sysconfig/sc
 
 ### BEGIN INIT INFO
 # Provides:		sc
@@ -9,56 +13,70 @@
 # Short-Description:	Shaper Control Tool
 ### END INIT INFO
 
-set -e
+# /etc/init.d/shapercontrol: init script for Shaper Control Tool
 
-# /etc/init.d/sc: init script for Shaper Control Tool
+SC=shapercontrol
+. /etc/init.d/functions
 
-SC=/usr/local/sbin/sc
-test -x $SC || exit 0
+SourceIfNotEmpty /etc/sysconfig/sc
+LOCKFILE="/var/lock/subsys/$SC"
 
-if test -f /etc/default/sc; then
-    . /etc/default/sc
-fi
+RETVAL=0
 
-. /lib/lsb/init-functions
+start()
+{
+    action "Starting shaper" $SC $SC_OPTS load 2>/dev/null
+    RETVAL=$?
+    if [ $RETVAL = 0 ]; then
+	touch "$LOCKFILE"
+    else
+	rm -f "$LOCKFILE"
+    fi
 
-if [ -n "$2" ]; then
-    SC_OPTS="$SC_OPTS $2"
-fi
+    return $RETVAL
+}
 
-case "$1" in
-  start)
-	log_daemon_msg "Starting shaper" "sc"
-	if $SC $SC_OPTS load ; then
-	    log_end_msg 0
-	else
-	    log_end_msg 1
-	fi
-	;;
-
-  stop)
-	log_daemon_msg "Stopping shaper" "sc"
-	if $SC $SC_OPTS reset ; then
-	    log_end_msg 0
-	else
-	    log_end_msg 1
-	fi
-	;;
-
-  restart|reload|force-reload)
-	log_daemon_msg "Restarting shaper" "sc"
-	if $SC $SC_OPTS reload ; then
-	    log_end_msg 0
-	else
-	    log_end_msg 1
-	fi
-	;;
+stop()
+{
+    action "Stopping shaper" $SC $SC_OPTS reset 2>/dev/null
+    RETVAL=$?
+    rm -f $LOCKFILE
+    return $RETVAL
+}
 
-  status)
-	$SC $SC_OPTS status
-	;;
+reload()
+{
+    action "Reload shaper" $SC $SC_OPTS reload 2>/dev/null
+    RETVAL=$?
+    return $RETVAL
+}
 
-  *)
-	log_action_msg "Usage: /etc/init.d/sc {start|stop|reload|force-reload|restart|status}"
-	exit 1
+case "$1" in
+	start)
+		start
+		;;
+	save)
+		save
+		;;
+	status)
+		$SC status
+		RETVAL=$?
+		;;
+	stop)
+		stop
+		;;
+	restart|reload)
+		reload
+		;;
+	condrestart)
+		[ -e "$LOCKFILE" ] && start
+		;;
+	condstop)
+		[ -e "$LOCKFILE" ] && stop
+		;;
+	*)
+		msg_usage "${0##*/} {condrestart|panic|restart|save|start|status|stop}"
+		RETVAL=1
 esac
+
+exit $RETVAL
 
дизайн и разработка: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
текущий майнтейнер: Michael Shigorin