Accepting request 72294 from security:netfilter

- cleanup up initscript
  * don't use /var/lock/subsys
  * read /etc/sysconfig/ebtables for setting and restore state from
    /etc/ebtables where the script actually saved the state to.

OBS-URL: https://build.opensuse.org/request/show/72294
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/ebtables?expand=0&rev=15
This commit is contained in:
Sascha Peilicke 2011-06-01 07:32:35 +00:00 committed by Git OBS Bridge
commit b06740c209
3 changed files with 63 additions and 27 deletions

View File

@ -13,7 +13,7 @@ Index: ebtables.sysv
-# Check that networking is up.
-[ ${NETWORKING} = "no" ] && exit 0
+### BEGIN INIT INFO
+# Provides: eptables
+# Provides: ebtables
+# Required-Start: $remote_fs $network
+# Required-Stop: $remote_fs $network
+# Short-Description: Ethernet Bridge filter tables
@ -24,56 +24,82 @@ Index: ebtables.sysv
[ -x __EXEC_PATH__/ebtables ] || exit 1
[ -x __EXEC_PATH__/ebtables-save ] || exit 1
@@ -35,8 +38,8 @@ EBTABLES_SAVE_ON_STOP="no"
@@ -30,12 +33,15 @@ umask 0077
#default configuration
EBTABLES_TEXT_FORMAT="yes"
EBTABLES_BINARY_FORMAT="yes"
-EBTABLES_MODULES_UNLOAD="yes"
+EBTABLES_MODULES_UNLOAD="no"
EBTABLES_SAVE_ON_STOP="no"
EBTABLES_SAVE_ON_RESTART="no"
EBTABLES_SAVE_COUNTER="no"
-config=__SYSCONFIG__/$prog-config
-[ -f "$config" ] && . "$config"
+. /etc/rc.status
+rc_reset
+
+config=/etc/sysconfig/ebtables
[ -f "$config" ] && . "$config"
start() {
echo -n $"Starting $desc ($prog): "
@@ -49,10 +52,10 @@ start() {
@@ -45,16 +51,15 @@ start() {
__EXEC_PATH__/ebtables -t $table --atomic-file __SYSCONFIG__/ebtables.$table --atomic-commit || RETVAL=1
done
else
- __EXEC_PATH__/ebtables-restore < /etc/sysconfig/ebtables || RETVAL=1
+ __EXEC_PATH__/ebtables-restore < __SYSCONFIG__/ebtables || RETVAL=1
fi
if [ $RETVAL -eq 0 ]; then
- success "$prog startup"
+ rc_status -v
rm -f /var/lock/subsys/$prog
- rm -f /var/lock/subsys/$prog
+ touch /var/run/rcebtables
+ rc_failed 0
else
- failure "$prog startup"
+ rc_failed 3
fi
echo
- echo
}
@@ -70,10 +73,10 @@ stop() {
stop() {
@@ -70,17 +75,18 @@ stop() {
fi
if [ $RETVAL -eq 0 ]; then
- success "$prog shutdown"
+ rc_status -v
rm -f /var/lock/subsys/$prog
- rm -f /var/lock/subsys/$prog
+ rm -f /var/run/rcebtables
+ rc_failed 0
else
- failure "$prog shutdown"
+ rc_failed 3
fi
echo
- echo
}
@@ -107,9 +110,9 @@ save() {
restart() {
stop
+ rc_status -v
start
+ rc_status -v
}
save() {
@@ -106,40 +112,42 @@ save() {
done
fi
if [ $RETVAL -eq 0 ]; then
- if [ $RETVAL -eq 0 ]; then
- success "$prog saved"
+ rc_status -v
else
- else
- failure "$prog saved"
+ if [ $RETVAL -ne 0 ]; then
+ rc_failed 3
fi
echo
- echo
}
@@ -117,29 +120,34 @@ save() {
case "$1" in
start)
start
@ -87,16 +113,18 @@ Index: ebtables.sysv
restart|reload)
[ "$EBTABLES_SAVE_ON_RESTART" = "yes" ] && save
restart
+ rc_status -v
;;
condrestart)
[ -e /var/lock/subsys/$prog ] && restart
- condrestart)
- [ -e /var/lock/subsys/$prog ] && restart
- RETVAL=$?
+ rc_status
+ try-restart|condrestart)
+ if [ -e /var/run/rcebtables ]; then
+ restart
+ fi
;;
save)
save
+ rc_status
+ rc_status -v
;;
status)
__EXEC_PATH__/ebtables-save
@ -104,8 +132,9 @@ Index: ebtables.sysv
+ rc_status -v
;;
*)
echo $"Usage $0 {start|stop|restart|condrestart|save|status}"
- echo $"Usage $0 {start|stop|restart|condrestart|save|status}"
- RETVAL=1
+ echo $"Usage $0 {start|stop|restart|try-restart|save|status}"
+ exit 1
+ ;;
esac

View File

@ -1,3 +1,11 @@
-------------------------------------------------------------------
Tue May 31 12:34:34 UTC 2011 - lnussel@suse.de
- cleanup up initscript
* don't use /var/lock/subsys
* read /etc/sysconfig/ebtables for setting and restore state from
/etc/ebtables where the script actually saved the state to.
-------------------------------------------------------------------
Thu Mar 18 07:09:55 UTC 2010 - coolo@novell.com

View File

@ -85,9 +85,10 @@ make \
SYSCONFIGDIR=%{_sysconfdir} \
install
ln -sf %{_sysconfdir}/init.d/ebtables $RPM_BUILD_ROOT%{_sbindir}/rcebtables
# not used
rm -f $RPM_BUILD_ROOT/etc/ebtables-config
%post
/sbin/ldconfig
%fillup_and_insserv ebtables
%preun
@ -96,7 +97,6 @@ ln -sf %{_sysconfdir}/init.d/ebtables $RPM_BUILD_ROOT%{_sbindir}/rcebtables
%postun
%restart_on_update ebtables
%insserv_cleanup
/sbin/ldconfig
%clean
rm -rf $RPM_BUILD_ROOT
@ -104,7 +104,6 @@ rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root)
%doc %{_mandir}/man8/ebtables.8*
%config(noreplace) %{_sysconfdir}/ebtables-config
%config(noreplace) %{_sysconfdir}/ethertypes
%{_sysconfdir}/init.d/ebtables
%dir %{_libdir}/%{name}