SHA256
1
0
forked from pool/dhcp

Accepting request 54219 from network:dhcp

Accepted submit request 54219 from user mtomaschewski

OBS-URL: https://build.opensuse.org/request/show/54219
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/dhcp?expand=0&rev=40
This commit is contained in:
Marcus Rückert 2010-12-01 01:06:05 +00:00 committed by Git OBS Bridge
commit bbe01d0102
17 changed files with 292 additions and 142 deletions

22
contrib-lease-path.diff Normal file

@ -0,0 +1,22 @@
--- contrib/leasestate
+++ contrib/leasestate 2010/09/29 10:07:09
@@ -16,7 +16,7 @@ my %Update;
my $level = 1;
my $IP = '';
my ($ip, $bs, $nbs, $join);
-open(FILE, "/var/lib/dhcp/dhcpd.leases");
+open(FILE, "/var/lib/dhcp/db/dhcpd.leases");
while(my $line = <FILE>) {
next if ($line =~ /^\#/);
if ($level == 1) {
--- contrib/listlease
+++ contrib/listlease 2010/09/29 10:08:10
@@ -14,7 +14,7 @@ use strict;
my $LastLease = '';
my $savelease = 0;
my $prlease = 0;
-my $LFILE = "/var/lib/dhcp/dhcpd.leases";
+my $LFILE = "/var/lib/dhcp/db/dhcpd.leases";
$LFILE = $ARGV[1] if ($ARGV[1] ne '');
open(FILE, $LFILE);

@ -0,0 +1,46 @@
From 912eb17103f764ef4486b30a4801af64321a23ed Mon Sep 17 00:00:00 2001
From: Marius Tomaschewski <mt@suse.de>
Date: Fri, 29 Oct 2010 18:51:02 +0200
Subject: [PATCH] dhcp-4.1.1-P1-optional-value-infinite-loop
Fixed dhcp server infinite loop while parsing options with optional
parts in the value such as in slp-service-scope option (bnc#643845,
[ISC-Bugs #22410]).
Signed-off-by: Marius Tomaschewski <mt@suse.de>
---
common/parse.c | 17 ++++++++++++++++-
1 files changed, 16 insertions(+), 1 deletions(-)
diff --git a/common/parse.c b/common/parse.c
index 34b909a..081dcc9 100644
--- a/common/parse.c
+++ b/common/parse.c
@@ -4931,8 +4931,23 @@ struct option *option;
do {
if ((*fmt == 'A') || (*fmt == 'a'))
break;
- if (*fmt == 'o')
+ if (*fmt == 'o') {
+ /* previous value were optional */
+ fmt++;
continue;
+ }
+ if (fmt[1] == 'o') {
+ /*
+ * value for current format code is optional
+ * check if the next token is a semicolon;
+ * it is expected to be read by our caller.
+ */
+ token = peek_token (&val, (unsigned *)0, cfile);
+ if (token == SEMI) {
+ fmt++;
+ continue;
+ }
+ }
tmp = *expr;
*expr = NULL;
--
1.7.1

@ -0,0 +1,31 @@
From 4509d956715297469469ab0e207c2641f521470d Mon Sep 17 00:00:00 2001
From: Marius Tomaschewski <mt@suse.de>
Date: Fri, 29 Oct 2010 18:49:06 +0200
Subject: [PATCH] dhcp-4.1.1-P1-relay-no-ip-on-interface
Fix for a dhcrelay segfault while receiving packets on interfaces
without any IPv4 address assigned (bnc#631305, [ISC-Bugs #22409]).
Signed-off-by: Marius Tomaschewski <mt@suse.de>
---
relay/dhcrelay.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/relay/dhcrelay.c b/relay/dhcrelay.c
index 11676ae..c375c83 100644
--- a/relay/dhcrelay.c
+++ b/relay/dhcrelay.c
@@ -565,6 +565,10 @@ do_relay4(struct interface_info *ip, struct dhcp_packet *packet,
log_info("Discarding packet with invalid hlen.");
return;
}
+ if (ip->address_count < 1 || ip->addresses == NULL) {
+ log_info("Discarding packet from interface without IP address");
+ return;
+ }
/* Find the interface that corresponds to the giaddr
in the packet. */
--
1.7.1

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:6041d1658d814bee5a863964c748dc2f79dd2c618ce9db716b2846177861282a
size 877572

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:176dec01acb2704866f516ed21b6210c9d16bd4667db9b265c57bb2b07735510
size 46012

@ -1,57 +0,0 @@
From 68249388d6974933059023eea4cf750688e8a11d Mon Sep 17 00:00:00 2001
From: Marius Tomaschewski <mt@suse.de>
Date: Tue, 27 Jul 2010 15:27:28 +0200
Subject: [PATCH] Fixed ldap option numbers conflict
diff --git dhcp/includes/dhcpd.h dhcp/includes/dhcpd.h
index 6792497..95c2786 100644
--- dhcp/includes/dhcpd.h
+++ dhcp/includes/dhcpd.h
@@ -677,25 +677,25 @@ struct lease_state {
#endif
#if defined(LDAP_CONFIGURATION)
-# define SV_LDAP_SERVER 57
-# define SV_LDAP_PORT 58
-# define SV_LDAP_USERNAME 59
-# define SV_LDAP_PASSWORD 60
-# define SV_LDAP_BASE_DN 61
-# define SV_LDAP_METHOD 62
-# define SV_LDAP_DEBUG_FILE 63
-# define SV_LDAP_DHCP_SERVER_CN 64
-# define SV_LDAP_REFERRALS 65
+# define SV_LDAP_SERVER 60
+# define SV_LDAP_PORT 61
+# define SV_LDAP_USERNAME 62
+# define SV_LDAP_PASSWORD 63
+# define SV_LDAP_BASE_DN 64
+# define SV_LDAP_METHOD 65
+# define SV_LDAP_DEBUG_FILE 66
+# define SV_LDAP_DHCP_SERVER_CN 67
+# define SV_LDAP_REFERRALS 68
#if defined (USE_SSL)
-# define SV_LDAP_SSL 66
-# define SV_LDAP_TLS_REQCERT 67
-# define SV_LDAP_TLS_CA_FILE 68
-# define SV_LDAP_TLS_CA_DIR 69
-# define SV_LDAP_TLS_CERT 70
-# define SV_LDAP_TLS_KEY 71
-# define SV_LDAP_TLS_CRLCHECK 72
-# define SV_LDAP_TLS_CIPHERS 73
-# define SV_LDAP_TLS_RANDFILE 74
+# define SV_LDAP_SSL 69
+# define SV_LDAP_TLS_REQCERT 70
+# define SV_LDAP_TLS_CA_FILE 71
+# define SV_LDAP_TLS_CA_DIR 72
+# define SV_LDAP_TLS_CERT 73
+# define SV_LDAP_TLS_KEY 74
+# define SV_LDAP_TLS_CRLCHECK 75
+# define SV_LDAP_TLS_CIPHERS 76
+# define SV_LDAP_TLS_RANDFILE 77
#endif
#endif
--
1.7.1

@ -86,14 +86,15 @@ index 15c31a5..65e9c23 100644
/* Parse the lease database. */
read_client_leases();
@@ -653,12 +690,12 @@ static void usage()
@@ -674,12 +711,12 @@ static void usage()
log_error("Usage: dhclient %s %s",
#ifdef DHCPv6
- "[-4|-6] [-SNTP1dvrx] [-nw] [-p <port>]",
+ "[-4|-6] [-SNTP1dvrx] [-nw] [-H <hostname>] [-p <port>]",
- "[-4|-6] [-SNTP1dvrx] [-nw] [-p <port>] [-D LL|LLT]",
+ "[-4|-6] [-SNTP1dvrx] [-nw] [-H <hostname>] [-p <port>] [-D LL|LLT]",
#else /* DHCPv6 */
"[-1dvrx] [-nw] [-p <port>]",
- "[-1dvrx] [-nw] [-p <port>]",
+ "[-1dvrx] [-nw] [-H <hostname>] [-p <port>]",
#endif /* DHCPv6 */
"[-s server]");
- log_error(" [-cf config-file] [-lf lease-file]%s",

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:1e58b92113ba2502a7f3957065dac709d8d7e8fe3e23bc3e2543cec0a2c11450
size 9915

@ -1,6 +1,8 @@
--- dhcp-4.1.1/configure.ac
+++ dhcp-4.1.1/configure.ac 2010/05/03 12:25:59
@@ -420,8 +420,13 @@ AC_TRY_LINK(
diff --git a/configure.ac b/configure.ac
index b880616..3e0d11b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -420,8 +420,12 @@ AC_TRY_LINK(
AC_CHECK_HEADERS(sys/socket.h net/if_dl.h net/if6.h regex.h)
# find an MD5 library
@ -10,7 +12,6 @@
AC_SEARCH_LIBS(MD5Init, [crypto])
+CRYPTO_LIBS="$LIBS"
+LIBS="$saved_LIBS"
+AC_SUBST(CRYPTO_LIBS)
# Solaris needs some libraries for functions
AC_SEARCH_LIBS(socket, [socket])

3
dhcp-4.2.0-P1.tar.bz2 Normal file

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:f4249504f17f1696f0d8ec9b975f193564f460e50c58c631e560dce130aadfe2
size 8434029

@ -1,3 +1,45 @@
-------------------------------------------------------------------
Tue Nov 30 21:56:04 UTC 2010 - mt@suse.de
- Fixed to use same/correct dhcrelay6 interface variables in the
sysconfig file and in the dhcrelay6 init script.
-------------------------------------------------------------------
Mon Nov 29 15:45:09 CET 2010 - mt@suse.de
- Updated to ISC DHCP 4.2.0-P1 release, providing a security fix to
handle a relay forward message with an unspecified address in the
link address field. Previously such a message would cause the
server to crash. Thanks to a report from John Gibbons.
[ISC-Bugs #21992] CERT: VU#102047 CVE: CVE-2010-3611 (bnc#650902)
The 4.2.0 version is a feature release, implementing asynchronous
DDNS processing and includes "The LDAP Patch".
For a complete list of changes from any previous release, please
consult the RELNOTES file within the source distribution or on
the ISC website: http://www.isc.org/software/dhcp/420
- Fixed compilation to avoid segfaults as soon as ldap is enabled,
merged our ldap patches from 4.1.x branch.
-------------------------------------------------------------------
Tue Nov 2 09:48:56 UTC 2010 - mt@suse.de
- Fixed a dhcrelay segfault while receiving packets on interfaces
without any IPv4 address assigned (bnc#631305, reported upsteam
as [ISC-Bugs #22409]).
- Fixed a common infinite loop while parsing options with optional
parts in the value such as in slp-service-scope option (bnc#643845,
reported upsteam as [ISC-Bugs #22410]).
- Fixed init scripts to report correct LSB codes in status action,
when the config file or the binary do not exists (bnc#640336).
- Fixed syntax of a check in the rcdhcrelay[6] (bnc#648580)
- Avoid pid check error message in the rcdhcpd[6] (bnc#646875)
-------------------------------------------------------------------
Wed Sep 29 10:26:37 UTC 2010 - mt@suse.de
- Fixed server lease file path in contrib/listlease and leasestate
changed to extract contrib and examples using setup macro.
-------------------------------------------------------------------
Wed Aug 4 12:52:03 UTC 2010 - mt@suse.de

@ -1,5 +1,5 @@
#
# spec file for package dhcp (Version 4.1.1.P1)
# spec file for package dhcp (Version 4.2.0.P1)
#
# Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
@ -17,7 +17,7 @@
# norootforbuild
%define isc_version 4.1.1-P1
%define isc_version 4.2.0-P1
%define susefw2dir %{_sysconfdir}/sysconfig/SuSEfirewall2.d/services
%define omc_prefix /usr/share/omc
%define omc_svcdir %{omc_prefix}/svcinfo.d
@ -32,13 +32,11 @@ BuildRequires: dos2unix
License: BSD3c(or similar)
Group: Productivity/Networking/Boot/Servers
AutoReqProv: on
Version: 4.1.1.P1
Release: 6
Version: 4.2.0.P1
Release: 0
Summary: Common Files Used by ISC DHCP Software
Url: http://www.isc.org/software/dhcp
Source0: dhcp-%{isc_version}.tar.bz2
#Source0: http://ftp.isc.org/isc/dhcp/dhcp-%{isc_version}.tar.gz
#Source1: http://ftp.isc.org/isc/dhcp/dhcp-%{isc_version}.tar.gz.asc
#
Source10: rc.dhcpd
Source11: rc.dhcpd6
@ -73,16 +71,15 @@ Patch11: dhcp-4.1.1-paranoia.diff
Patch12: dhcp-4.1.1-man-includes.diff
Patch13: dhcp-4.1.1-tmpfile.diff
Patch14: dhcp-4.1.1-in6_pktinfo-prototype.diff
Patch15: contrib-lease-path.diff
Patch20: dhcp-4.1.1-dhclient-exec-filedes.diff
Patch21: dhcp-4.1.1-dhclient-send-hostname-rml.diff
Patch21: dhcp-4.2.0-P1-dhclient-send-hostname-rml.diff
## patch lives here: http://www.suse.de/~mt/git/dhcp-ldap.git/
%if 0%{?with_ldap:1}
Patch30: dhcp-4.1.1-ldap-patch-mt-01.diff.bz2
Patch31: dhcp-4.1.1-ldap-patch-mt-01_option-numbers.diff
%else
Patch30: dhcp-4.1.1-dhclient-no-libcrypto.diff
%endif
Patch30: dhcp-4.2.0-P1-ldap-patch-mt01.diff.bz2
Patch39: dhcp-4.2.0-P1-no-libcrypto.diff
Patch40: dhcp-4.1.1-P1-lpf-bind-msg-fix.diff
Patch41: dhcp-4.1.1-P1-relay-no-ip-on-interface.diff
Patch42: dhcp-4.1.1-P1-optional-value-infinite-loop.diff
##
PreReq: /bin/touch /sbin/chkconfig sysconfig
BuildRoot: %{_tmppath}/%{name}-%{version}-build
@ -191,22 +188,23 @@ Authors:
%prep
%setup -q -n %{name}-%{isc_version}
%setup -q -n %{name}-%{isc_version} -a 44 -a 45
##
%patch10 -p1
%patch11 -p1
%patch12 -p1
%patch13 -p1
%patch14 -p1
%patch15 -p0
%patch20 -p1
%patch21 -p1
%if 0%{?with_ldap:%with_ldap}
%patch30 -p1
%patch31 -p1
%else
%if 0%{?with_ldap:1}
%patch30 -p1
%endif
%patch39 -p1
%patch40 -p1
%patch41 -p1
%patch42 -p1
##
find . -type f -name \*.cat\* -exec rm -f {} \;
dos2unix contrib/ms2isc/*
@ -238,8 +236,9 @@ autoreconf
--enable-paranoia \
--enable-early-chroot \
%if 0%{?with_ldap:%with_ldap}
--enable-ldap-conf \
--enable-ldap-casa \
--with-ldap \
--with-ldapcrypto \
--with-ldapcasa \
%endif
--with-cli-pid-file=%{_localstatedir}/run/dhclient.pid \
--with-cli-lease-file=%{_localstatedir}/lib/dhcp/dhclient.leases \
@ -273,7 +272,9 @@ install -d -m0755 $RPM_BUILD_ROOT/sbin
install -d -m0755 $RPM_BUILD_ROOT%{_sysconfdir}/init.d
install -d -m0755 $RPM_BUILD_ROOT/%{susefw2dir}
install -d -m0755 $RPM_BUILD_ROOT/%{omc_svcdir}
%if 0%{?with_ldap:%with_ldap}
install -d -m0755 $RPM_BUILD_ROOT%{_sysconfdir}/openldap/schema
%endif
install -d -m0755 $RPM_BUILD_ROOT%{_localstatedir}/run
install -d -m0755 $RPM_BUILD_ROOT%{_localstatedir}/adm/fillup-templates
# chroot jail
@ -319,8 +320,10 @@ install -m0644 $RPM_SOURCE_DIR/sysconfig.syslog-dhcpd \
install -m0644 $RPM_SOURCE_DIR/sysconfig.dhcrelay \
$RPM_BUILD_ROOT%{_localstatedir}/adm/fillup-templates/
# another config files and scripts
install -m0644 contrib/dhcp.schema \
%if 0%{?with_ldap:%with_ldap}
install -m0644 contrib/ldap/dhcp.schema \
$RPM_BUILD_ROOT%{_sysconfdir}/openldap/schema
%endif
install -m0644 $RPM_SOURCE_DIR/dhcpd.xml \
$RPM_SOURCE_DIR/dhcpd6.xml \
$RPM_BUILD_ROOT/%{omc_svcdir}/
@ -339,16 +342,9 @@ install -m0644 $RPM_SOURCE_DIR/dhcp.LIESMICH LIESMICH.SuSE
install -m0644 $RPM_SOURCE_DIR/dhcp.README README.SuSE
install -m0644 $RPM_SOURCE_DIR/dhcp.README.upgrade README.upgrade
install -m0644 $RPM_SOURCE_DIR/DDNS-howto.txt .
tar xzf $RPM_SOURCE_DIR/contrib.tar.gz
mv doc/examples .
tar xzf $RPM_SOURCE_DIR/examples.tar.gz
cp doc/examples/* ./examples/
rm -f doc/{References.xml,Makefile*}
rm -f contrib/dhcp.spec
%if ! 0%{?with_ldap:%with_ldap}
rm -f doc/draft-ietf-dhc-ldap-schema-01.txt
rm -f contrib/dhcp.schema README.ldap
rm -f contrib/dhcpd-conf-to-ldap.pl
%endif
%pre server
/usr/sbin/useradd -r -g nogroup -s /bin/false -c "DHCP server daemon" -d /var/lib/dhcp dhcpd 2> /dev/null ||:
@ -383,6 +379,10 @@ exit 0
%insserv_cleanup
%post relay
%{rename_sysconfig_variable -f etc/sysconfig/dhcrelay
DHCRELAY6_LOWER_INTERFACES_ARGS DHCRELAY6_LOWER_INTERFACES}
%{rename_sysconfig_variable -f etc/sysconfig/dhcrelay
DHCRELAY6_UPPER_INTERFACES_ARGS DHCRELAY6_UPPER_INTERFACES}
%{fillup_and_insserv -n dhcrelay dhcrelay dhcrelay6}
%preun relay
@ -445,7 +445,7 @@ if ! test -f /.buildenv; then rm -rf $RPM_BUILD_ROOT; fi
%doc %{_mandir}/man8/dhcpd.8.gz
%doc %{_mandir}/man5/dhcpd.conf.5.gz
%doc %{_mandir}/man5/dhcpd.leases.5.gz
%if 0%{?with_ldap:1}
%if 0%{?with_ldap:%with_ldap}
%dir %{_sysconfdir}/openldap
%dir %{_sysconfdir}/openldap/schema
%attr(0644, root, root) %config %{_sysconfdir}/openldap/schema/dhcp.schema

@ -96,14 +96,33 @@ rc_reset
# considered a success.
if ! [ -x "$DAEMON_BIN" ]; then
if [ "$1" = "stop" ]; then exit 0; fi
echo >&2 "$0: \"$DAEMON_BIN\" is not an executable file. Exiting."
exit 5
case $1 in
stop) ;;
*) echo -n >&2 "$0: \"$DAEMON_BIN\" is not an executable file. Exiting."
case $1 in
status) rc_failed 4 ;;
*) rc_failed 5 ;;
esac
rc_status -v
;;
esac
rc_exit
fi
if ! [ -r "$DAEMON_CONF" ] ; then
if [ "$1" = "stop" ]; then exit 0; fi
echo >&2 "$0: \"$DAEMON_CONF\" config file missed. Exiting."
exit 6
case $1 in
stop|status)
if test ! -s /etc/sysconfig/dhcpd ; then
test -e $DAEMON_STATE/$DAEMON_PIDFILE && \
CHROOT_PREFIX="$DAEMON_STATE" || CHROOT_PREFIX=''
fi
;;
*)
echo -n >&2 "$0: \"$DAEMON_CONF\" config file missed. Exiting."
rc_failed 6
rc_status -v
rc_exit
;;
esac
fi
# remove empty pid files to avoid disturbing warnings by checkproc/killproc
@ -223,7 +242,7 @@ case "$1" in
## we remove the pid. (dhcpd itself only checks whether the pid is alive or not.)
if test -e $CHROOT_PREFIX/$DAEMON_PIDFILE -a -s $CHROOT_PREFIX/$DAEMON_PIDFILE; then
p=$(<$CHROOT_PREFIX/$DAEMON_PIDFILE)
if test -n "$p" && grep -qE "^${DAEMON_BIN}" "/proc/$p/cmdline" ; then
if test -n "$p" && grep -qsE "^${DAEMON_BIN}" "/proc/$p/cmdline" ; then
echo -n '(already running) '
else
rm $CHROOT_PREFIX/$DAEMON_PIDFILE

@ -100,14 +100,33 @@ rc_reset
# considered a success.
if ! [ -x "$DAEMON_BIN" ]; then
if [ "$1" = "stop" ]; then exit 0; fi
echo >&2 "$0: \"$DAEMON_BIN\" is not an executable file. Exiting."
exit 5
case $1 in
stop) ;;
*) echo -n >&2 "$0: \"$DAEMON_BIN\" is not an executable file. Exiting."
case $1 in
status) rc_failed 4 ;;
*) rc_failed 5 ;;
esac
rc_status -v
;;
esac
rc_exit
fi
if ! [ -r "$DAEMON_CONF" ] ; then
if [ "$1" = "stop" ]; then exit 0; fi
echo >&2 "$0: \"$DAEMON_CONF\" config file missed. Exiting."
exit 6
case $1 in
stop|status)
if test ! -s /etc/sysconfig/dhcpd ; then
test -e $DAEMON_STATE/$DAEMON_PIDFILE && \
CHROOT_PREFIX="$DAEMON_STATE" || CHROOT_PREFIX=''
fi
;;
*)
echo -n >&2 "$0: \"$DAEMON_CONF\" config file missed. Exiting."
rc_failed 6
rc_status -v
rc_exit
;;
esac
fi
# remove empty pid files to avoid disturbing warnings by checkproc/killproc
@ -227,7 +246,7 @@ case "$1" in
## we remove the pid. (dhcpd itself only checks whether the pid is alive or not.)
if test -e $CHROOT_PREFIX/$DAEMON_PIDFILE -a -s $CHROOT_PREFIX/$DAEMON_PIDFILE; then
p=$(<$CHROOT_PREFIX/$DAEMON_PIDFILE)
if test -n "$p" && grep -qE "^${DAEMON_BIN}" "/proc/$p/cmdline" ; then
if test -n "$p" && grep -qsE "^${DAEMON_BIN}" "/proc/$p/cmdline" ; then
echo -n '(already running) '
else
rm $CHROOT_PREFIX/$DAEMON_PIDFILE

@ -25,6 +25,7 @@
# physical network segment to another.
### END INIT INFO
DHCPv_OPT=-4
DAEMON="ISC DHCPv4 relay agent"
DAEMON_BIN=/usr/sbin/dhcrelay
DAEMON_CONF=/etc/sysconfig/dhcrelay
@ -33,10 +34,19 @@ STARTPROC_LOGFILE=/var/log/rc.dhcrelay.log
SUPPORTS_HUP="no"
test -s "$DAEMON_CONF" && . "$DAEMON_CONF"
test -x $DAEMON_BIN || {
echo >&2 "$0: \"$DAEMON_BIN\" is not executable."
test "x$1" = xstop && exit 0 || exit 5
}
if ! [ -x "$DAEMON_BIN" ]; then
case $1 in
stop) ;;
*) echo -n >&2 "$0: \"$DAEMON_BIN\" is not an executable file. Exiting."
case $1 in
status) rc_failed 4 ;;
*) rc_failed 5 ;;
esac
rc_status -v
;;
esac
rc_exit
fi
# Shell functions sourced from /etc/rc.status:
# rc_check check and set local and overall rc status
@ -70,7 +80,9 @@ rc_reset
case "$1" in
start)
echo -n "Starting $DAEMON"
checkproc $DAEMON_BIN && { echo -n "... already running"; rc_status -v; exit 0; }
checkproc -p $DAEMON_PIDFILE $DAEMON_BIN && {
echo -n "... already running"; rc_status -v; exit 0;
}
## If interfaces or servers are not set, skip starting of dhcrelay
## and return with "program not configured"
@ -81,6 +93,7 @@ case "$1" in
exit 6;
fi
DHCRELAY_INTERFACES_ARGS=''
for i in $DHCRELAY_INTERFACES ; do
DHCRELAY_INTERFACES_ARGS="$DHCRELAY_INTERFACES_ARGS -i $i"
done
@ -91,8 +104,8 @@ case "$1" in
# startproc should return 0, even if service is
# already running to match LSB spec.
test "$2" = "-v" && echo -en \
"\nexecuting '$DAEMON_BIN $DHCRELAY_OPTIONS $DHCRELAY_INTERFACES_ARGS $DHCRELAY_SERVERS'"
startproc -q -l $STARTPROC_LOGFILE $DAEMON_BIN $DHCRELAY_OPTIONS $DHCRELAY_INTERFACES_ARGS $DHCRELAY_SERVERS
"\nexecuting '$DAEMON_BIN $DHCPv_OPT $DHCRELAY_OPTIONS $DHCRELAY_INTERFACES_ARGS $DHCRELAY_SERVERS'"
startproc -q -l $STARTPROC_LOGFILE -p $DAEMON_PIDFILE $DAEMON_BIN $DHCPv_OPT $DHCRELAY_OPTIONS $DHCRELAY_INTERFACES_ARGS $DHCRELAY_SERVERS
rc=$?
if ! [ $rc -eq 0 ]; then
if [ $link = $base ] ; then
@ -152,7 +165,7 @@ case "$1" in
echo -n "Reload service $DAEMON"
if "$SUPPORTS_HUP" = "yes" ; then
if [ "$SUPPORTS_HUP" = "yes" ] ; then
killproc -p $DAEMON_PIDFILE -HUP $DAEMON_BIN
#touch $DAEMON_PIDFILE
rc_status -v
@ -165,7 +178,7 @@ case "$1" in
## Like force-reload, but if daemon does not support
## signalling, do nothing (!)
if "$SUPPORTS_HUP" = "yes" ; then
if [ "$SUPPORTS_HUP" = "yes" ] ; then
# If it supports signalling:
echo -n "Reload service $DAEMON"
killproc -p $DAEMON_PIDFILE -HUP $DAEMON_BIN

@ -25,7 +25,7 @@
# physical network segment to another.
### END INIT INFO
DHCPv_OPT=-6
DAEMON="ISC DHCPv6 relay agent"
DAEMON_BIN=/usr/sbin/dhcrelay6
DAEMON_CONF=/etc/sysconfig/dhcrelay
@ -34,10 +34,19 @@ STARTPROC_LOGFILE=/var/log/rc.dhcrelay6.log
SUPPORTS_HUP="no"
test -s "$DAEMON_CONF" && . "$DAEMON_CONF"
test -x $DAEMON_BIN || {
echo >&2 "$0: \"$DAEMON_BIN\" is not executable."
test "x$1" = xstop && exit 0 || exit 5
}
if ! [ -x "$DAEMON_BIN" ]; then
case $1 in
stop) ;;
*) echo -n >&2 "$0: \"$DAEMON_BIN\" is not an executable file. Exiting."
case $1 in
status) rc_failed 4 ;;
*) rc_failed 5 ;;
esac
rc_status -v
;;
esac
rc_exit
fi
# Shell functions sourced from /etc/rc.status:
# rc_check check and set local and overall rc status
@ -71,14 +80,18 @@ rc_reset
case "$1" in
start)
echo -n "Starting $DAEMON"
checkproc $DAEMON_BIN && { echo -n "... already running"; rc_status -v; exit 0; }
checkproc -p $DAEMON_PIDFILE $DAEMON_BIN && {
echo -n "... already running"; rc_status -v; exit 0;
}
DHCRELAY6_LOWER_INTERFACES_ARGS=''
for l in $DHCRELAY6_LOWER_INTERFACES ; do
test x"$l" = x && continue
test "x$l" = x -o "x$l" = "x-l" && continue
DHCRELAY6_LOWER_INTERFACES_ARGS="$DHCRELAY6_LOWER_INTERFACES_ARGS -l $l"
done
DHCRELAY6_UPPER_INTERFACES_ARGS=''
for u in $DHCRELAY6_UPPER_INTERFACES ; do
test x"$u" = x && continue
test "x$u" = x -o "x$u" = "x-u" && continue
DHCRELAY6_UPPER_INTERFACES_ARGS="$DHCRELAY6_UPPER_INTERFACES_ARGS -u $u"
done
@ -99,8 +112,8 @@ case "$1" in
# startproc should return 0, even if service is
# already running to match LSB spec.
test "$2" = "-v" && echo -en \
"\nexecuting '$DAEMON_BIN $DHCRELAY6_OPTIONS $DHCRELAY6_LOWER_INTERFACES_ARGS $DHCRELAY6_UPPER_INTERFACES_ARGS'"
startproc -q -l $STARTPROC_LOGFILE $DAEMON_BIN $DHCRELAY6_OPTIONS $DHCRELAY6_LOWER_INTERFACES_ARGS $DHCRELAY6_UPPER_INTERFACES_ARGS
"\nexecuting '$DAEMON_BIN $DHCPv_OPT $DHCRELAY6_OPTIONS $DHCRELAY6_LOWER_INTERFACES_ARGS $DHCRELAY6_UPPER_INTERFACES_ARGS'"
startproc -q -l $STARTPROC_LOGFILE -p $DAEMON_PIDFILE $DAEMON_BIN $DHCPv_OPT $DHCRELAY6_OPTIONS $DHCRELAY6_LOWER_INTERFACES_ARGS $DHCRELAY6_UPPER_INTERFACES_ARGS
rc=$?
if ! [ $rc -eq 0 ]; then
if [ $link = $base ] ; then
@ -160,7 +173,7 @@ case "$1" in
echo -n "Reload service $DAEMON"
if "$SUPPORTS_HUP" = "yes" ; then
if [ "$SUPPORTS_HUP" = "yes" ] ; then
killproc -p $DAEMON_PIDFILE -HUP $DAEMON_BIN
#touch $DAEMON_PIDFILE
rc_status -v
@ -173,7 +186,7 @@ case "$1" in
## Like force-reload, but if daemon does not support
## signalling, do nothing (!)
if "$SUPPORTS_HUP" = "yes" ; then
if [ "$SUPPORTS_HUP" = "yes" ] ; then
# If it supports signalling:
echo -n "Reload service $DAEMON"
killproc -p $DAEMON_PIDFILE -HUP $DAEMON_BIN

@ -32,21 +32,21 @@ DHCRELAY_OPTIONS=""
## Default: ""
## ServiceRestart: dhcrelay6
#
# Specifies the ``lower'' network interface for DHCPv6 relay mode
# separated by spaces.
# Specifies the ``lower'' client link network interfaces for DHCPv6
# relay -- separated by spaces.
# The format of the lower interface is: "[address%]ifname[#index]".
#
DHCRELAY6_LOWER_INTERFACES_ARGS=""
DHCRELAY6_LOWER_INTERFACES=""
## Type: string
## Default: ""
## ServiceRestart: dhcrelay6
#
# Specifies the ``upper'' network interface for DHCPv6 relay mode
# separated by spaces.
# Specifies the ``upper'' server link network interfaces for DHCPv6
# relay -- separated by spaces.
# The format of the upper interface is "[address%]ifname".
#
DHCRELAY6_UPPER_INTERFACES_ARGS=""
DHCRELAY6_UPPER_INTERFACES=""
## Type: string
## Default: ""