SHA256
1
0
forked from pool/dhcp

Accepting request 17525 from network

Copy from network/dhcp based on submit request 17525 from user mtomaschewski

OBS-URL: https://build.opensuse.org/request/show/17525
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/dhcp?expand=0&rev=25
This commit is contained in:
OBS User autobuild 2009-08-13 16:04:28 +00:00 committed by Git OBS Bridge
parent f52eac7d22
commit a6f45302c1
4 changed files with 152 additions and 1 deletions

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Wed Aug 12 10:38:26 CEST 2009 - mt@suse.de
- Added dhcpd-restart-hook if-up.d script that restarts dhcp server
while network restart when a virtual interfaces as bridge, bond
or vlan goes up again (bnc#517810).
------------------------------------------------------------------- -------------------------------------------------------------------
Wed Jul 29 14:05:41 CEST 2009 - mt@suse.de Wed Jul 29 14:05:41 CEST 2009 - mt@suse.de

View File

@ -31,7 +31,7 @@ License: BSD 3-clause (or similar)
Group: Productivity/Networking/Boot/Servers Group: Productivity/Networking/Boot/Servers
AutoReqProv: on AutoReqProv: on
Version: 3.1.2p1 Version: 3.1.2p1
Release: 1 Release: 2
Summary: Common Files Used by ISC DHCP Software Summary: Common Files Used by ISC DHCP Software
Url: http://www.isc.org/isc/dhcp.html Url: http://www.isc.org/isc/dhcp.html
Source0: http://ftp.isc.org/isc/dhcp/dhcp-%{version}.tar.gz Source0: http://ftp.isc.org/isc/dhcp/dhcp-%{version}.tar.gz
@ -56,6 +56,7 @@ Source40: http://www3.baylor.edu/~Jeff_Wilson/GiveAway/leases.awk
Source41: http://www.suse.de/~poeml/dnscompr.py Source41: http://www.suse.de/~poeml/dnscompr.py
Source42: dhcpd.xml Source42: dhcpd.xml
Source43: SuSEfirewall2.dhcp-server Source43: SuSEfirewall2.dhcp-server
Source44: if-up.d.dhcpd-restart-hook
Patch0: dhcp-3.1.1-paths.dif Patch0: dhcp-3.1.1-paths.dif
## chroot patch by Ari Edelkind (see readme) ## chroot patch by Ari Edelkind (see readme)
## and patch supplied by <thomas@suse.de> ## and patch supplied by <thomas@suse.de>
@ -305,6 +306,12 @@ find $RPM_BUILD_ROOT/%{_mandir} -type f | xargs chmod 644
install -m 644 $RPM_SOURCE_DIR/dhcpd.xml $RPM_BUILD_ROOT/%{omc_svcdir}/ install -m 644 $RPM_SOURCE_DIR/dhcpd.xml $RPM_BUILD_ROOT/%{omc_svcdir}/
install -m 644 $RPM_SOURCE_DIR/SuSEfirewall2.dhcp-server \ install -m 644 $RPM_SOURCE_DIR/SuSEfirewall2.dhcp-server \
$RPM_BUILD_ROOT/%{susefw2dir}/dhcp-server $RPM_BUILD_ROOT/%{susefw2dir}/dhcp-server
install -m 755 -d $RPM_BUILD_ROOT/etc/sysconfig/network/if-up.d
install -m 755 -d $RPM_BUILD_ROOT/etc/sysconfig/network/scripts
install -m 755 $RPM_SOURCE_DIR/if-up.d.dhcpd-restart-hook \
$RPM_BUILD_ROOT/etc/sysconfig/network/scripts/dhcpd-restart-hook
ln -sf ../scripts/dhcpd-restart-hook \
$RPM_BUILD_ROOT/etc/sysconfig/network/if-up.d/60-dhcpd-restart-hook
%pre %pre
# In the past, the name of the source package was "dhcp" but the subpackage # In the past, the name of the source package was "dhcp" but the subpackage
@ -447,6 +454,8 @@ if ! test -f /.buildenv; then rm -rf $RPM_BUILD_ROOT; fi
/var/adm/fillup-templates/sysconfig.syslog-dhcpd /var/adm/fillup-templates/sysconfig.syslog-dhcpd
%dir /var/lib/dhcp/%_lib %dir /var/lib/dhcp/%_lib
%{omc_svcdir}/dhcpd.xml %{omc_svcdir}/dhcpd.xml
/etc/sysconfig/network/scripts/dhcpd-restart-hook
/etc/sysconfig/network/if-up.d/60-dhcpd-restart-hook
%files client %files client
%defattr(-,root,root) %defattr(-,root,root)

113
if-up.d.dhcpd-restart-hook Normal file
View File

@ -0,0 +1,113 @@
#! /bin/bash
#
# dhcpd-restart-hook - script to restart dhcpd on virtual interfaces
#
# Copyright (C) 2009 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# Author(s): Marius Tomaschewski <mt@suse.de>, 2009
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# version 2 as published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# Please send feedback via http://www.suse.de/feedback
#
set -e
unset ${!LC_*} LANUGUAGE
export LANG=POSIX
export PATH=/sbin:/usr/sbin:/usr/bin:/bin
SCRIPTNAME=${0##*/}
usage () {
echo "usage: $SCRIPTNAME [<config>] <interface> [-o <options>]"
echo ""
echo "Any options are ignored"
exit $R_USAGE
}
R_INTERNAL=1 # internal error, e.g. no config or missing scripts
cd /etc/sysconfig/network || exit $R_INTERNAL
case $1 in ""|-h|*help*) usage ;; esac
INTERFACE="$1"
if test "x$2" != x -a "x$2" != "x-o" ; then
CONFIG=$INTERFACE
INTERFACE="$2"
else
CONFIG=$INTERFACE
fi
. /etc/sysconfig/network/config
. /etc/sysconfig/network/scripts/functions
. /etc/sysconfig/dhcpd 2>/dev/null
. /etc/sysconfig/network/ifcfg-"$CONFIG" 2>/dev/null || true
: ${DHCPD_IFUP_RESTART:=auto}
iface_needs_restart()
{
test -d /sys/class/net/$1/bridge -o \
-d /sys/class/net/$1/bonding -o \
-d /proc/net/vlan/$1
}
case "$0" in
*if-up.d*)
#
# don't do anything if we are disabled either
# in the /etc/sysconfig/dhcpd or per interface
# in the /etc/sysconfig/network/ifcfg-"$CONFIG"
#
test "$DHCPD_IFUP_RESTART" = no && exit 0
# don't restart for loopback interface
case $INTERFACE in (lo) exit 0 ;; esac
restart_needed=$DHCPD_IFUP_RESTART
if test -n "$DHCPD_INTERFACE" \
-a "$restart_needed" != yes ;
then
for I in $DHCPD_INTERFACE ; do
test -n "$I" || continue
# don't restart when _one_ involved
# interface is not available/up yet
is_iface_up $I || exit 0
# check if this interface is involved
if test "$I" = "$INTERFACE" ; then
# check if a restart is needed
if iface_needs_restart $I ; then
restart_needed=yes
fi
fi
done
fi
if test "$restart_needed" = yes ; then
/etc/init.d/dhcpd try-restart
fi
;;
*if-down.d*)
# don't do anything
;;
*)
echo "$SCRIPTNAME: don't know what to do" >&2
;;
esac

View File

@ -16,6 +16,28 @@
# #
DHCPD_INTERFACE="" DHCPD_INTERFACE=""
## Type: list(yes,no,auto,)
## Default:
## Description: Restart dhcp server when interface goes up (again)
#
# When the dhcp server is listening on a virtual interface, e.g. bridge,
# bonding or vlan, and this interface gets deleted and recreated during
# a network restart, dhcpd will stop answering requests on this interface
# and needs a restart as well.
# Begining with SLE-10 SP3, we install an if-up.d post script (see ifup(8)
# and also ifservices(5)), enabled in auto mode by default. This variable
# can be used to force or avoid the dhcp server restart:
#
# no: do not restart dhcpd
# yes: force a dhcp server restart
# auto: (default) restart for virtual interfaces (bond,bridge,vlan) when
# all interfaces used in DHCPD_INTERFACE variable are up as well.
#
# Except of this global setting, the variable can be specified per interface
# in the interface configurations (/etc/sysconfig/network/ifcfg-$name).
#
DHCPD_IFUP_RESTART=""
## Type: yesno ## Type: yesno
## Default: yes ## Default: yes
## ServiceRestart: dhcpd ## ServiceRestart: dhcpd