Hello community,
here is the log from the commit of package dhcp for openSUSE:Factory checked in at 2014-02-13 06:44:47
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/dhcp (Old)
and /work/SRC/openSUSE:Factory/.dhcp.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "dhcp"
Changes:
--------
--- /work/SRC/openSUSE:Factory/dhcp/dhcp.changes 2014-01-13 17:20:10.000000000 +0100
+++ /work/SRC/openSUSE:Factory/.dhcp.new/dhcp.changes 2014-02-13 06:44:49.000000000 +0100
@@ -1,0 +2,34 @@
+Mon Feb 10 17:52:15 UTC 2014 - mt@suse.com
+
+- Initially switched to use systemd service files under systemd
+ and enabled Restart=on-abort (fate#315133).
+- Update to ISC dhcp-4.2.6 release. See RELNOTES file for the
+ complete list of changes -- digest of fixes not in dhcp-4.2.5:
+ - Tidy up receive packet processing.
+ Thanks to Brad Plank of GTA for reporting the issue and
+ suggesting a possible patch. [ISC-Bugs #34447]
+ - Fix the socket handling for DHCPv6 clients to allow multiple
+ instances of a client on a single machine to work properly.
+ Previously only one client would receive the packets.
+ Thanks to Jiri Popelka at Red Hat for the bug report and a
+ potential patch. [ISC-Bugs #34784]
+ - Added support for gentle shutdown after signal is received.
+ [ISC-Bugs #32692] [ISC-Bugs 34945]
+ - Enhance the DHCPv6 server logging to include the addresses
+ that are assigned to the clients. This can be enabled by
+ defining LOG_V6_ADDRESSES in site.h. [ISC-Bugs #26377]
+ - Fix an operation in the DDNS code to be a bitwise instead
+ of logical or. [ISC-Bugs #35138]
+- Merged patches for dhcp-4.2.6 version to apply without fuzzy,
+ prepended patch number prefixes to match spec file patch nr,
+ added patch markup tags / bug numbers to the spec file.
+- Applied contrib-lease-path pach to contrib.tar.gz
+ [- contrib-lease-path.diff]
+- Changed to require automake and use its config.sub and guess
+ files instead of maintaining a patch.
+ [- config-guess-sub-update.patch]
+- Enabled to log DHCPv6 addresses assigned by server to clients
+ [+ 0016-server-log-DHCPv6-addresses-assigned-to-clients.patch]
+- Cleaned up documentation, rpmlint adjustments.
+
+-------------------------------------------------------------------
Old:
----
config-guess-sub-update.patch
contrib-lease-path.diff
dhcp-4.1.1-P1-lpf-bind-msg-fix.diff
dhcp-4.1.1-default-paths.diff
dhcp-4.1.1-dhclient-exec-filedes.diff
dhcp-4.1.1-paranoia.diff
dhcp-4.1.1-tmpfile.diff
dhcp-4.2.2-close-on-exec.diff
dhcp-4.2.2-man-includes.diff
dhcp-4.2.2-quiet-dhclient.bnc711420.diff
dhcp-4.2.2-xen-checksum.diff
dhcp-4.2.3-P1-dhclient-log-pid.diff
dhcp-4.2.4-P2-do-not-die-on-sigpipe.patch
dhcp-4.2.4-dhclient-option-checks.bnc675052.diff
dhcp-4.2.4-interface-discovery-using-getifaddrs.patch
dhcp-4.2.5-P1.tar.gz
dhcp-4.2.5-P1.tar.gz.asc
dhcp-4.2.5-dhclient-send-hostname-rml.patch
dhcp-4.2.5-ldap-mt01.patch.bz2
dhcp.LIESMICH
dhcp.README.upgrade
New:
----
0001-dhcp-4.1.1-default-paths.patch
0002-dhcp-4.1.1-paranoia.patch
0003-dhcp-4.2.2-man-includes.patch
0004-dhcp-4.1.1-tmpfile.patch
0005-dhcp-4.1.1-dhclient-exec-filedes.patch
0006-dhcp-4.2.5-dhclient-send-hostname-rml.patch
0007-dhcp-4.2.6-ldap-mt01.patch
0008-dhcp-4.1.1-P1-lpf-bind-msg-fix.patch
0009-dhcp-4.2.6-xen-checksum.patch
0010-dhcp-4.2.2-dhclient-option-checks.patch
0011-dhcp-4.2.6-close-on-exec.patch
0012-dhcp-4.2.2-quiet-dhclient.patch
0013-dhcp-4.2.3-P1-dhclient-log-pid.patch
0014-Fixed-linux-interface-discovery-using-getifaddrs.patch
0015-Ignore-SIGPIPE-to-not-die-in-socket-code.patch
0016-server-log-DHCPv6-addresses-assigned-to-clients.patch
dhcp-4.2.6.tar.gz
dhcp-4.2.6.tar.gz.asc
dhcpd.script
dhcpd.service
dhcpd6.service
dhcrelay.script
dhcrelay.service
dhcrelay6.service
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ dhcp.spec ++++++
--- /var/tmp/diff_new_pack.3H7W85/_old 2014-02-13 06:44:50.000000000 +0100
+++ /var/tmp/diff_new_pack.3H7W85/_new 2014-02-13 06:44:50.000000000 +0100
@@ -16,7 +16,7 @@
#
-%define isc_version 4.2.5-P1
+%define isc_version 4.2.6
%define susefw2dir %{_sysconfdir}/sysconfig/SuSEfirewall2.d/services
%define omc_prefix /usr/share/omc
%define omc_svcdir %{omc_prefix}/svcinfo.d
@@ -26,6 +26,11 @@
%define with_ldapcasa 0%{?sles_version} >= 10 || (%suse_version >= 1110 && %suse_version < 1140)
# doc package is new on 11.3
%define with_doc_package %suse_version >= 1130
+%if 0%{?suse_version} >= 1310
+%bcond_without systemd
+%else
+%bcond_with systemd
+%endif
Name: dhcp
%if %{with_ldap}
@@ -36,7 +41,7 @@
%endif
BuildRequires: dos2unix
BuildRequires: libtool
-Version: 4.2.5.P1
+Version: 4.2.6
Release: 0.<RELEASE0>
Summary: Common Files Used by ISC DHCP Software
License: BSD-3-Clause
@@ -46,59 +51,74 @@
Source1: dhcp-%{isc_version}.tar.gz.asc
Source2: %{name}.keyring
#
-Source10: rc.dhcpd
-Source11: rc.dhcpd6
-Source12: rc.dhcrelay
-Source13: rc.dhcrelay6
-Source14: sysconfig.dhcpd
-Source15: sysconfig.syslog-dhcpd
-Source16: sysconfig.dhcrelay
+Source10: dhcpd.script
+Source11: dhcrelay.script
+%if %{with systemd}
+Source12: dhcpd.service
+Source13: dhcpd6.service
+Source14: dhcrelay.service
+Source15: dhcrelay6.service
+%else
+Source12: rc.dhcpd
+Source13: rc.dhcpd6
+Source14: rc.dhcrelay
+Source15: rc.dhcrelay6
+%endif
+Source17: sysconfig.dhcpd
+Source18: sysconfig.dhcrelay
Source19: if-up.d.dhcpd-restart-hook
#
Source20: dhclient.conf
Source21: dhclient6.conf
Source22: dhcpd.conf
Source23: dhcpd6.conf
-Source24: dhclient-script
+Source26: sysconfig.syslog-dhcpd
+Source27: dhclient-script
#
Source30: dhcpd.xml
Source31: dhcpd6.xml
Source32: SuSEfirewall2.dhcp-server
Source33: SuSEfirewall2.dhcp6-server
#
-Source40: dhcp.LIESMICH
Source41: dhcp.README
-Source42: dhcp.README.upgrade
Source43: DDNS-howto.txt
Source44: contrib.tar.gz
Source45: examples.tar.gz
-#
-Patch10: dhcp-4.1.1-default-paths.diff
+Patch1: 0001-dhcp-4.1.1-default-paths.patch
# paranoia patch is included now, but not the
# additional patch by thomas@suse.de not ...
-Patch11: dhcp-4.1.1-paranoia.diff
-Patch12: dhcp-4.2.2-man-includes.diff
-Patch13: dhcp-4.1.1-tmpfile.diff
-Patch15: contrib-lease-path.diff
-Patch20: dhcp-4.1.1-dhclient-exec-filedes.diff
-Patch21: dhcp-4.2.5-dhclient-send-hostname-rml.patch
-## my patch repo lives here: http://users.suse.com/~mt/dhcp-ldap/dhcp-ldap.git/
-Patch30: dhcp-4.2.5-ldap-mt01.patch.bz2
-Patch40: dhcp-4.1.1-P1-lpf-bind-msg-fix.diff
-Patch44: dhcp-4.2.2-xen-checksum.diff
-Patch45: dhcp-4.2.4-dhclient-option-checks.bnc675052.diff
-Patch46: dhcp-4.2.2-close-on-exec.diff
-Patch47: dhcp-4.2.2-quiet-dhclient.bnc711420.diff
-Patch48: dhcp-4.2.3-P1-dhclient-log-pid.diff
-Patch49: dhcp-4.2.4-interface-discovery-using-getifaddrs.patch
-Patch50: dhcp-4.2.4-P2-do-not-die-on-sigpipe.patch
+Patch2: 0002-dhcp-4.1.1-paranoia.patch
+Patch3: 0003-dhcp-4.2.2-man-includes.patch
+Patch4: 0004-dhcp-4.1.1-tmpfile.patch
+Patch5: 0005-dhcp-4.1.1-dhclient-exec-filedes.patch
+Patch6: 0006-dhcp-4.2.5-dhclient-send-hostname-rml.patch
+# PATCH-FIX-UPSTREAM ldap-patch bnc#788787,bnc#784640
+Patch7: 0007-dhcp-4.2.6-ldap-mt01.patch
+# PATCH-FIX-UPSTREAM lpf-bind-msg-fix bnc#617795
+Patch8: 0008-dhcp-4.1.1-P1-lpf-bind-msg-fix.patch
+# PATCH-FIX-SLE xen-checksum bnc#668194
+Patch9: 0009-dhcp-4.2.6-xen-checksum.patch
+# PATCH-FIX-SLE dhclient-option-checks bnc#675052
+Patch10: 0010-dhcp-4.2.2-dhclient-option-checks.patch
+# PATCH-FIX-OPENSUSE close-on-exec bnc#732910
+Patch11: 0011-dhcp-4.2.6-close-on-exec.patch
+# PATCH-FIX-OPENSUSE quiet-dhclient bnc#711420
+Patch12: 0012-dhcp-4.2.2-quiet-dhclient.patch
+# PATCH-FIX-OPENSUSE dhclient-log-pid
+Patch13: 0013-dhcp-4.2.3-P1-dhclient-log-pid.patch
+# PATCH-FIX-UPSTREAM use-getifaddrs bnc#791289,ISC-Bugs#31992
+Patch14: 0014-Fixed-linux-interface-discovery-using-getifaddrs.patch
+# PATCH-FIX-UPSTREAM no-die-on-SIGPIPE bnc#794578,ISC-Bugs#32222
+Patch15: 0015-Ignore-SIGPIPE-to-not-die-in-socket-code.patch
+# PATCH-FEATURE-UPSTREAM log-dhcpv6-client-addresses ISC-Bugs#26377
+Patch16: 0016-server-log-DHCPv6-addresses-assigned-to-clients.patch
##
-Patch60: config-guess-sub-update.patch
PreReq: /bin/touch /sbin/chkconfig sysconfig
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%if 0%{?suse_version} > 1220
BuildRequires: gpg-offline
%endif
+BuildRequires: automake
%package server
Summary: ISC DHCP Server
@@ -210,24 +230,24 @@
%endif
%setup -q -n %{name}-%{isc_version} -a 44 -a 45
##
+%patch1 -p1
+%patch2 -p1
+%patch3 -p1
+%patch4 -p1
+%patch5 -p1
+%patch6 -p1
+%if %{with_ldap}
+%patch7 -p1
+%endif
+%patch8 -p1
+%patch9 -p1
%patch10 -p1
%patch11 -p1
%patch12 -p1
%patch13 -p1
-%patch15 -p0
-%patch20 -p1
-%patch21 -p1
-%if %{with_ldap}
-%patch30 -p1
-%endif
-%patch40 -p1
-%patch44 -p1
-%patch45 -p1
-%patch46 -p1
-%patch47 -p1
-%patch48 -p1
-%patch49 -p1
-%patch50 -p1
+%patch14 -p1
+%patch15 -p1
+%patch16 -p1
##
find . -type f -name \*.cat\* -exec rm -f {} \;
dos2unix contrib/ms2isc/*
@@ -236,7 +256,10 @@
pushd bind
gunzip -c bind.tar.gz | tar xf -
rm -rf bind-*/contrib/dbus
-patch -p0 -d bind-* < %{P:60}
+bind_dir=$(ls -1d bind-*)
+for i in /usr/share/automake-*/config.{sub,guess} ; do
+ install -v -m755 $i $bind_dir/
+done
popd
##
@@ -299,15 +322,16 @@
make %{?_smp_mflags}
%check
-# with a minimal config, see if it runs
-echo "ddns-update-style interim;" > testconf
-./server/dhcpd -4 -t -cf testconf || exit 1
-./server/dhcpd -6 -t -cf testconf || exit 1
+# check example config, see if it runs
+./server/dhcpd -4 -t -cf $RPM_SOURCE_DIR/dhcpd.conf
+./server/dhcpd -6 -t -cf $RPM_SOURCE_DIR/dhcpd6.conf
# check syntax in our scripts
bash -n $RPM_SOURCE_DIR/rc.dhcpd
bash -n $RPM_SOURCE_DIR/rc.dhcpd6
bash -n $RPM_SOURCE_DIR/rc.dhcrelay
bash -n $RPM_SOURCE_DIR/rc.dhcrelay6
+bash -n $RPM_SOURCE_DIR/dhcpd.script
+bash -n $RPM_SOURCE_DIR/dhcrelay.script
bash -n $RPM_SOURCE_DIR/dhclient-script
%install
@@ -316,7 +340,6 @@
#
# directories
install -d -m0755 $RPM_BUILD_ROOT/sbin
-install -d -m0755 $RPM_BUILD_ROOT%{_sysconfdir}/init.d
install -d -m0755 $RPM_BUILD_ROOT%{_sysconfdir}/dhcpd{,6}.d
install -d -m0755 $RPM_BUILD_ROOT/%{susefw2dir}
install -d -m0755 $RPM_BUILD_ROOT/%{omc_svcdir}
@@ -343,23 +366,45 @@
install -m0644 $RPM_SOURCE_DIR/dhclient.conf $RPM_BUILD_ROOT%{_sysconfdir}/
install -m0644 $RPM_SOURCE_DIR/dhclient6.conf $RPM_BUILD_ROOT%{_sysconfdir}/
install -m0750 $RPM_SOURCE_DIR/dhclient-script $RPM_BUILD_ROOT/sbin/
-# init scripts
+# helper / wrapper scripts
+install -d -m0755 $RPM_BUILD_ROOT/usr/lib/dhcp
+install -m0755 $RPM_SOURCE_DIR/dhcpd.script \
+ $RPM_BUILD_ROOT/usr/lib/dhcp/dhcpd
+install -m0755 $RPM_SOURCE_DIR/dhcrelay.script \
+ $RPM_BUILD_ROOT/usr/lib/dhcp/dhcrelay
+%if %{with systemd}
+# service units
+install -d -m0755 $RPM_BUILD_ROOT%{_unitdir}
+install -m0644 $RPM_SOURCE_DIR/dhcpd.service \
+ $RPM_BUILD_ROOT%{_unitdir}/dhcpd.service
+install -m0644 $RPM_SOURCE_DIR/dhcpd6.service \
+ $RPM_BUILD_ROOT%{_unitdir}/dhcpd6.service
+install -m0644 $RPM_SOURCE_DIR/dhcrelay.service \
+ $RPM_BUILD_ROOT%{_unitdir}/dhcrelay.service
+install -m0644 $RPM_SOURCE_DIR/dhcrelay6.service \
+ $RPM_BUILD_ROOT%{_unitdir}/dhcrelay6.service
+# rcservice links
+ln -sf %{_sbindir}/service $RPM_BUILD_ROOT%{_sbindir}/rcdhcpd
+ln -sf %{_sbindir}/service $RPM_BUILD_ROOT%{_sbindir}/rcdhcpd6
+ln -sf %{_sbindir}/service $RPM_BUILD_ROOT%{_sbindir}/rcdhcrelay
+ln -sf %{_sbindir}/service $RPM_BUILD_ROOT%{_sbindir}/rcdhcrelay6
+%else
+# service scripts
+install -d -m0755 $RPM_BUILD_ROOT%{_sysconfdir}/init.d
install -m0755 $RPM_SOURCE_DIR/rc.dhcpd \
$RPM_BUILD_ROOT%{_sysconfdir}/init.d/dhcpd
-ln -sf %{_sysconfdir}/init.d/dhcpd \
- $RPM_BUILD_ROOT%{_sbindir}/rcdhcpd
install -m0755 $RPM_SOURCE_DIR/rc.dhcpd6 \
$RPM_BUILD_ROOT%{_sysconfdir}/init.d/dhcpd6
-ln -sf %{_sysconfdir}/init.d/dhcpd6 \
- $RPM_BUILD_ROOT%{_sbindir}/rcdhcpd6
install -m0755 $RPM_SOURCE_DIR/rc.dhcrelay \
$RPM_BUILD_ROOT%{_sysconfdir}/init.d/dhcrelay
-ln -sf %{_sysconfdir}/init.d/dhcrelay \
- $RPM_BUILD_ROOT%{_sbindir}/rcdhcrelay
install -m0755 $RPM_SOURCE_DIR/rc.dhcrelay6 \
$RPM_BUILD_ROOT%{_sysconfdir}/init.d/dhcrelay6
-ln -sf %{_sysconfdir}/init.d/dhcrelay6 \
- $RPM_BUILD_ROOT%{_sbindir}/rcdhcrelay6
+# rcservice links
+ln -sf %{_sysconfdir}/init.d/dhcpd $RPM_BUILD_ROOT%{_sbindir}/rcdhcpd
+ln -sf %{_sysconfdir}/init.d/dhcpd6 $RPM_BUILD_ROOT%{_sbindir}/rcdhcpd6
+ln -sf %{_sysconfdir}/init.d/dhcrelay $RPM_BUILD_ROOT%{_sbindir}/rcdhcrelay
+ln -sf %{_sysconfdir}/init.d/dhcrelay6 $RPM_BUILD_ROOT%{_sbindir}/rcdhcrelay6
+%endif
# sysconfig files
install -m0644 $RPM_SOURCE_DIR/sysconfig.dhcpd \
$RPM_BUILD_ROOT%{_localstatedir}/adm/fillup-templates/
@@ -388,14 +433,13 @@
# fix manual page permissions
find $RPM_BUILD_ROOT/%{_mandir} -type f | xargs chmod 644
# copy some documentation and examples from src dir
-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/dhcp.README README.SUSE
install -m0644 $RPM_SOURCE_DIR/DDNS-howto.txt .
cp doc/examples/* ./examples/
rm -f doc/{References.xml,Makefile*}
rm -f contrib/dhcp.spec
rm -f $RPM_BUILD_ROOT/etc/{dhcpd,dhclient}.conf.example
+find contrib doc/examples -type f | xargs chmod -x
# install bind libs+includes needed for dhcp-devel
pushd bind
install -d -m0755 $RPM_BUILD_ROOT%_includedir/
@@ -412,9 +456,16 @@
/usr/sbin/useradd -r -g nogroup -s /bin/false -c "DHCP server daemon" -d /var/lib/dhcp dhcpd 2> /dev/null ||:
%post server
+%if %{with systemd}
+%{fillup_only -ans dhcpd dhcpd}
+%{fillup_only -ans syslog dhcpd}
+%service_add_post dhcpd.service
+%service_add_post dhcpd6.service
+%else
%{fillup_and_insserv -n dhcpd dhcpd dhcpd6}
%{fillup_only -ans syslog dhcpd}
-# update?
+%endif
+# FIXME: update?
if [ ${FIRST_ARG:-0} -gt 1 ]; then
if grep -q '^DHCPD_RUN_AS=.*nobody' etc/sysconfig/dhcpd; then
tmpfile=$(mktemp -q etc/sysconfig/dhcpd.XXXXXX)
@@ -431,29 +482,73 @@
fi
%preun server
-%stop_on_removal dhcpd
-%stop_on_removal dhcpd6
+%if %{with systemd}
+%service_del_preun dhcpd.service
+%service_del_preun dhcpd6.service
+%else
+if test -x /etc/init.d/dhcpd ; then
+ %stop_on_removal dhcpd
+fi
+if test -x /etc/init.d/dhcpd6 ; then
+ %stop_on_removal dhcpd6
+fi
+%endif
%postun server
-%restart_on_update dhcpd
-%restart_on_update dhcpd6
+%if %{with systemd}
+%service_del_postun dhcpd.service
+%service_del_postun dhcpd6.service
+%else
+if test -x /etc/init.d/dhcpd ; then
+ %restart_on_update dhcpd
+fi
+if test -x /etc/init.d/dhcpd6 ; then
+ %restart_on_update dhcpd6
+fi
%insserv_cleanup
+%endif
%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}
+#
+%if %{with systemd}
+%{fillup_only -n dhcrelay dhcrelay}
+%service_add_post dhcrelay.service
+%service_add_post dhcrelay6.service
+%else
%{fillup_and_insserv -n dhcrelay dhcrelay dhcrelay6}
+%endif
%preun relay
-%stop_on_removal dhcrelay
-%stop_on_removal dhcrelay6
+%if %{with systemd}
+%service_del_preun dhcrelay.service
+%service_del_preun dhcrelay6.service
+%else
+if test -x /etc/init.d/dhcrelay ; then
+ %stop_on_removal dhcrelay
+fi
+if test -x /etc/init.d/dhcrelay6 ; then
+ %stop_on_removal dhcrelay6
+fi
+%endif
%postun relay
-%restart_on_update dhcrelay
-%restart_on_update dhcrelay6
+%if %{with systemd}
+%service_del_postun dhcrelay.service
+%service_del_postun dhcrelay6.service
+%else
+if test -x /etc/init.d/dhcrelay ; then
+ %restart_on_update dhcrelay
+fi
+if test -x /etc/init.d/dhcrelay6 ; then
+ %restart_on_update dhcrelay6
+fi
%insserv_cleanup
+%endif
%post client
test -e %{_localstatedir}/lib/dhcp/dhclient.leases || \
@@ -479,12 +574,19 @@
%{_sbindir}/dhcpd6
%{_sbindir}/rcdhcpd
%{_sbindir}/rcdhcpd6
+%if %{with systemd}
+%{_unitdir}/dhcpd.service
+%{_unitdir}/dhcpd6.service
+%else
%config %{_sysconfdir}/init.d/dhcpd
%config %{_sysconfdir}/init.d/dhcpd6
+%endif
%config(noreplace) %{_sysconfdir}/dhcpd.conf
%config(noreplace) %{_sysconfdir}/dhcpd6.conf
%attr(755,root,root) %dir %config(noreplace) %ghost %{_sysconfdir}/dhcpd.d/
%attr(755,root,root) %dir %config(noreplace) %ghost %{_sysconfdir}/dhcpd6.d/
+%dir /usr/lib/dhcp
+/usr/lib/dhcp/dhcpd
%dir %{_localstatedir}/lib/dhcp
%dir %{_localstatedir}/lib/dhcp/etc
%dir %{_localstatedir}/lib/dhcp/dev
@@ -519,8 +621,7 @@
%defattr(-,root,root)
%endif
%doc LICENSE README RELNOTES
-%doc LIESMICH.* README.*
-%doc DDNS-howto.txt doc/*
+%doc README.* DDNS-howto.txt doc/*
%doc contrib examples
%files client
@@ -543,8 +644,15 @@
%{_sbindir}/dhcrelay6
%{_sbindir}/rcdhcrelay
%{_sbindir}/rcdhcrelay6
+%dir /usr/lib/dhcp
+/usr/lib/dhcp/dhcrelay
+%if %{with systemd}
+%{_unitdir}/dhcrelay.service
+%{_unitdir}/dhcrelay6.service
+%else
%config %{_sysconfdir}/init.d/dhcrelay
%config %{_sysconfdir}/init.d/dhcrelay6
+%endif
%doc %{_mandir}/man8/dhcrelay.8.gz
%{_localstatedir}/adm/fillup-templates/sysconfig.dhcrelay
++++++ 0001-dhcp-4.1.1-default-paths.patch ++++++
From b6ba495cc0b6f578a5cc444af39cab424f63d996 Mon Sep 17 00:00:00 2001
From: Marius Tomaschewski
Date: Thu, 18 Aug 2011 09:50:30 +0200
Subject: [PATCH] dhcp-4.1.1-default-paths
---
includes/dhcpd.h | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/includes/dhcpd.h b/includes/dhcpd.h
index b0f73fb..5830bdb 100644
--- a/includes/dhcpd.h
+++ b/includes/dhcpd.h
@@ -1420,11 +1420,11 @@ typedef unsigned char option_mask [16];
#endif /* DEBUG */
#ifndef _PATH_DHCPD_DB
-#define _PATH_DHCPD_DB LOCALSTATEDIR"/db/dhcpd.leases"
+#define _PATH_DHCPD_DB LOCALSTATEDIR"/lib/dhcp/db/dhcpd.leases"
#endif
#ifndef _PATH_DHCPD6_DB
-#define _PATH_DHCPD6_DB LOCALSTATEDIR"/db/dhcpd6.leases"
+#define _PATH_DHCPD6_DB LOCALSTATEDIR"/lib/dhcp6/db/dhcpd6.leases"
#endif
#ifndef _PATH_DHCPD_PID
@@ -1454,11 +1454,11 @@ typedef unsigned char option_mask [16];
#endif
#ifndef _PATH_DHCLIENT_DB
-#define _PATH_DHCLIENT_DB LOCALSTATEDIR"/db/dhclient.leases"
+#define _PATH_DHCLIENT_DB LOCALSTATEDIR"/lib/dhcp/dhclient.leases"
#endif
#ifndef _PATH_DHCLIENT6_DB
-#define _PATH_DHCLIENT6_DB LOCALSTATEDIR"/db/dhclient6.leases"
+#define _PATH_DHCLIENT6_DB LOCALSTATEDIR"/lib/dhcp6/dhclient6.leases"
#endif
#ifndef _PATH_RESOLV_CONF
--
1.8.4
++++++ 0002-dhcp-4.1.1-paranoia.patch ++++++
From 1561b8cb9bacabc5e6064b84ba7a187bfb97d0ad Mon Sep 17 00:00:00 2001
From: Marius Tomaschewski
Date: Thu, 18 Aug 2011 09:53:00 +0200
Subject: [PATCH] dhcp-4.1.1-paranoia
---
server/dhcpd.c | 24 ++++++++++++++++++++----
1 file changed, 20 insertions(+), 4 deletions(-)
diff --git a/server/dhcpd.c b/server/dhcpd.c
index 7dc7dd2..b4c1bef 100644
--- a/server/dhcpd.c
+++ b/server/dhcpd.c
@@ -207,7 +207,11 @@ static void omapi_listener_start (void *foo)
#if defined (PARANOIA)
/* to be used in one of two possible scenarios */
static void setup_chroot (char *chroot_dir) {
- if (geteuid())
+ /*
+ ** getuid() instead of geteuid(), see
+ ** comment by thomas@suse.de bellow
+ */
+ if (getuid())
log_fatal ("you must be root to use chroot");
if (chroot(chroot_dir)) {
@@ -413,7 +417,7 @@ main(int argc, char **argv) {
log_fatal ("Insufficient memory to %s %s: %s",
"record interface", argv [i],
isc_result_totext (result));
- strcpy (tmp -> name, argv [i]);
+ strncpy (tmp -> name, argv [i], sizeof(tmp->name)-1);
if (interfaces) {
interface_reference (&tmp -> next,
interfaces, MDL);
@@ -499,7 +503,15 @@ main(int argc, char **argv) {
if (set_user) {
struct passwd *tmp_pwd;
- if (geteuid())
+ /*
+ ** I query for the real UID and not for the effective UID
+ ** just to force the user to run this server as root and
+ ** not setting it suid. It should be a paranoia patch and
+ ** not a teletubbie patch. *eg*
+ ** Note: That the user is still able to set it suid! *zitter*
+ ** thomas@suse.de
+ */
+ if (getuid())
log_fatal ("you must be root to set user");
if (!(tmp_pwd = getpwnam(set_user)))
@@ -517,7 +529,10 @@ main(int argc, char **argv) {
#define group real_group
struct group *tmp_grp;
- if (geteuid())
+ /*
+ ** getuid() instead of geteuid(), see above
+ */
+ if (getuid())
log_fatal ("you must be root to set group");
if (!(tmp_grp = getgrnam(set_group)))
@@ -771,6 +786,7 @@ main(int argc, char **argv) {
/* change uid to the specified one */
if (set_gid) {
+ /* setgroups is done, OK */
if (setgroups (0, (void *)0))
log_fatal ("setgroups: %m");
if (setgid (set_gid))
--
1.8.4
++++++ 0003-dhcp-4.2.2-man-includes.patch ++++++
From 3c393c65c158048f55017e48aedcc304c9ebd075 Mon Sep 17 00:00:00 2001
From: Marius Tomaschewski
Date: Thu, 18 Aug 2011 10:01:04 +0200
Subject: [PATCH] dhcp-4.2.2-man-includes
---
dhcpctl/dhcpctl.3 | 4 ++--
omapip/omapi.3 | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/dhcpctl/dhcpctl.3 b/dhcpctl/dhcpctl.3
index ae42a71..d699f4a 100644
--- a/dhcpctl/dhcpctl.3
+++ b/dhcpctl/dhcpctl.3
@@ -430,8 +430,8 @@ that most error checking has been omitted for brevity.
#include
#include
-#include "omapip/result.h"
-#include "dhcpctl.h"
+#include
+#include
int main (int argc, char **argv) {
dhcpctl_data_string ipaddrstring = NULL;
diff --git a/omapip/omapi.3 b/omapip/omapi.3
index 8fa8105..a616fd3 100644
--- a/omapip/omapi.3
+++ b/omapip/omapi.3
@@ -88,7 +88,7 @@ the lease ends.
#include
#include
- #include
+ #include
#include
int main (int argc, char **argv) {
--
1.8.4
++++++ 0004-dhcp-4.1.1-tmpfile.patch ++++++
From 1638d046d2a914164e19c6244df5b4deadaf6938 Mon Sep 17 00:00:00 2001
From: Marius Tomaschewski
Date: Thu, 18 Aug 2011 10:06:01 +0200
Subject: [PATCH] dhcp-4.1.1-tmpfile
---
server/db.c | 17 ++++++-----------
1 file changed, 6 insertions(+), 11 deletions(-)
diff --git a/server/db.c b/server/db.c
index 82f3841..c2630ea 100644
--- a/server/db.c
+++ b/server/db.c
@@ -1088,21 +1088,16 @@ int new_lease_file ()
db_validity = lease_file_is_corrupt;
- /* %Audit% Truncated filename causes panic. %2004.06.17,Safe%
- * This should never happen since the path is a configuration
- * variable from build-time or command-line. But if it should,
- * either by malice or ignorance, we panic, since the potential
- * for havoc is high.
- */
- if (snprintf (newfname, sizeof newfname, "%s.%d",
- path_dhcpd_db, (int)t) >= sizeof newfname)
- log_fatal("new_lease_file: lease file path too long");
-
- db_fd = open (newfname, O_WRONLY | O_TRUNC | O_CREAT, 0664);
+ snprintf (newfname, sizeof(newfname), "%s.XXXXXX", path_dhcpd_db);
+ db_fd = mkstemp (newfname);
if (db_fd < 0) {
log_error ("Can't create new lease file: %m");
return 0;
}
+ if (fchmod(db_fd, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH) == -1) {
+ log_error ("Can't fchmod new lease file: %m");
+ goto fail;
+ }
if ((new_db_file = fdopen(db_fd, "w")) == NULL) {
log_error("Can't fdopen new lease file: %m");
close(db_fd);
--
1.8.4
++++++ 0005-dhcp-4.1.1-dhclient-exec-filedes.patch ++++++
From 92a611b4b05ef420e81c2c78f8c1eb3b38c31627 Mon Sep 17 00:00:00 2001
From: Marius Tomaschewski
Date: Thu, 18 Aug 2011 10:28:04 +0200
Subject: [PATCH] dhcp-4.1.1-dhclient-exec-filedes
---
client/dhclient.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/client/dhclient.c b/client/dhclient.c
index 52121be..203d3d1 100644
--- a/client/dhclient.c
+++ b/client/dhclient.c
@@ -3369,6 +3369,12 @@ int script_go (client)
*/
if (leaseFile != NULL)
fclose(leaseFile);
+ if ((i = open("/dev/null", O_RDWR)) != -1) {
+ dup2(i, STDIN_FILENO);
+ dup2(i, STDOUT_FILENO);
+ if (i > STDERR_FILENO)
+ close(i);
+ }
execve (scriptName, argv, envp);
log_error ("execve (%s, ...): %m", scriptName);
exit (0);
--
1.8.4
++++++ 0006-dhcp-4.2.5-dhclient-send-hostname-rml.patch ++++++
From 94cff63e89710f5e67944d57d76edaec968fe139 Mon Sep 17 00:00:00 2001
From: Marius Tomaschewski
Date: Thu, 18 Aug 2011 10:49:07 +0200
Subject: [PATCH] dhcp-4.2.5-dhclient-send-hostname-rml
---
client/dhclient.8 | 8 ++++++++
client/dhclient.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++--
2 files changed, 56 insertions(+), 2 deletions(-)
diff --git a/client/dhclient.8 b/client/dhclient.8
index 0aa1119..bc34c6a 100644
--- a/client/dhclient.8
+++ b/client/dhclient.8
@@ -60,6 +60,10 @@ dhclient - Dynamic Host Configuration Protocol Client
.I LL|LLT
]
[
+.B -H
+.I hostname
+]
+[
.B -p
.I port-number
]
@@ -316,6 +320,10 @@ transmits these messages to 255.255.255.255 (the IP limited broadcast
address). Overriding this is mostly useful for debugging purposes. This
feature is not supported in DHCPv6 (\fB-6\fR) mode.
.TP
+.BI \-H \ hostname
+This flag may be used to specify a client hostname that should be sent to
+the DHCP server. Note, that this option is a SUSE/Novell extension.
+.TP
.BI \-g \ relay
.\" mockup relay
Set the giaddr field of all packets to the \fIrelay\fR IP address
diff --git a/client/dhclient.c b/client/dhclient.c
index 203d3d1..b7a14fe 100644
--- a/client/dhclient.c
+++ b/client/dhclient.c
@@ -119,6 +119,7 @@ main(int argc, char **argv) {
int no_dhclient_db = 0;
int no_dhclient_pid = 0;
int no_dhclient_script = 0;
+ char *dhclient_hostname = NULL;
#ifdef DHCPv6
int local_family_set = 0;
#endif /* DHCPv6 */
@@ -231,6 +232,22 @@ main(int argc, char **argv) {
if (++i == argc)
usage();
mockup_relay = argv[i];
+ } else if (!strcmp (argv[i], "-H")) {
+ size_t len;
+ if (++i == argc || !argv[i] || *(argv[i]) == '\0')
+ usage ();
+ len = strlen (argv[i]);
+ if (len > HOST_NAME_MAX) {
+ log_error("-H option host-name string \"%s\" is too long:"
+ "maximum length is %d characters",
+ argv[i], HOST_NAME_MAX);
+ exit(1);
+ } else if(check_domain_name(argv[i], len, 0) != 0) {
+ log_error("suspect host-name in -H \"%s\"",
+ argv[i]);
+ exit(1);
+ }
+ dhclient_hostname = argv [i];
} else if (!strcmp(argv[i], "-nw")) {
nowait = 1;
} else if (!strcmp(argv[i], "-n")) {
@@ -491,6 +508,35 @@ main(int argc, char **argv) {
/* Parse the dhclient.conf file. */
read_client_conf();
+ /* If the user specified a hostname, send it here and now */
+ if ((dhclient_hostname != NULL) && (*dhclient_hostname != '\0') ) {
+ struct parse *cfile = NULL;
+ char buf[HOST_NAME_MAX + 40];
+ int len;
+
+ snprintf (buf, sizeof(buf), "send host-name \"%s\";",
+ dhclient_hostname);
+ len = strlen(buf);
+
+ status = new_parse (&cfile, -1, buf, len,
+ "host-name option", 0);
+ if (status != ISC_R_SUCCESS)
+ log_fatal ("Cannot parse send host-name statement!");
+
+ for (;;) {
+ const char *val = NULL;
+ int token;
+
+ token = peek_token (&val, (unsigned *)0, cfile);
+ if (token == END_OF_FILE)
+ break;
+
+ parse_client_statement (cfile, NULL,
+ &top_level_config);
+ }
+ end_parse (&cfile);
+ }
+
/* Parse the lease database. */
read_client_leases();
@@ -719,9 +765,9 @@ static void usage()
log_fatal("Usage: dhclient "
#ifdef DHCPv6
- "[-4|-6] [-SNTP1dvrx] [-nw] [-p <port>] [-D LL|LLT]\n"
+ "[-4|-6] [-SNTP1dvrx] [-nw] [-H <hostname>] [-p <port>] [-D LL|LLT]\n"
#else /* DHCPv6 */
- "[-1dvrx] [-nw] [-p <port>]\n"
+ "[-1dvrx] [-nw] [-H <hostname>] [-p <port>]\n"
#endif /* DHCPv6 */
" [-s server-addr] [-cf config-file] "
"[-lf lease-file]\n"
--
1.8.4
++++++ 0007-dhcp-4.2.6-ldap-mt01.patch ++++++
++++ 2235 lines (skipped)
++++++ 0008-dhcp-4.1.1-P1-lpf-bind-msg-fix.patch ++++++
From a9d31f9f8356fba3fc49ead5afdfd8cca5a4a535 Mon Sep 17 00:00:00 2001
From: Marius Tomaschewski
Date: Tue, 12 Jun 2012 08:54:23 +0200
Subject: [PATCH] dhcp-4.1.1-P1-lpf-bind-msg-fix
---
common/lpf.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/common/lpf.c b/common/lpf.c
index 44f5f54..82c8b76 100644
--- a/common/lpf.c
+++ b/common/lpf.c
@@ -94,7 +94,7 @@ int if_register_lpf (info)
if (errno == ENOPROTOOPT || errno == EPROTONOSUPPORT ||
errno == ESOCKTNOSUPPORT || errno == EPFNOSUPPORT ||
errno == EAFNOSUPPORT || errno == EINVAL) {
- log_error ("socket: %m - make sure");
+ log_error ("bind: %m - make sure");
log_error ("CONFIG_PACKET (Packet socket) %s",
"and CONFIG_FILTER");
log_error ("(Socket Filtering) are enabled %s",
--
1.8.4
++++++ 0009-dhcp-4.2.6-xen-checksum.patch ++++++
From 16e50fd8fbd606ba04ac814f9fff883ecb9e110c Mon Sep 17 00:00:00 2001
From: Marius Tomaschewski
Date: Fri, 18 Feb 2011 13:18:32 +0100
Subject: [PATCH] dhcp-4.2.6-xen-checksum
---
common/bpf.c | 2 +-
common/dlpi.c | 2 +-
common/lpf.c | 84 ++++++++++++++++++++++++++++++++++++++++++--------------
common/nit.c | 2 +-
common/packet.c | 4 +--
common/upf.c | 2 +-
includes/dhcpd.h | 2 +-
7 files changed, 70 insertions(+), 28 deletions(-)
diff --git a/common/bpf.c b/common/bpf.c
index d6d6013..559b414 100644
--- a/common/bpf.c
+++ b/common/bpf.c
@@ -480,7 +480,7 @@ ssize_t receive_packet (interface, buf, len, from, hfrom)
/* Decode the IP and UDP headers... */
offset = decode_udp_ip_header(interface, interface->rbuf,
interface->rbuf_offset,
- from, hdr.bh_caplen, &paylen);
+ from, hdr.bh_caplen, &paylen, 0);
/* If the IP or UDP checksum was bad, skip the packet... */
if (offset < 0) {
diff --git a/common/dlpi.c b/common/dlpi.c
index 391fb91..14e95d2 100644
--- a/common/dlpi.c
+++ b/common/dlpi.c
@@ -691,7 +691,7 @@ ssize_t receive_packet (interface, buf, len, from, hfrom)
length -= offset;
#endif
offset = decode_udp_ip_header (interface, dbuf, bufix,
- from, length, &paylen);
+ from, length, &paylen, 0);
/*
* If the IP or UDP checksum was bad, skip the packet...
diff --git a/common/lpf.c b/common/lpf.c
index 82c8b76..6639809 100644
--- a/common/lpf.c
+++ b/common/lpf.c
@@ -30,19 +30,33 @@
#include "dhcpd.h"
#if defined (USE_LPF_SEND) || defined (USE_LPF_RECEIVE)
#include
+#include
#include
#include
#include
#include
#include
+#include
#include
-#include
#include "includes/netinet/ip.h"
#include "includes/netinet/udp.h"
#include "includes/netinet/if_ether.h"
#include
+#ifndef PACKET_AUXDATA
+#define PACKET_AUXDATA 8
+
+struct tpacket_auxdata
+{
+ __u32 tp_status;
+ __u32 tp_len;
+ __u32 tp_snaplen;
+ __u16 tp_mac;
+ __u16 tp_net;
+};
+#endif
+
/* Reinitializes the specified interface after an address change. This
is not required for packet-filter APIs. */
@@ -68,10 +82,14 @@ int if_register_lpf (info)
struct interface_info *info;
{
int sock;
- struct sockaddr sa;
+ union {
+ struct sockaddr_ll ll;
+ struct sockaddr common;
+ } sa;
+ struct ifreq ifr;
/* Make an LPF socket. */
- if ((sock = socket(PF_PACKET, SOCK_PACKET,
+ if ((sock = socket(PF_PACKET, SOCK_RAW,
htons((short)ETH_P_ALL))) < 0) {
if (errno == ENOPROTOOPT || errno == EPROTONOSUPPORT ||
errno == ESOCKTNOSUPPORT || errno == EPFNOSUPPORT ||
@@ -86,11 +104,16 @@ int if_register_lpf (info)
log_fatal ("Open a socket for LPF: %m");
}
+ memset (&ifr, 0, sizeof ifr);
+ strncpy (ifr.ifr_name, (const char *)info -> ifp, sizeof ifr.ifr_name);
+ if (ioctl (sock, SIOCGIFINDEX, &ifr))
+ log_fatal ("Failed to get interface index: %m");
+
/* Bind to the interface name */
memset (&sa, 0, sizeof sa);
- sa.sa_family = AF_PACKET;
- strncpy (sa.sa_data, (const char *)info -> ifp, sizeof sa.sa_data);
- if (bind (sock, &sa, sizeof sa)) {
+ sa.ll.sll_family = AF_PACKET;
+ sa.ll.sll_ifindex = ifr.ifr_ifindex;
+ if (bind (sock, &sa.common, sizeof sa)) {
if (errno == ENOPROTOOPT || errno == EPROTONOSUPPORT ||
errno == ESOCKTNOSUPPORT || errno == EPFNOSUPPORT ||
errno == EAFNOSUPPORT || errno == EINVAL) {
@@ -172,9 +195,18 @@ static void lpf_gen_filter_setup (struct interface_info *);
void if_register_receive (info)
struct interface_info *info;
{
+ int val;
+
/* Open a LPF device and hang it on this interface... */
info -> rfdesc = if_register_lpf (info);
+ val = 1;
+ if (setsockopt (info -> rfdesc, SOL_PACKET, PACKET_AUXDATA, &val,
+ sizeof val) < 0) {
+ if (errno != ENOPROTOOPT)
+ log_fatal ("Failed to set auxiliary packet data: %m");
+ }
+
#if defined (HAVE_TR_SUPPORT)
if (info -> hw_address.hbuf [0] == HTYPE_IEEE802)
lpf_tr_filter_setup (info);
@@ -296,7 +328,6 @@ ssize_t send_packet (interface, packet, raw, len, from, to, hto)
double hh [16];
double ih [1536 / sizeof (double)];
unsigned char *buf = (unsigned char *)ih;
- struct sockaddr_pkt sa;
int result;
int fudge;
@@ -317,17 +348,7 @@ ssize_t send_packet (interface, packet, raw, len, from, to, hto)
(unsigned char *)raw, len);
memcpy (buf + ibufp, raw, len);
- /* For some reason, SOCK_PACKET sockets can't be connected,
- so we have to do a sentdo every time. */
- memset (&sa, 0, sizeof sa);
- sa.spkt_family = AF_PACKET;
- strncpy ((char *)sa.spkt_device,
- (const char *)interface -> ifp, sizeof sa.spkt_device);
- sa.spkt_protocol = htons(ETH_P_IP);
-
- result = sendto (interface -> wfdesc,
- buf + fudge, ibufp + len - fudge, 0,
- (const struct sockaddr *)&sa, sizeof sa);
+ result = write (interface -> wfdesc, buf + fudge, ibufp + len - fudge);
if (result < 0)
log_error ("send_packet: %m");
return result;
@@ -344,14 +365,35 @@ ssize_t receive_packet (interface, buf, len, from, hfrom)
{
int length = 0;
int offset = 0;
+ int nocsum = 0;
unsigned char ibuf [1536];
unsigned bufix = 0;
unsigned paylen;
-
- length = read (interface -> rfdesc, ibuf, sizeof ibuf);
+ unsigned char cmsgbuf[CMSG_LEN(sizeof(struct tpacket_auxdata))];
+ struct iovec iov = {
+ .iov_base = ibuf,
+ .iov_len = sizeof ibuf,
+ };
+ struct msghdr msg = {
+ .msg_iov = &iov,
+ .msg_iovlen = 1,
+ .msg_control = cmsgbuf,
+ .msg_controllen = sizeof(cmsgbuf),
+ };
+ struct cmsghdr *cmsg;
+
+ length = recvmsg (interface -> rfdesc, &msg, 0);
if (length <= 0)
return length;
+ for (cmsg = CMSG_FIRSTHDR(&msg); cmsg; cmsg = CMSG_NXTHDR(&msg, cmsg)) {
+ if (cmsg->cmsg_level == SOL_PACKET &&
+ cmsg->cmsg_type == PACKET_AUXDATA) {
+ struct tpacket_auxdata *aux = (void *)CMSG_DATA(cmsg);
+ nocsum = aux->tp_status & TP_STATUS_CSUMNOTREADY;
+ }
+ }
+
bufix = 0;
/* Decode the physical header... */
offset = decode_hw_header (interface, ibuf, bufix, hfrom);
@@ -368,7 +410,7 @@ ssize_t receive_packet (interface, buf, len, from, hfrom)
/* Decode the IP and UDP headers... */
offset = decode_udp_ip_header (interface, ibuf, bufix, from,
- (unsigned)length, &paylen);
+ (unsigned)length, &paylen, nocsum);
/* If the IP or UDP checksum was bad, skip the packet... */
if (offset < 0)
diff --git a/common/nit.c b/common/nit.c
index a43bcf3..3fdef1d 100644
--- a/common/nit.c
+++ b/common/nit.c
@@ -363,7 +363,7 @@ ssize_t receive_packet (interface, buf, len, from, hfrom)
/* Decode the IP and UDP headers... */
offset = decode_udp_ip_header (interface, ibuf, bufix,
- from, length, &paylen);
+ from, length, &paylen, 0);
/* If the IP or UDP checksum was bad, skip the packet... */
if (offset < 0)
diff --git a/common/packet.c b/common/packet.c
index 45e96e8..73e786d 100644
--- a/common/packet.c
+++ b/common/packet.c
@@ -226,7 +226,7 @@ ssize_t
decode_udp_ip_header(struct interface_info *interface,
unsigned char *buf, unsigned bufix,
struct sockaddr_in *from, unsigned buflen,
- unsigned *rbuflen)
+ unsigned *rbuflen, int nocsum)
{
unsigned char *data;
struct ip ip;
@@ -337,7 +337,7 @@ decode_udp_ip_header(struct interface_info *interface,
8, IPPROTO_UDP + ulen))));
udp_packets_seen++;
- if (usum && usum != sum) {
+ if (!nocsum && usum && usum != sum) {
udp_packets_bad_checksum++;
if (udp_packets_seen > 4 &&
(udp_packets_seen / udp_packets_bad_checksum) < 2) {
diff --git a/common/upf.c b/common/upf.c
index de2129e..6a02077 100644
--- a/common/upf.c
+++ b/common/upf.c
@@ -314,7 +314,7 @@ ssize_t receive_packet (interface, buf, len, from, hfrom)
/* Decode the IP and UDP headers... */
offset = decode_udp_ip_header (interface, ibuf, bufix,
- from, length, &paylen);
+ from, length, &paylen, 0);
/* If the IP or UDP checksum was bad, skip the packet... */
if (offset < 0)
diff --git a/includes/dhcpd.h b/includes/dhcpd.h
index 63d58e5..68262e9 100644
--- a/includes/dhcpd.h
+++ b/includes/dhcpd.h
@@ -2788,7 +2788,7 @@ ssize_t decode_hw_header (struct interface_info *, unsigned char *,
unsigned, struct hardware *);
ssize_t decode_udp_ip_header (struct interface_info *, unsigned char *,
unsigned, struct sockaddr_in *,
- unsigned, unsigned *);
+ unsigned, unsigned *, int);
/* ethernet.c */
void assemble_ethernet_header (struct interface_info *, unsigned char *,
--
1.8.4
++++++ 0010-dhcp-4.2.2-dhclient-option-checks.patch ++++++
From 48c1bbb9cbd6d6e71178e82fd45a7409efbb9d72 Mon Sep 17 00:00:00 2001
From: Marius Tomaschewski
Date: Wed, 27 Apr 2011 13:56:47 +0200
Subject: [PATCH] dhcp-4.2.2-dhclient-option-checks
---
client/dhclient.c | 6 +++---
common/options.c | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/client/dhclient.c b/client/dhclient.c
index b7a14fe..19a527b 100644
--- a/client/dhclient.c
+++ b/client/dhclient.c
@@ -3301,7 +3301,7 @@ void script_write_params (client, prefix, lease)
} else {
log_error("suspect value in %s "
"option - discarded",
- lease->filename);
+ "filename");
}
}
@@ -3314,7 +3314,7 @@ void script_write_params (client, prefix, lease)
} else {
log_error("suspect value in %s "
"option - discarded",
- lease->server_name);
+ "server-name");
}
}
@@ -4283,7 +4283,7 @@ static int check_domain_name(const char *ptr, size_t len, int dots)
const char *p;
/* not empty or complete length not over 255 characters */
- if ((len == 0) || (len > 256))
+ if ((len == 0) || (len >= 256))
return(-1);
/* consists of [[:alnum:]-]+ labels separated by [.] */
diff --git a/common/options.c b/common/options.c
index 56bb151..be44a70 100644
--- a/common/options.c
+++ b/common/options.c
@@ -3979,7 +3979,7 @@ pretty_escape(char **dst, char *dend, const unsigned char **src,
}
} else if (**src == '"' || **src == '\'' || **src == '$' ||
**src == '`' || **src == '\\' || **src == '|' ||
- **src == '&') {
+ **src == '&' || **src == ';') {
if (*dst + 2 > dend)
return -1;
--
1.8.4
++++++ 0011-dhcp-4.2.6-close-on-exec.patch ++++++
From 0ae45af28ebda5770465f84ac0f69f28ed6b7b07 Mon Sep 17 00:00:00 2001
From: Marius Tomaschewski
Date: Thu, 18 Aug 2011 14:09:06 +0200
Subject: [PATCH] dhcp-4.2.6-close-on-exec
---
client/clparse.c | 4 ++--
client/dhclient.c | 10 +++++-----
common/bpf.c | 2 +-
common/discover.c | 4 ++--
common/dlpi.c | 2 +-
common/nit.c | 2 +-
common/resolv.c | 2 +-
common/upf.c | 2 +-
dst/dst_api.c | 8 ++++----
dst/prandom.c | 4 ++--
omapip/trace.c | 6 +++---
relay/dhcrelay.c | 5 +++--
server/confpars.c | 2 +-
server/db.c | 6 +++---
server/dhcpd.c | 4 ++--
server/ldap.c | 2 +-
16 files changed, 33 insertions(+), 32 deletions(-)
diff --git a/client/clparse.c b/client/clparse.c
index 646229f..3e9f9b1 100644
--- a/client/clparse.c
+++ b/client/clparse.c
@@ -221,7 +221,7 @@ int read_client_conf_file (const char *name, struct interface_info *ip,
int token;
isc_result_t status;
- if ((file = open (name, O_RDONLY)) < 0)
+ if ((file = open (name, O_RDONLY | O_CLOEXEC)) < 0)
return uerr2isc (errno);
cfile = NULL;
@@ -258,7 +258,7 @@ void read_client_leases ()
/* Open the lease file. If we can't open it, just return -
we can safely trust the server to remember our state. */
- if ((file = open (path_dhclient_db, O_RDONLY)) < 0)
+ if ((file = open (path_dhclient_db, O_RDONLY | O_CLOEXEC)) < 0)
return;
cfile = NULL;
diff --git a/client/dhclient.c b/client/dhclient.c
index 19a527b..dbc6f38 100644
--- a/client/dhclient.c
+++ b/client/dhclient.c
@@ -422,7 +422,7 @@ main(int argc, char **argv) {
long temp;
int e;
- if ((pidfd = fopen(path_dhclient_pid, "r")) != NULL) {
+ if ((pidfd = fopen(path_dhclient_pid, "re")) != NULL) {
e = fscanf(pidfd, "%ld\n", &temp);
oldpid = (pid_t)temp;
@@ -2728,7 +2728,7 @@ void rewrite_client_leases ()
if (leaseFile != NULL)
fclose (leaseFile);
- leaseFile = fopen (path_dhclient_db, "w");
+ leaseFile = fopen (path_dhclient_db, "we");
if (leaseFile == NULL) {
log_error ("can't create %s: %m", path_dhclient_db);
return;
@@ -2849,7 +2849,7 @@ write_duid(struct data_string *duid)
return DHCP_R_INVALIDARG;
if (leaseFile == NULL) { /* XXX? */
- leaseFile = fopen(path_dhclient_db, "w");
+ leaseFile = fopen(path_dhclient_db, "we");
if (leaseFile == NULL) {
log_error("can't create %s: %m", path_dhclient_db);
return ISC_R_IOERROR;
@@ -2897,7 +2897,7 @@ write_client6_lease(struct client_state *client, struct dhc6_lease *lease,
return DHCP_R_INVALIDARG;
if (leaseFile == NULL) { /* XXX? */
- leaseFile = fopen(path_dhclient_db, "w");
+ leaseFile = fopen(path_dhclient_db, "we");
if (leaseFile == NULL) {
log_error("can't create %s: %m", path_dhclient_db);
return ISC_R_IOERROR;
@@ -3029,7 +3029,7 @@ int write_client_lease (client, lease, rewrite, makesure)
return 1;
if (leaseFile == NULL) { /* XXX */
- leaseFile = fopen (path_dhclient_db, "w");
+ leaseFile = fopen (path_dhclient_db, "we");
if (leaseFile == NULL) {
log_error ("can't create %s: %m", path_dhclient_db);
return 0;
diff --git a/common/bpf.c b/common/bpf.c
index 559b414..076d9bc 100644
--- a/common/bpf.c
+++ b/common/bpf.c
@@ -94,7 +94,7 @@ int if_register_bpf (info)
for (b = 0; 1; b++) {
/* %Audit% 31 bytes max. %2004.06.17,Safe% */
sprintf(filename, BPF_FORMAT, b);
- sock = open (filename, O_RDWR, 0);
+ sock = open (filename, O_RDWR | O_CLOEXEC, 0);
if (sock < 0) {
if (errno == EBUSY) {
continue;
diff --git a/common/discover.c b/common/discover.c
index 4b40a70..6a0540b 100644
--- a/common/discover.c
+++ b/common/discover.c
@@ -412,7 +412,7 @@ begin_iface_scan(struct iface_conf_list *ifaces) {
int len;
int i;
- ifaces->fp = fopen("/proc/net/dev", "r");
+ ifaces->fp = fopen("/proc/net/dev", "re");
if (ifaces->fp == NULL) {
log_error("Error opening '/proc/net/dev' to list interfaces");
return 0;
@@ -447,7 +447,7 @@ begin_iface_scan(struct iface_conf_list *ifaces) {
#ifdef DHCPv6
if (local_family == AF_INET6) {
- ifaces->fp6 = fopen("/proc/net/if_inet6", "r");
+ ifaces->fp6 = fopen("/proc/net/if_inet6", "re");
if (ifaces->fp6 == NULL) {
log_error("Error opening '/proc/net/if_inet6' to "
"list IPv6 interfaces; %m");
diff --git a/common/dlpi.c b/common/dlpi.c
index 14e95d2..efaba3a 100644
--- a/common/dlpi.c
+++ b/common/dlpi.c
@@ -804,7 +804,7 @@ dlpiopen(const char *ifname) {
}
*dp = '\0';
- return open (devname, O_RDWR, 0);
+ return open (devname, O_RDWR | O_CLOEXEC, 0);
}
/*
diff --git a/common/nit.c b/common/nit.c
index 3fdef1d..dc62081 100644
--- a/common/nit.c
+++ b/common/nit.c
@@ -75,7 +75,7 @@ int if_register_nit (info)
struct strioctl sio;
/* Open a NIT device */
- sock = open ("/dev/nit", O_RDWR);
+ sock = open ("/dev/nit", O_RDWR | O_CLOEXEC);
if (sock < 0)
log_fatal ("Can't open NIT device for %s: %m", info -> name);
diff --git a/common/resolv.c b/common/resolv.c
index 526cebf..2ac8d43 100644
--- a/common/resolv.c
+++ b/common/resolv.c
@@ -44,7 +44,7 @@ void read_resolv_conf (parse_time)
struct domain_search_list *dp, *dl, *nd;
isc_result_t status;
- if ((file = open (path_resolv_conf, O_RDONLY)) < 0) {
+ if ((file = open (path_resolv_conf, O_RDONLY | O_CLOEXEC)) < 0) {
log_error ("Can't open %s: %m", path_resolv_conf);
return;
}
diff --git a/common/upf.c b/common/upf.c
index 6a02077..e5cafcf 100644
--- a/common/upf.c
+++ b/common/upf.c
@@ -71,7 +71,7 @@ int if_register_upf (info)
/* %Audit% Cannot exceed 36 bytes. %2004.06.17,Safe% */
sprintf(filename, "/dev/pf/pfilt%d", b);
- sock = open (filename, O_RDWR, 0);
+ sock = open (filename, O_RDWR | O_CLOEXEC, 0);
if (sock < 0) {
if (errno == EBUSY) {
continue;
diff --git a/dst/dst_api.c b/dst/dst_api.c
index 3993b1e..aadcc1f 100644
--- a/dst/dst_api.c
+++ b/dst/dst_api.c
@@ -437,7 +437,7 @@ dst_s_write_private_key(const DST_KEY *key)
PRIVATE_KEY, PATH_MAX);
/* Do not overwrite an existing file */
- if ((fp = dst_s_fopen(file, "w", 0600)) != NULL) {
+ if ((fp = dst_s_fopen(file, "we", 0600)) != NULL) {
int nn;
if ((nn = fwrite(encoded_block, 1, len, fp)) != len) {
EREPORT(("dst_write_private_key(): Write failure on %s %d != %d errno=%d\n",
@@ -495,7 +495,7 @@ dst_s_read_public_key(const char *in_name, const unsigned in_id, int in_alg)
* flags, proto, alg stored as decimal (or hex numbers FIXME).
* (FIXME: handle parentheses for line continuation.)
*/
- if ((fp = dst_s_fopen(name, "r", 0)) == NULL) {
+ if ((fp = dst_s_fopen(name, "re", 0)) == NULL) {
EREPORT(("dst_read_public_key(): Public Key not found %s\n",
name));
return (NULL);
@@ -621,7 +621,7 @@ dst_s_write_public_key(const DST_KEY *key)
return (0);
}
/* create public key file */
- if ((fp = dst_s_fopen(filename, "w+", 0644)) == NULL) {
+ if ((fp = dst_s_fopen(filename, "w+e", 0644)) == NULL) {
EREPORT(("DST_write_public_key: open of file:%s failed (errno=%d)\n",
filename, errno));
return (0);
@@ -855,7 +855,7 @@ dst_s_read_private_key_file(char *name, DST_KEY *pk_key, unsigned in_id,
return (0);
}
/* first check if we can find the key file */
- if ((fp = dst_s_fopen(filename, "r", 0)) == NULL) {
+ if ((fp = dst_s_fopen(filename, "re", 0)) == NULL) {
EREPORT(("dst_s_read_private_key_file: Could not open file %s in directory %s\n",
filename, dst_path[0] ? dst_path :
(char *) getcwd(NULL, PATH_MAX - 1)));
diff --git a/dst/prandom.c b/dst/prandom.c
index d207993..775cb23 100644
--- a/dst/prandom.c
+++ b/dst/prandom.c
@@ -270,7 +270,7 @@ get_dev_random(u_char *output, unsigned size)
s = stat("/dev/random", &st);
if (s == 0 && S_ISCHR(st.st_mode)) {
- if ((fd = open("/dev/random", O_RDONLY | O_NONBLOCK)) != -1) {
+ if ((fd = open("/dev/random", O_RDONLY | O_NONBLOCK | O_CLOEXEC)) != -1) {
if ((n = read(fd, output, size)) < 0)
n = 0;
close(fd);
@@ -480,7 +480,7 @@ digest_file(dst_work *work)
work->file_digest = dst_free_key(work->file_digest);
return (0);
}
- if ((fp = fopen(name, "r")) == NULL)
+ if ((fp = fopen(name, "re")) == NULL)
return (0);
for (no = 0; (i = fread(buf, sizeof(*buf), sizeof(buf), fp)) > 0;
no += i)
diff --git a/omapip/trace.c b/omapip/trace.c
index 23e4e50..846b42b 100644
--- a/omapip/trace.c
+++ b/omapip/trace.c
@@ -138,10 +138,10 @@ isc_result_t trace_begin (const char *filename,
return DHCP_R_INVALIDARG;
}
- traceoutfile = open (filename, O_CREAT | O_WRONLY | O_EXCL, 0600);
+ traceoutfile = open (filename, O_CREAT | O_WRONLY | O_EXCL | O_CLOEXEC, 0600);
if (traceoutfile < 0 && errno == EEXIST) {
log_error ("WARNING: Overwriting trace file \"%s\"", filename);
- traceoutfile = open (filename, O_WRONLY | O_EXCL | O_TRUNC,
+ traceoutfile = open (filename, O_WRONLY | O_EXCL | O_TRUNC | O_CLOEXEC,
0600);
}
@@ -429,7 +429,7 @@ void trace_file_replay (const char *filename)
isc_result_t result;
int len;
- traceinfile = fopen (filename, "r");
+ traceinfile = fopen (filename, "re");
if (!traceinfile) {
log_error("Can't open tracefile %s: %m", filename);
return;
diff --git a/relay/dhcrelay.c b/relay/dhcrelay.c
index 6f42927..4ef6737 100644
--- a/relay/dhcrelay.c
+++ b/relay/dhcrelay.c
@@ -539,13 +539,14 @@ main(int argc, char **argv) {
if (no_pid_file == ISC_FALSE) {
pfdesc = open(path_dhcrelay_pid,
- O_CREAT | O_TRUNC | O_WRONLY, 0644);
+ O_CREAT | O_TRUNC | O_WRONLY |
+ O_CLOEXEC, 0644);
if (pfdesc < 0) {
log_error("Can't create %s: %m",
path_dhcrelay_pid);
} else {
- pf = fdopen(pfdesc, "w");
+ pf = fdopen(pfdesc, "we");
if (!pf)
log_error("Can't fdopen %s: %m",
path_dhcrelay_pid);
diff --git a/server/confpars.c b/server/confpars.c
index 684f9c1..3b5a840 100644
--- a/server/confpars.c
+++ b/server/confpars.c
@@ -110,7 +110,7 @@ isc_result_t read_conf_file (const char *filename, struct group *group,
}
#endif
- if ((file = open (filename, O_RDONLY)) < 0) {
+ if ((file = open (filename, O_RDONLY | O_CLOEXEC)) < 0) {
if (leasep) {
log_error ("Can't open lease database %s: %m --",
path_dhcpd_db);
diff --git a/server/db.c b/server/db.c
index c2630ea..59e96dd 100644
--- a/server/db.c
+++ b/server/db.c
@@ -1050,7 +1050,7 @@ void db_startup (testp)
}
#endif
if (!testp) {
- db_file = fopen (path_dhcpd_db, "a");
+ db_file = fopen (path_dhcpd_db, "ae");
if (!db_file)
log_fatal ("Can't open %s for append.", path_dhcpd_db);
expire_all_pools ();
@@ -1089,7 +1089,7 @@ int new_lease_file ()
db_validity = lease_file_is_corrupt;
snprintf (newfname, sizeof(newfname), "%s.XXXXXX", path_dhcpd_db);
- db_fd = mkstemp (newfname);
+ db_fd = mkostemp (newfname, O_CLOEXEC);
if (db_fd < 0) {
log_error ("Can't create new lease file: %m");
return 0;
@@ -1098,7 +1098,7 @@ int new_lease_file ()
log_error ("Can't fchmod new lease file: %m");
goto fail;
}
- if ((new_db_file = fdopen(db_fd, "w")) == NULL) {
+ if ((new_db_file = fdopen(db_fd, "we")) == NULL) {
log_error("Can't fdopen new lease file: %m");
close(db_fd);
goto fdfail;
diff --git a/server/dhcpd.c b/server/dhcpd.c
index b4c1bef..41a9efe 100644
--- a/server/dhcpd.c
+++ b/server/dhcpd.c
@@ -805,7 +805,7 @@ main(int argc, char **argv) {
*/
if (no_pid_file == ISC_FALSE) {
/*Read previous pid file. */
- if ((i = open (path_dhcpd_pid, O_RDONLY)) >= 0) {
+ if ((i = open (path_dhcpd_pid, O_RDONLY | O_CLOEXEC)) >= 0) {
status = read(i, pbuf, (sizeof pbuf) - 1);
close (i);
if (status > 0) {
@@ -824,7 +824,7 @@ main(int argc, char **argv) {
}
/* Write new pid file. */
- i = open(path_dhcpd_pid, O_WRONLY|O_CREAT|O_TRUNC, 0644);
+ i = open(path_dhcpd_pid, O_WRONLY|O_CREAT|O_TRUNC|O_CLOEXEC, 0644);
if (i >= 0) {
sprintf(pbuf, "%d\n", (int) getpid());
IGNORE_RET (write(i, pbuf, strlen(pbuf)));
diff --git a/server/ldap.c b/server/ldap.c
index 6e7f508..d1cde27 100644
--- a/server/ldap.c
+++ b/server/ldap.c
@@ -1252,7 +1252,7 @@ ldap_start (void)
if (ldap_debug_file != NULL && ldap_debug_fd == -1)
{
- if ((ldap_debug_fd = open (ldap_debug_file, O_CREAT | O_TRUNC | O_WRONLY,
+ if ((ldap_debug_fd = open (ldap_debug_file, O_CREAT | O_TRUNC | O_WRONLY | O_CLOEXEC,
S_IRUSR | S_IWUSR)) < 0)
log_error ("Error opening debug LDAP log file %s: %s", ldap_debug_file,
strerror (errno));
--
1.8.4
++++++ 0012-dhcp-4.2.2-quiet-dhclient.patch ++++++
From 61b4b713b630febf170c58c9ebbba2e01bb28eff Mon Sep 17 00:00:00 2001
From: Marius Tomaschewski
Date: Thu, 18 Aug 2011 15:09:01 +0200
Subject: [PATCH] dhcp-4.2.2-quiet-dhclient
---
client/dhclient.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/client/dhclient.c b/client/dhclient.c
index dbc6f38..65d9eeb 100644
--- a/client/dhclient.c
+++ b/client/dhclient.c
@@ -451,6 +451,9 @@ main(int argc, char **argv) {
} else {
log_perror = 0;
quiet_interface_discovery = 1;
+#if !defined(DEBUG)
+ setlogmask(LOG_UPTO(LOG_NOTICE));
+#endif
}
/* If we're given a relay agent address to insert, for testing
--
1.8.4
++++++ 0013-dhcp-4.2.3-P1-dhclient-log-pid.patch ++++++
From d571408b5386b9bd72fd123b30298bdca8103b18 Mon Sep 17 00:00:00 2001
From: Marius Tomaschewski
Date: Tue, 12 Jun 2012 10:21:57 +0200
Subject: [PATCH] dhcp-4.2.3-P1-dhclient-log-pid
---
client/dhclient.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/client/dhclient.c b/client/dhclient.c
index 65d9eeb..8af0a42 100644
--- a/client/dhclient.c
+++ b/client/dhclient.c
@@ -141,7 +141,7 @@ main(int argc, char **argv) {
else if (fd != -1)
close(fd);
- openlog("dhclient", LOG_NDELAY, LOG_DAEMON);
+ openlog("dhclient", LOG_NDELAY | LOG_PID, LOG_DAEMON);
#if !(defined(DEBUG) || defined(__CYGWIN32__))
setlogmask(LOG_UPTO(LOG_INFO));
--
1.8.4
++++++ 0014-Fixed-linux-interface-discovery-using-getifaddrs.patch ++++++
From bd50ec560d7bec064190e4d430c066e170732c0e Mon Sep 17 00:00:00 2001
From: Marius Tomaschewski
Date: Tue, 27 Nov 2012 17:44:06 +0100
Subject: [PATCH] Fixed linux interface discovery using getifaddrs
Unlike dhcp 3.x, dhcp 4.x scans interfaces from /proc/net/dev,
which provides only true interface names. When the address set
on the interface has a label assigned (linux 2.0 alias interface
compatibility), then the SIOCGIFADDR requires the label / alias
name as argument instead of the interface name to return this
address. When this is the only address assigned to an interface,
dhcp-server is unable to find any address and fails to start.
Changed to use getifaddrs() function, which retrieves all IP
addresses on linux systems and is available since GLIBC 2.3.
---
common/discover.c | 51 ++++++++++++++++++++++++++++++++++++++++++++-------
1 file changed, 44 insertions(+), 7 deletions(-)
diff --git a/common/discover.c b/common/discover.c
index 6a0540b..1dcaa02 100644
--- a/common/discover.c
+++ b/common/discover.c
@@ -370,7 +370,7 @@ end_iface_scan(struct iface_conf_list *ifaces) {
ifaces->sock = -1;
}
-#elif __linux /* !HAVE_SIOCGLIFCONF */
+#elif __linux && !(defined(__GNUC_PREREQ) && __GNUC_PREREQ(2,3)) /* !HAVE_SIOCGLIFCONF */
/*
* Linux support
* -------------
@@ -379,6 +379,14 @@ end_iface_scan(struct iface_conf_list *ifaces) {
* about interfaces, along with selected ioctl() calls.
*
* Linux low level access is documented in the netdevice man page.
+ *
+ * Note: Use getifaddrs instead
+ * Unfortunately this discover discards all interfaces where the
+ * only address has a label assigned (linux 2.0 alias interface
+ * compatibility) as the SIOCGIFADDR requires the the alias name
+ * (eth0:0) in ifr_name to fetch the address and /proc/net/dev
+ * on linux > 2.0 lists only the interface names (eth0) without
+ * any aliases.
*/
/*
@@ -751,11 +759,11 @@ end_iface_scan(struct iface_conf_list *ifaces) {
#else
/*
- * BSD support
- * -----------
+ * BSD & Linux support
+ * -------------------
*
* FreeBSD, NetBSD, OpenBSD, and OS X all have the getifaddrs()
- * function.
+ * function. Linux has it since glibc 2.3.
*
* The getifaddrs() man page describes the use.
*/
@@ -812,10 +820,39 @@ next_iface(struct iface_info *info, int *err, struct iface_conf_list *ifaces) {
*err = 1;
return 0;
}
- strcpy(info->name, ifaces->next->ifa_name);
- memcpy(&info->addr, ifaces->next->ifa_addr,
- ifaces->next->ifa_addr->sa_len);
+ info->addr.ss_family = AF_UNSPEC;
info->flags = ifaces->next->ifa_flags;
+#ifdef __linux
+ if (strchr(ifaces->next->ifa_name, ':')) {
+ /*
+ * the name contains a ':', which may
+ * be a IPv4 "alias interface" label;
+ * resolve to the true interface name
+ */
+ if_indextoname(if_nametoindex(ifaces->next->ifa_name),
+ info->name);
+ } else {
+ strcpy(info->name, ifaces->next->ifa_name);
+ }
+
+ if (ifaces->next->ifa_addr != NULL) {
+ if (ifaces->next->ifa_addr->sa_family == AF_INET) {
+ memcpy(&info->addr, ifaces->next->ifa_addr,
+ sizeof(struct sockaddr_in));
+ } else
+ if (ifaces->next->ifa_addr->sa_family == AF_INET6) {
+ memcpy(&info->addr, ifaces->next->ifa_addr,
+ sizeof(struct sockaddr_in6));
+ }
+ /* else e.g. AF_PACKET / link layer address */
+ }
+#else
+ strcpy(info->name, ifaces->next->ifa_name);
+ if (ifaces->next->ifa_addr != NULL) {
+ memcpy(&info->addr, ifaces->next->ifa_addr,
+ ifaces->next->ifa_addr->sa_len);
+ }
+#endif
ifaces->next = ifaces->next->ifa_next;
*err = 0;
return 1;
--
1.8.4
++++++ 0015-Ignore-SIGPIPE-to-not-die-in-socket-code.patch ++++++
From d9b443ef38da92bd325f5118a2a6ddc21fae098e Mon Sep 17 00:00:00 2001
From: Marius Tomaschewski
Date: Thu, 20 Dec 2012 10:25:53 +0100
Subject: [PATCH] Ignore SIGPIPE to not die in socket code
Installed SIG_IGN handler for SIGPIPE to not die before
the errno==EPIPE checks in the socket code are reached.
Unlike isc_app_start(), the isc_app_ctxstart() used by
dhcp, does not set any signal handlers.
Reported upstream as [ISC-Bugs #32222], IMO regression
to [ISC-Bugs #22269] as the SO_NOSIGPIPE socket option
isn't available e.g. on Linux.
---
omapip/isclib.c | 32 +++++++++++++++++++++++++++++++-
1 file changed, 31 insertions(+), 1 deletion(-)
diff --git a/omapip/isclib.c b/omapip/isclib.c
index afab262..9b7ff5f 100644
--- a/omapip/isclib.c
+++ b/omapip/isclib.c
@@ -69,6 +69,23 @@ isclib_cleanup(void)
return;
}
+static isc_result_t
+handle_signal(int sig, void (*handler)(int)) {
+ struct sigaction sa;
+
+ memset(&sa, 0, sizeof(sa));
+ sa.sa_handler = handler;
+
+ if (sigfillset(&sa.sa_mask) != 0 ||
+ sigaction(sig, &sa, NULL) < 0) {
+ log_error("handle_signal() %d setup: %s",
+ sig, strerror(errno));
+ return (ISC_R_UNEXPECTED);
+ }
+
+ return (ISC_R_SUCCESS);
+}
+
isc_result_t
dhcp_context_create(void) {
isc_result_t result;
@@ -106,7 +123,20 @@ dhcp_context_create(void) {
result = isc_app_ctxstart(dhcp_gbl_ctx.actx);
if (result != ISC_R_SUCCESS)
- return (result);
+ goto cleanup;
+
+ /*
+ * Always ignore SIGPIPE.
+ * Otherwise we will die before the errno == EPIPE
+ * checks in the socket code are reached.
+ *
+ * Note: unlike isc_app_start(), isc_app_ctxstart()
+ * does not set any signal handlers.
+ */
+ result = handle_signal(SIGPIPE, SIG_IGN);
+ if (result != ISC_R_SUCCESS)
+ goto cleanup;
+
dhcp_gbl_ctx.actx_started = ISC_TRUE;
result = isc_taskmgr_createinctx(dhcp_gbl_ctx.mctx,
--
1.8.4
++++++ 0016-server-log-DHCPv6-addresses-assigned-to-clients.patch ++++++
From 39c796224826836f0b0d1ab42f93a973545a94b0 Mon Sep 17 00:00:00 2001
From: Marius Tomaschewski
Date: Mon, 10 Feb 2014 15:12:49 +0100
Subject: [PATCH] server: log DHCPv6 addresses assigned to clients
---
includes/site.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/includes/site.h b/includes/site.h
index 3de180c..1b6d0c0 100644
--- a/includes/site.h
+++ b/includes/site.h
@@ -281,5 +281,5 @@
This default to off to avoid changes to what is currently
logged. */
-/* #define LOG_V6_ADDRESSES */
+#define LOG_V6_ADDRESSES
--
1.8.4
++++++ contrib.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/contrib/leasestate new/contrib/leasestate
--- old/contrib/leasestate 2006-06-02 11:02:09.000000000 +0200
+++ new/contrib/leasestate 2014-02-10 14:51:09.000000000 +0100
@@ -16,7 +16,7 @@
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) {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/contrib/listlease new/contrib/listlease
--- old/contrib/listlease 2006-06-02 11:02:13.000000000 +0200
+++ new/contrib/listlease 2014-02-10 14:51:09.000000000 +0100
@@ -14,7 +14,7 @@
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);
++++++ dhcp-4.2.5-P1.tar.gz -> dhcp-4.2.6.tar.gz ++++++
/work/SRC/openSUSE:Factory/dhcp/dhcp-4.2.5-P1.tar.gz /work/SRC/openSUSE:Factory/.dhcp.new/dhcp-4.2.6.tar.gz differ: char 5, line 1
++++++ dhcp.README ++++++
--- /var/tmp/diff_new_pack.3H7W85/_old 2014-02-13 06:44:50.000000000 +0100
+++ /var/tmp/diff_new_pack.3H7W85/_new 2014-02-13 06:44:50.000000000 +0100
@@ -1,55 +1,21 @@
-/* README.SuSE for the ISC DHCP server */
+/* README.SUSE for the ISC DHCP server */
Before you can run dhcpd, you have to configure it via
- /etc/sysconfig/dhcpd (general settings)
and
- - /etc/dhcpd.conf (configuration file)
+ - /etc/dhcpd.conf (DHCPv4 configuration file)
+ - /etc/dhcpd6.conf (DHCPv6 configuration file)
See /usr/share/doc/packages/dhcp-server for example configurations.
-Note on packet filtering
-========================
-This dhcp package contains an additional dhcpd binary (/usr/sbin/dhcpd.bsd)
-which is compiled using BSD sockets instead of LPF (linux packet filter).
-
-Using that binary, the network traffic handled by dhcpd can be filtered by the
-packet filter of the Linux kernel, while the raw sockets used normally would
-bypass any filtering. However, there is a tiny number of setups where this can
-result in incompatibilities with certain DHCP clients, or with DHCP relay
-agents in between. More information and a discussion of side effects was
-discussed here:
-See http://marc.theaimsgroup.com/?l=dhcp-server&m=108791973729847&w=2
-
-It is possible to choose the binary by adjusting DHCPD_BINARY in
-/etc/sysconfig/dhcpd.
-
-
-Option 119 (Searchlist)
-=======================
-For this relatively new option (DHCP Option 119, RFC3397) the server does not
-have a dedicated configuration option yet. It must be declared as free option,
-after compressing the search string with DNS compression (see below), and put
-into the configuration like this:
-
-option searchlist code 119 = string;
-option searchlist "\x07domain1\x07example\x03com\x00\x07domain2\xc0\x08";
-
-The first line is always used globally; the second one could be placed in a
-subnet block.
-
-The compressed string can be generated with the program
-/usr/share/doc/packages/dhcp-server/dnscompr.py as shown here (example):
-
- # python /usr/share/doc/packages/dhcp-server/dnscompr.py domain1.example.com domain2.example.com
-'\x07domain1\x07example\x03com\x00\x07domain2\xc0\x08'
-
-dnscompr.py needs the python-dnspython package installed, which is shipping
-since 10.0. For older SUSE Linux versions the python-module can be found at
-http://ftp.suse.com/pub/people/poeml/python-dnspython/
+Option 119 (domain-search) vs. option 15 (domain-name)
+======================================================
-The compression is described in RFC 3397, and (with more detail) in RFC1035.
-
+The domain-name option supports only one, signgle domain (default domain).
+The domain-search option supports a list of domain names. Please do not
+abuse the domain-name option to provide a list -- it may be discarded by
+dhcp clients.
Chroot Jail
@@ -66,11 +32,10 @@
In order to be found by dhcpd in the chroot jail, the configuration file
will automatically copied to /var/lib/dhcp/etc/ when the server is started.
Further conf files (include files) can be listed in DHCPD_CONF_INCLUDE_FILES
-in /etc/sysconfig/dhcpd.
-
-To enable dhcpd to continue logging from the chroot environment even after
-syslogd has been restarted, "-a /var/lib/dhcp/dev/log" is automatically added to the syslog configuration in /etc/sysconfig/syslog.
+or DHCPD6_CONF_INCLUDE_FILES in /etc/sysconfig/dhcpd.
+The /var/lib/dhcp/dev/log syslog socked is automatically provided in the
+chroot environment as soon as it is initially set up.
NOTE:
In the chroot jail, dhcpd can't resolve hostnames unless it can find
@@ -82,6 +47,7 @@
/lib/libresolv.so.2
/lib/libnss_dns.so.2
/lib/libnss_dns6.so.2
+ ....
Thererore, these files (about 100 kB) will automatically copied to the chroot
jail when the server is started. (You might have to keep these current if
they are modified dynamically by other programs (e.g./etc/ppp/ip-up) while
@@ -89,14 +55,8 @@
instead of host names in the config file.
In case of trouble, you can also disable the chroot feature by setting
-DHCPD_RUN_CHROOTED in /etc/sysconfig/dhcpd to "no".
-
-See
- http://www.isc.org/ml-archives/dhcp-server/2000/04/msg00097.html
-and
- http://www.securityportal.com/closet/closet20001129.html
-for more information.
+DHCPD_RUN_CHROOTED/DHCPD6_RUN_CHROOTED in /etc/sysconfig/dhcpd to "no".
Have a lot of fun!
- Your SuSE Team
+ Your SUSE Linux Team
++++++ dhcpd.script ++++++
#! /bin/bash
# Copyright (c) 1996, 1997, 1998 S.u.S.E. GmbH
# Copyright (c) 1998, 1999, 2000, 2001 SuSE GmbH
# Copyright (c) 2002, 2003 SuSE Linux AG
# Copyright (c) 2004-2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
#
# 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, see http://www.gnu.org/licenses/.
#
# Author: Rolf Haberrecker , 1997-1999
# Peter Poeml , 2000-2006
# Marius Tomaschewski , 2006-2010
#
# /usr/lib/dhcp/dhcpd helper script, fromer /etc/init.d/dhcpd init script.
#
###
test -s /etc/sysconfig/dhcpd && . /etc/sysconfig/dhcpd
SUPPORTS_CHROOT="yes"
SUPPORTS_RUN_AS="yes"
SUPPORTS_HUP="no"
# note: $DAEMON_PIDFILE is a symlink to the
# $DAEMON_STATE$DAEMON_PIDFILE (also
# while DHCPD_RUN_CHROOTED=no) now,
# as DHCPD_RUN_AS is not allowed to
# create pid files in /var/run.
DHCPv_OPT=$1 ; shift
case $DHCPv_OPT in
-4)
DAEMON='ISC DHCPv4 Server'
DAEMON_BIN=/usr/sbin/dhcpd
DAEMON_CONF=/etc/dhcpd.conf
DAEMON_STATE=/var/lib/dhcp
DAEMON_LEASES=dhcpd.leases
DAEMON_PIDFILE=/var/run/dhcpd.pid
STARTPROC_LOGFILE=/var/log/rc.dhcpd.log
LDAP_CONF=/etc/openldap/ldap.conf
test "$DHCPD_RUN_CHROOTED" = "yes" && \
CHROOT_PREFIX="$DAEMON_STATE" || CHROOT_PREFIX=''
DHCPD_CONF_INCLUDE_FILES=${DHCPD_CONF_INCLUDE_FILES:-/etc/dhcpd.d}
;;
-6)
DAEMON='ISC DHCPv6 Server'
DAEMON_BIN=/usr/sbin/dhcpd
DAEMON_CONF=/etc/dhcpd6.conf
DAEMON_STATE=/var/lib/dhcp6
DAEMON_LEASES=dhcpd6.leases
DAEMON_PIDFILE=/var/run/dhcpd6.pid
STARTPROC_LOGFILE=/var/log/rc.dhcpd6.log
LDAP_CONF=""
test "$DHCPD6_RUN_CHROOTED" = "yes" && \
CHROOT_PREFIX="$DAEMON_STATE" || CHROOT_PREFIX=''
DHCPD_RUN_AS=$DHCPD6_RUN_AS
DHCPD_INTERFACE=$DHCPD6_INTERFACE
DHCPD_OTHER_ARGS=$DHCPD6_OTHER_ARGS
DHCPD_CONF_INCLUDE_FILES=${DHCPD6_CONF_INCLUDE_FILES:-/etc/dhcpd6.d}
;;
*)
echo >&2 "Usage: $0 <-4|-6> <action>"
exit 2
;;
esac
# Shell functions sourced from /etc/rc.status:
# rc_check check and set local and overall rc status
# rc_status check and set local and overall rc status
# rc_status -v ditto but be verbose in local rc status
# rc_status -v -r ditto and clear the local rc status
# rc_failed set local and overall rc status to failed
# rc_failed <num> set local and overall rc status to <num><num>
# rc_reset clear local rc status (overall remains)
# rc_exit exit appropriate to overall rc status
. /etc/rc.status
# First reset status of this service
rc_reset
# Return values acc. to LSB for all commands but status:
# 0 - success
# 1 - generic or unspecified error
# 2 - invalid or excess argument(s)
# 3 - unimplemented feature (e.g. "reload")
# 4 - insufficient privilege
# 5 - program is not installed
# 6 - program is not configured
# 7 - program is not running
#
# Note that starting an already running service, stopping
# or restarting a not-running service as well as the restart
# with force-reload (in case signalling is not supported) are
# considered a success.
if ! [ -x "$DAEMON_BIN" ]; then
case $1 in
stop) ;;
*) echo -n >&2 "\"$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
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 "\"$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
# (these can occur if dhcpd does not start correctly)
test -e $DAEMON_PIDFILE && ! test -s $DAEMON_PIDFILE && rm $DAEMON_PIDFILE
test -e $DAEMON_STATE/$DAEMON_PIDFILE && ! test -s $DAEMON_STATE/$DAEMON_PIDFILE && rm $DAEMON_STATE/$DAEMON_PIDFILE
case "$1" in
start)
echo -n "Starting $DAEMON "
## If there is no conf file, skip starting of dhcpd
## and return with "program not configured"
if ! [ -f $DAEMON_CONF ]; then
echo -n "... no configuration file found";
# Tell the user this has skipped
rc_status -s
# service is not configured
exit 6;
fi
## If the interfaces are not set, skip starting of dhcpd
## and return with "program not configured"
if [ -z "$DHCPD_INTERFACE" ]; then
var="DHCPD_INTERFACE"
case $DHCPv_OPT in -6) var=DHCPD6_INTERFACE ;; esac
echo -n "... set $var in /etc/sysconfig/dhcpd"
# Tell the user this has skipped
rc_status -s
# service is not configured
exit 6;
fi
if [ "$DHCPD_INTERFACE" = "ANY" ]; then
DHCPD_INTERFACE=""
fi
jail=${CHROOT_PREFIX:-${DAEMON_STATE}}; leases=$DAEMON_LEASES
if ! [ -e $jail/db/$leases ]; then
# until 9.0, the lease file was in /var/lib/dhcp and part of the package
if test -e $jail/$leases -a '!' -L $jail/$leases; then
# this is the case where the %post script runs _before_ the old package is
# removed (i.e., dhcpd.leases has not renamed to .rpmsave yet)
mv $jail/$leases $jail/db/$leases && \
ln -s db/$leases $jail/
elif test -e $jail/$leases.rpmsave; then
# this is what's left when the package is already gone.
mv $jail/$leases.rpmsave $jail/db/$leases && \
ln -s db/$leases $jail/
else
# fresh installation:
# a lease file must be present. the server won't start without
touch $jail/db/$leases
fi
fi
if test "$DHCPD_RUN_CHROOTED" = "yes" ; then
## copy the conf file to the chroot jail (dhcpd has to be restarted anyway,
## when it has changed) and change path to leases file
for i in $DAEMON_CONF $DHCPD_CONF_INCLUDE_FILES $LDAP_CONF /etc /dev; do
if test -d "${i}" ; then
test -d "$CHROOT_PREFIX/${i}" || \
mkdir -p "$CHROOT_PREFIX/${i}"
elif test -e "${i}" ; then
test -d "$CHROOT_PREFIX/${i%/*}" || \
mkdir -p "$CHROOT_PREFIX/${i%/*}"
fi
done
rm -f $CHROOT_PREFIX/dev/urandom
for i in $DAEMON_CONF $DHCPD_CONF_INCLUDE_FILES $LDAP_CONF /etc/{gai.conf,nsswitch.conf,resolv.conf,host.conf,hosts,localtime,bindresvport.blacklist} /dev/urandom; do
if ! test -e "$i"; then continue; fi # neither of them is absolutely necessary
cp -aL "$i" "${CHROOT_PREFIX}/${i%/*}/" &>/dev/null \
|| { echo "...$0:$LINENO: could not copy $i to chroot jail"; rc_failed; rc_status -v1; exit 6; }
done
libdir=$(basename $(echo ${CHROOT_PREFIX}/lib*))
if test -x /usr/bin/ldd ; then
get_ldd_deps()
{
ldd_wl="\/${libdir}\/lib"
ldd_bl="\/${libdir}\/libc\."
/usr/bin/ldd "$1" | \
while read -sr a b c d ; do
[ -n "$c" ] || continue
[[ $c =~ $ldd_wl ]] || continue
[[ $c =~ $ldd_bl ]] && continue
echo $c
done
}
else
get_ldd_deps() { :; }
fi
cplibs=`for i in /$libdir/{libresolv.so.*,libnss_*.so.*} \
/$libdir/{libpthread.so.0,libdl.so.2,libgcc_s.so.*} ;
do
if [ -s "$i" ] ; then
echo "$i"
get_ldd_deps "$i"
fi
done | sort -u`
for i in $cplibs ; do
if [ -s "$i" ]; then
cp -pL "$i" "${CHROOT_PREFIX}/$libdir/" \
|| { echo "...$0:$LINENO: could not copy $i to chroot jail"; rc_failed; rc_status -v1; exit 6; }
fi
done
# mount /proc into the chroot; the server fails if unable to read /proc/net/{dev,if_inet6}
mkdir -p ${CHROOT_PREFIX}/proc
mount -t proc -o ro proc ${CHROOT_PREFIX}/proc 2>/dev/null
DHCPD_ARGS="-chroot $CHROOT_PREFIX -lf /db/$DAEMON_LEASES"
## If there is a pid file containing a pid, the machine might have crashed. pid files in
## /var/run are always cleaned up at boot time, but this is not the case for the pid file in
## the chroot jail. Therefore, and old pid file may exist. This is only a problem if it
## incidentally contains the pid of a running process. If this process is not a 'dhcpd',
## we remove the pid. (dhcpd itself only checks whether the pid is alive or not.)
if test -s $DAEMON_STATE/$DAEMON_PIDFILE; then
p=$(<$DAEMON_STATE/$DAEMON_PIDFILE)
if test -n "$p" && grep -qsE "^${DAEMON_BIN}" "/proc/$p/cmdline" ; then
echo -n '(already running) '
else
rm -f $DAEMON_STATE/$DAEMON_PIDFILE
fi
fi
PID_FILE_ARG="$DAEMON_PIDFILE"
else
DHCPD_ARGS="-lf ${DAEMON_STATE}/db/$DAEMON_LEASES"
PID_FILE_ARG="$DAEMON_STATE$DAEMON_PIDFILE"
fi
if [ -n "$DHCPD_RUN_AS" ]; then
DHCPD_RUN_AS_GROUP="$(getent group $(getent passwd $DHCPD_RUN_AS | cut -d: -f4) | cut -d: -f1)"
DHCPD_ARGS="$DHCPD_ARGS -user $DHCPD_RUN_AS -group $DHCPD_RUN_AS_GROUP"
chown "${DHCPD_RUN_AS}:${DHCPD_RUN_AS_GROUP}" \
"$DAEMON_STATE/${DAEMON_PIDFILE%/*}"
fi
## check syntax with -t (output to log file) and start only when the syntax is okay
rm -f $STARTPROC_LOGFILE # start log
error=0
if ! $DAEMON_BIN $DHCPv_OPT -t -cf $CHROOT_PREFIX/$DAEMON_CONF -pf $PID_FILE_ARG > $STARTPROC_LOGFILE 2>&1 ; then
error=1
else
## Start daemon. If this fails the return value is set appropriate.
## The init script should return 0, even if service is already running,
## to match the LSB spec.
test "$2" = "-v" && echo -en \
"\nexecuting '$DAEMON_BIN $DHCPv_OPT -cf $DAEMON_CONF -pf $PID_FILE_ARG $DHCPD_ARGS $DHCPD_OTHER_ARGS $DHCPD_INTERFACE'"
$DAEMON_BIN $DHCPv_OPT -cf $DAEMON_CONF -pf $PID_FILE_ARG $DHCPD_ARGS $DHCPD_OTHER_ARGS $DHCPD_INTERFACE &> $STARTPROC_LOGFILE
ret=$?
fi
if [ $error -gt 0 -o ${ret:-0} -gt 0 ]; then
## be verbose
echo ""
echo -n " please see $STARTPROC_LOGFILE for details "
## set status to failed
rc_failed
else
ln -sf "$DAEMON_STATE$DAEMON_PIDFILE" "$DAEMON_PIDFILE"
[ "$DHCPD_RUN_CHROOTED" = "yes" ] && echo -n "[chroot]" || :
fi
# Remember status and be verbose
rc_status -v
;;
stop)
echo -n "Shutting down $DAEMON "
# Catch the case where daemon is running without chroot,
# but sysconfig/dhcp has been changed to use chroot (and
# another way around).
# In this case is there is no $chroot/$pidfile, but there
# should be a /pidfile that we use instead.
# We can not kill without pid file or dhcp4 kills dhcp6.
PID_FILE="$DAEMON_STATE$DAEMON_PIDFILE"
if test "$DHCPD_RUN_CHROOTED" = "yes" ; then
if test ! -s "$DAEMON_STATE$DAEMON_PIDFILE" -a \
-s "$DAEMON_PIDFILE" ; then
PID_FILE="$DAEMON_PIDFILE"
fi
else
if test ! -s "$DAEMON_PIDFILE" -a \
-s "$DAEMON_STATE$DAEMON_PIDFILE" ; then
PID_FILE="$DAEMON_STATE$DAEMON_PIDFILE"
fi
fi
## Stop daemon with killproc(8) and if this fails
## set echo the echo return value.
killproc -p "$PID_FILE" $DAEMON_BIN
ret=$?
# umount proc and remove libraries from the chroot jail,
# so they are not left over if the server is deinstalled
if [ "$DHCPD_RUN_CHROOTED" = yes -a -n "$CHROOT_PREFIX" ]; then
umount ${CHROOT_PREFIX}/proc 2>/dev/null
rm -f $CHROOT_PREFIX/lib*/*
fi
# Remember status and be verbose
rc_failed $ret
rc_status -v
;;
try-restart)
## Do a restart only if the service was active before.
## Note: try-restart is now part of LSB (as of 1.9).
## RH has a similar command named condrestart.
$0 $DHCPv_OPT status
if test $? = 0; then
$0 $DHCPv_OPT restart
else
rc_reset # Not running is not a failure.
fi
# Remember status and be quiet
rc_status
;;
restart)
## Check syntax and when it is OK, stop the service
## and regardless of whether it was running or not,
## start it again.
if ! $0 $DHCPv_OPT check-syntax &>/dev/null ; then
echo -n "Syntax check reports errors, see log messages"
rc_failed
rc_status -v
else
$0 $DHCPv_OPT stop
sleep 3
$0 $DHCPv_OPT start
# Remember status and be quiet
rc_status
fi
;;
force-reload)
## Signal the daemon to reload its config. Most daemons
## do this on signal 1 (SIGHUP).
## If it does not support it, restart.
if [ "$SUPPORTS_HUP" = "yes" ]; then
echo -n "Reload service $DAEMON"
killproc -p $DAEMON_STATE/$DAEMON_PIDFILE -HUP $DAEMON_BIN
#touch $DAEMON_STATE/$DAEMON_PIDFILE
rc_status -v
elif ! $0 $DHCPv_OPT check-syntax &>/dev/null ; then
echo -n "Syntax check reports errors, see log messages"
rc_failed
rc_status -v
else
$0 $DHCPv_OPT stop && sleep 3 && $0 $DHCPv_OPT start
rc_status
fi
;;
reload)
## Like force-reload, but if daemon does not support
## signalling, do nothing (!)
echo -n "Reload service $DAEMON"
if [ "$SUPPORTS_HUP" = "yes" ]; then
# If it supports signalling:
killproc -p $DAEMON_STATE/$DAEMON_PIDFILE -HUP $DAEMON_BIN
#touch $DAEMON_STATE/$DAEMON_PIDFILE
rc_status -v
else
## Otherwise if it does not support reload:
rc_failed 3
rc_status -v
fi
;;
status)
echo -n "Checking for $DAEMON: "
## Check status with checkproc(8), if process is running
## checkproc will return with exit status 0.
# Status has a slightly different for the status command:
# 0 - service running
# 1 - service dead, but /var/run/ pid file exists
# 2 - service dead, but /var/lock/ lock file exists
# 3 - service not running
# NOTE: checkproc returns LSB compliant status values.
checkproc -p $DAEMON_STATE/$DAEMON_PIDFILE $DAEMON_BIN
rc_status -v
;;
probe)
## Optional: Probe for the necessity of a reload,
## give out the argument which is required for a reload.
rc=0
for i in /etc/sysconfig/dhcpd $DAEMON_CONF $DHCPD_CONF_INCLUDE_FILES; do
test $i -nt $DAEMON_STATE/$DAEMON_PIDFILE && rc=1
done
test $rc = 1 && echo restart
;;
check-syntax|syntax-check)
echo -n "Checking syntax of $DAEMON_CONF: "
## this nice bit is from Edwin Groothuis:
## check syntax (quiet)
$DAEMON_BIN $DHCPv_OPT -q -t -cf $DAEMON_CONF
rc_status
if [ $? -ne 0 ]; then
echo ""
## check syntax (verbose)
$DAEMON_BIN $DHCPv_OPT -t -cf $DAEMON_CONF
echo -ne '\nConfig is NOT okay'
rc_failed
fi
rc_status -v
;;
check-lease|check-lease-file)
echo -n "Checking lease file $DAEMON_LEASES: "
if [ -s ${DAEMON_STATE}/db/$DAEMON_LEASES ] ; then
## check leases file (quiet)
$DAEMON_BIN $DHCPv_OPT -q -T -cf /dev/null -lf ${DAEMON_STATE}/db/$DAEMON_LEASES
rc_status
if [ $? -ne 0 ]; then
echo ""
## check leases file (verbose)
$DAEMON_BIN $DHCPv_OPT -T -cf $DAEMON_CONF -lf ${DAEMON_STATE}/db/$DAEMON_LEASES
echo -ne '\nLease file is NOT okay'
rc_failed
fi
else
rc_status -u
fi
rc_status -v
;;
*)
SCRIPT="${SCRIPT:-${0##*/} $DHCPv_OPT}"
echo "Usage: $SCRIPT {start|stop|status|try-restart|restart|force-reload|reload|probe|check-syntax} [-v]"
exit 1
esac
rc_exit
++++++ dhcpd.service ++++++
[Unit]
Description=ISC DHCPv4 Server
Before=multi-user.target
After=remote-fs.target network.target nss-lookup.target time-sync.target ldap.service ndsd.service
[Service]
Type=forking
Restart=on-abort
ExecStart=/usr/lib/dhcp/dhcpd -4 start
ExecStop=/usr/lib/dhcp/dhcpd -4 stop
[Install]
WantedBy=multi-user.target
Alias=dhcp-server.service
++++++ dhcpd6.service ++++++
[Unit]
Description=ISC DHCPv6 Server
Before=multi-user.target
After=remote-fs.target network.target nss-lookup.target time-sync.target ldap.service ndsd.service
[Service]
Type=forking
Restart=on-abort
ExecStart=/usr/lib/dhcp/dhcpd -6 start
ExecStop=/usr/lib/dhcp/dhcpd -6 stop
[Install]
WantedBy=multi-user.target
Alias=dhcp6-server.service
++++++ dhcrelay.script ++++++
#! /bin/sh
# Copyright (c) 1996, 1997, 1998 S.u.S.E. GmbH
# Copyright (c) 1998, 1999, 2000, 2001 SuSE GmbH
# Copyright (c) 2002 SuSE Linux AG
# Copyright (c) 2003-2014 SUSE LINUX Products GmbH
#
# Author: Peter Poeml , 2001
# Marius Tomaschewski , 2010
#
# /usr/lib/dhcp/dhcrelay helper,
# fromer /etc/init.d/dhcrelay init script
#
###
DHCPv_OPT=$1 ; shift
case $DHCPv_OPT in
-4)
DAEMON="ISC DHCPv4 relay agent"
DAEMON_BIN=/usr/sbin/dhcrelay
DAEMON_CONF=/etc/sysconfig/dhcrelay
DAEMON_PIDFILE=/var/run/dhcrelay.pid
STARTPROC_LOGFILE=/var/log/rc.dhcrelay.log
SUPPORTS_HUP="no"
;;
-6)
DAEMON="ISC DHCPv6 relay agent"
DAEMON_BIN=/usr/sbin/dhcrelay6
DAEMON_CONF=/etc/sysconfig/dhcrelay
DAEMON_PIDFILE=/var/run/dhcrelay6.pid
STARTPROC_LOGFILE=/var/log/rc.dhcrelay6.log
;;
*)
echo >&2 "Usage: $0 <-4|-6> <action>"
exit 2
;;
esac
test -s "$DAEMON_CONF" && . "$DAEMON_CONF"
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
# rc_status check and set local and overall rc status
# rc_status -v ditto but be verbose in local rc status
# rc_status -v -r ditto and clear the local rc status
# rc_failed set local and overall rc status to failed
# rc_failed <num> set local and overall rc status to <num><num>
# rc_reset clear local rc status (overall remains)
# rc_exit exit appropriate to overall rc status
. /etc/rc.status
# First reset status of this service
rc_reset
# Return values acc. to LSB for all commands but status:
# 0 - success
# 1 - generic or unspecified error
# 2 - invalid or excess argument(s)
# 3 - unimplemented feature (e.g. "reload")
# 4 - insufficient privilege
# 5 - program is not installed
# 6 - program is not configured
# 7 - program is not running
#
# Note that starting an already running service, stopping
# or restarting a not-running service as well as the restart
# with force-reload (in case signalling is not supported) are
# considered a success.
case "$1" in
start)
echo -n "Starting $DAEMON"
checkproc -p $DAEMON_PIDFILE $DAEMON_BIN && {
echo -n "... already running"; rc_status -v; exit 0;
}
case $DHCPv_OPT in
-4)
## If interfaces or servers are not set, skip starting of dhcrelay
## and return with "program not configured"
if [ -z "$DHCRELAY_INTERFACES" -o -z "$DHCRELAY_SERVERS" ]; then
# Tell the user this has skipped
rc_status -s
# service is not configured
exit 6;
fi
DHCRELAY_INTERFACES_ARGS=''
for i in $DHCRELAY_INTERFACES ; do
DHCRELAY_INTERFACES_ARGS="$DHCRELAY_INTERFACES_ARGS -i $i"
done
DHCRELAY_ARGS="$DHCRELAY_INTERFACES_ARGS $DHCRELAY_SERVERS"
;;
-6)
DHCRELAY6_LOWER_INTERFACES_ARGS=''
for l in $DHCRELAY6_LOWER_INTERFACES ; do
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 -o "x$u" = "x-u" && continue
DHCRELAY6_UPPER_INTERFACES_ARGS="$DHCRELAY6_UPPER_INTERFACES_ARGS -u $u"
done
if [ "x$DHCRELAY6_LOWER_INTERFACES_ARGS" = x -o \
"x$DHCRELAY6_UPPER_INTERFACES_ARGS" = x ]; then
# Tell the user this has skipped
rc_status -s
# service is not configured
exit 6;
fi
DHCRELAY_ARGS="$DHCRELAY6_LOWER_INTERFACES_ARGS $DHCRELAY6_UPPER_INTERFACES_ARGS"
;;
esac
## Start daemon with startproc(8). If this fails
## the echo return value is set appropriate.
# startproc should return 0, even if service is
# already running to match LSB spec.
test "$2" = "-v" && echo -en \
"\nexecuting '$DAEMON_BIN $DHCPv_OPT $DHCRELAY_OPTIONS $DHCRELAY_ARGS'"
startproc -q -l $STARTPROC_LOGFILE -p $DAEMON_PIDFILE $DAEMON_BIN $DHCPv_OPT $DHCRELAY_OPTIONS $DHCRELAY_ARGS &>/dev/null
rc=$?
if ! [ $rc -eq 0 ]; then
## be verbose
echo ""
echo -n " please see $STARTPROC_LOGFILE for details "
## set status to failed
rc_failed
fi
# Remember status and be verbose
rc_status -v
;;
stop)
echo -n "Shutting down $DAEMON"
## Stop daemon with killproc(8) and if this fails
## set echo the echo return value.
killproc -p $DAEMON_PIDFILE $DAEMON_BIN
# Remember status and be verbose
rc_status -v
;;
try-restart)
## Do a restart only if the service was active before.
## Note: try-restart is now part of LSB (as of 1.9).
## RH has a similar command named condrestart.
$0 status
if test $? = 0; then
$0 restart
else
rc_reset # Not running is not a failure.
fi
# Remember status and be quiet
rc_status
;;
restart)
## Stop the service and regardless of whether it was
## running or not, start it again.
$0 stop
sleep 1
$0 start
# Remember status and be quiet
rc_status
;;
force-reload)
## Signal the daemon to reload its config. Most daemons
## do this on signal 1 (SIGHUP).
## If it does not support it, restart.
$0 stop && sleep 1 && $0 start
rc_status
echo -n "Reload service $DAEMON"
if [ "$SUPPORTS_HUP" = "yes" ] ; then
killproc -p $DAEMON_PIDFILE -HUP $DAEMON_BIN
#touch $DAEMON_PIDFILE
rc_status -v
else
$0 stop && $0 start
rc_status
fi
;;
reload)
## Like force-reload, but if daemon does not support
## signalling, do nothing (!)
if [ "$SUPPORTS_HUP" = "yes" ] ; then
# If it supports signalling:
echo -n "Reload service $DAEMON"
killproc -p $DAEMON_PIDFILE -HUP $DAEMON_BIN
#touch $DAEMON_PIDFILE
rc_status -v
else
## Otherwise if it does not support reload:
rc_failed 3
rc_status -v
fi
;;
status)
echo -n "Checking for dhcp relay agent: "
## Check status with checkproc(8), if process is running
## checkproc will return with exit status 0.
# Status has a slightly different for the status command:
# 0 - service running
# 1 - service dead, but /var/run/ pid file exists
# 2 - service dead, but /var/lock/ lock file exists
# 3 - service not running
# NOTE: checkproc returns LSB compliant status values.
checkproc -p $DAEMON_PIDFILE $DAEMON_BIN
rc_status -v
;;
probe)
## Optional: Probe for the necessity of a reload,
## give out the argument which is required for a reload.
if [ "$DAEMON_CONF" -nt "$DAEMON_PIDFILE" ]; then
if [ "$SUPPORTS_HUP" = "yes" ]; then
echo reload
else
echo restart
fi
fi
;;
*)
SCRIPT="${SCRIPT:-${0##*/} $DHCPv_OPT}"
echo "Usage: $SCRIPT {start|stop|status|try-restart|restart|force-reload|reload|probe} [-v]"
exit 1
;;
esac
rc_exit
++++++ dhcrelay.service ++++++
[Unit]
Description=ISC DHCPv4 Relay Agent
Before=multi-user.target
After=remote-fs.target network.target nss-lookup.target time-sync.target ldap.service ndsd.service
[Service]
Type=forking
Restart=on-abort
ExecStart=/usr/lib/dhcp/dhcrelay -4 start
ExecStop=/usr/lib/dhcp/dhcrelay -4 stop
[Install]
WantedBy=multi-user.target
Alias=dhcp-relay.service
++++++ dhcrelay6.service ++++++
[Unit]
Description=ISC DHCPv6 Relay Agent
Before=multi-user.target
After=remote-fs.target network.target nss-lookup.target time-sync.target ldap.service ndsd.service
[Service]
Type=forking
Restart=on-abort
ExecStart=/usr/lib/dhcp/dhcrelay -6 start
ExecStop=/usr/lib/dhcp/dhcrelay -6 stop
[Install]
WantedBy=multi-user.target
Alias=dhcp6-relay.service
++++++ if-up.d.dhcpd-restart-hook ++++++
--- /var/tmp/diff_new_pack.3H7W85/_old 2014-02-13 06:44:50.000000000 +0100
+++ /var/tmp/diff_new_pack.3H7W85/_new 2014-02-13 06:44:50.000000000 +0100
@@ -16,8 +16,7 @@
# 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
+# along with this program; if not, see http://www.gnu.org/licenses/
#
# Please send feedback via http://www.suse.de/feedback
#
++++++ rc.dhcpd ++++++
--- /var/tmp/diff_new_pack.3H7W85/_old 2014-02-13 06:44:50.000000000 +0100
+++ /var/tmp/diff_new_pack.3H7W85/_new 2014-02-13 06:44:50.000000000 +0100
@@ -2,7 +2,7 @@
# Copyright (c) 1996, 1997, 1998 S.u.S.E. GmbH
# Copyright (c) 1998, 1999, 2000, 2001 SuSE GmbH
# Copyright (c) 2002, 2003 SuSE Linux AG
-# Copyright (c) 2004-2008 SUSE LINUX Products GmbH, Nuernberg, Germany.
+# Copyright (c) 2004-2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
@@ -41,429 +41,11 @@
# needs to rely on time synchronisation.)
### END INIT INFO
-test -s /etc/sysconfig/dhcpd && . /etc/sysconfig/dhcpd
-
-SUPPORTS_CHROOT="yes"
-SUPPORTS_RUN_AS="yes"
-SUPPORTS_HUP="no"
-
-DHCPDv_OPT=-4
-test "$SUPPORTS_CHROOT" = no && DHCPD_RUN_CHROOTED=no
-test "$SUPPORTS_RUN_AS" = no && DHCPD_RUN_AS=""
-test "$DHCPD_BINARY" = "/usr/sbin/dhcpd.lpf" -o \
- "$DHCPD_BINARY" = "/usr/sbin/dhcpd.bsd" && \
-DHCPD_BINARY=/usr/sbin/dhcpd
-DHCPD_CONF_INCLUDE_FILES=${DHCPD_CONF_INCLUDE_FILES:-/etc/dhcpd.d}
-
-DAEMON='ISC DHCPv4 4.x Server'
-DAEMON_BIN=${DHCPD_BINARY:=/usr/sbin/dhcpd}
-DAEMON_CONF=/etc/dhcpd.conf
-DAEMON_STATE=/var/lib/dhcp
-DAEMON_LEASES=dhcpd.leases
-# note: $DAEMON_PIDFILE is a symlink to the
-# $DAEMON_STATE$DAEMON_PIDFILE (also
-# while DHCPD_RUN_CHROOTED=no) now,
-# as DHCPD_RUN_AS is not allowed to
-# create pid files in /var/run.
-DAEMON_PIDFILE=/var/run/dhcpd.pid
-STARTPROC_LOGFILE=/var/log/rc.dhcpd.log
-LDAP_CONF=/etc/openldap/ldap.conf
-
-test "$DHCPD_RUN_CHROOTED" = "yes" && \
-CHROOT_PREFIX="$DAEMON_STATE" || CHROOT_PREFIX=''
-
-# Shell functions sourced from /etc/rc.status:
-# rc_check check and set local and overall rc status
-# rc_status check and set local and overall rc status
-# rc_status -v ditto but be verbose in local rc status
-# rc_status -v -r ditto and clear the local rc status
-# rc_failed set local and overall rc status to failed
-# rc_failed <num> set local and overall rc status to <num><num>
-# rc_reset clear local rc status (overall remains)
-# rc_exit exit appropriate to overall rc status
-. /etc/rc.status
-
-# First reset status of this service
-rc_reset
-
-# Return values acc. to LSB for all commands but status:
-# 0 - success
-# 1 - generic or unspecified error
-# 2 - invalid or excess argument(s)
-# 3 - unimplemented feature (e.g. "reload")
-# 4 - insufficient privilege
-# 5 - program is not installed
-# 6 - program is not configured
-# 7 - program is not running
-#
-# Note that starting an already running service, stopping
-# or restarting a not-running service as well as the restart
-# with force-reload (in case signalling is not supported) are
-# considered a success.
-
-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
-if ! [ -r "$DAEMON_CONF" ] ; then
- 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
-# (these can occur if dhcpd does not start correctly)
-test -e $DAEMON_PIDFILE && ! test -s $DAEMON_PIDFILE && rm $DAEMON_PIDFILE
-test -e $DAEMON_STATE/$DAEMON_PIDFILE && ! test -s $DAEMON_STATE/$DAEMON_PIDFILE && rm $DAEMON_STATE/$DAEMON_PIDFILE
-
-case "$1" in
- start)
- echo -n "Starting $DAEMON "
-
- ## If there is no conf file, skip starting of dhcpd
- ## and return with "program not configured"
- if ! [ -f $DAEMON_CONF ]; then
- echo -n "... no configuration file found";
- # Tell the user this has skipped
- rc_status -s
- # service is not configured
- exit 6;
- fi
-
- ## If the interfaces are not set, skip starting of dhcpd
- ## and return with "program not configured"
- if [ -z "$DHCPD_INTERFACE" ]; then
- var="DHCPD_INTERFACE"
- case $DHCPDv_OPT in -6) var=DHCPD6_INTERFACE ;; esac
- echo -n "... set $var in /etc/sysconfig/dhcpd"
- # Tell the user this has skipped
- rc_status -s
- # service is not configured
- exit 6;
- fi
-
- if [ "$DHCPD_INTERFACE" = "ANY" ]; then
- DHCPD_INTERFACE=""
- fi
-
- jail=${CHROOT_PREFIX:-${DAEMON_STATE}}; leases=$DAEMON_LEASES
- if ! [ -e $jail/db/$leases ]; then
- # until 9.0, the lease file was in /var/lib/dhcp and part of the package
- if test -e $jail/$leases -a '!' -L $jail/$leases; then
- # this is the case where the %post script runs _before_ the old package is
- # removed (i.e., dhcpd.leases has not renamed to .rpmsave yet)
- mv $jail/$leases $jail/db/$leases && \
- ln -s db/$leases $jail/
- elif test -e $jail/$leases.rpmsave; then
- # this is what's left when the package is already gone.
- mv $jail/$leases.rpmsave $jail/db/$leases && \
- ln -s db/$leases $jail/
- else
- # fresh installation:
- # a lease file must be present. the server won't start without
- touch $jail/db/$leases
- fi
- fi
-
- if test "$DHCPD_RUN_CHROOTED" = "yes" ; then
- ## copy the conf file to the chroot jail (dhcpd has to be restarted anyway,
- ## when it has changed) and change path to leases file
- for i in $DAEMON_CONF $DHCPD_CONF_INCLUDE_FILES $LDAP_CONF /etc /dev; do
- if test -d "${i}" ; then
- test -d "$CHROOT_PREFIX/${i}" || \
- mkdir -p "$CHROOT_PREFIX/${i}"
- elif test -e "${i}" ; then
- test -d "$CHROOT_PREFIX/${i%/*}" || \
- mkdir -p "$CHROOT_PREFIX/${i%/*}"
- fi
- done
- rm -f $CHROOT_PREFIX/dev/urandom
- for i in $DAEMON_CONF $DHCPD_CONF_INCLUDE_FILES $LDAP_CONF /etc/{gai.conf,nsswitch.conf,resolv.conf,host.conf,hosts,localtime,bindresvport.blacklist} /dev/urandom; do
- if ! test -e "$i"; then continue; fi # neither of them is absolutely necessary
- cp -aL "$i" "${CHROOT_PREFIX}/${i%/*}/" &>/dev/null \
- || { echo "...$0:$LINENO: could not copy $i to chroot jail"; rc_failed; rc_status -v1; exit 6; }
- done
- libdir=$(basename $(echo ${CHROOT_PREFIX}/lib*))
- if test -x /usr/bin/ldd ; then
- get_ldd_deps()
- {
- ldd_wl="\/${libdir}\/lib"
- ldd_bl="\/${libdir}\/libc\."
- /usr/bin/ldd "$1" | \
- while read -sr a b c d ; do
- [ -n "$c" ] || continue
- [[ $c =~ $ldd_wl ]] || continue
- [[ $c =~ $ldd_bl ]] && continue
- echo $c
- done
- }
- else
- get_ldd_deps() { :; }
- fi
- cplibs=`for i in /$libdir/{libresolv.so.*,libnss_*.so.*} \
- /$libdir/{libpthread.so.0,libdl.so.2,libgcc_s.so.*} ;
- do
- if [ -s "$i" ] ; then
- echo "$i"
- get_ldd_deps "$i"
- fi
- done | sort -u`
- for i in $cplibs ; do
- if [ -s "$i" ]; then
- cp -pL "$i" "${CHROOT_PREFIX}/$libdir/" \
- || { echo "...$0:$LINENO: could not copy $i to chroot jail"; rc_failed; rc_status -v1; exit 6; }
- fi
- done
-
- # mount /proc into the chroot; the server fails if unable to read /proc/net/{dev,if_inet6}
- mkdir -p ${CHROOT_PREFIX}/proc
- mount -t proc -o ro proc ${CHROOT_PREFIX}/proc 2>/dev/null
-
- DHCPD_ARGS="-chroot $CHROOT_PREFIX -lf /db/$DAEMON_LEASES"
-
- ## If there is a pid file containing a pid, the machine might have crashed. pid files in
- ## /var/run are always cleaned up at boot time, but this is not the case for the pid file in
- ## the chroot jail. Therefore, and old pid file may exist. This is only a problem if it
- ## incidentally contains the pid of a running process. If this process is not a 'dhcpd',
- ## we remove the pid. (dhcpd itself only checks whether the pid is alive or not.)
- if test -s $DAEMON_STATE/$DAEMON_PIDFILE; then
- p=$(<$DAEMON_STATE/$DAEMON_PIDFILE)
- if test -n "$p" && grep -qsE "^${DAEMON_BIN}" "/proc/$p/cmdline" ; then
- echo -n '(already running) '
- else
- rm -f $DAEMON_STATE/$DAEMON_PIDFILE
- fi
- fi
- PID_FILE_ARG="$DAEMON_PIDFILE"
- else
- DHCPD_ARGS="-lf ${DAEMON_STATE}/db/$DAEMON_LEASES"
- PID_FILE_ARG="$DAEMON_STATE$DAEMON_PIDFILE"
- fi
-
- if [ -n "$DHCPD_RUN_AS" ]; then
- DHCPD_RUN_AS_GROUP="$(getent group $(getent passwd $DHCPD_RUN_AS | cut -d: -f4) | cut -d: -f1)"
- DHCPD_ARGS="$DHCPD_ARGS -user $DHCPD_RUN_AS -group $DHCPD_RUN_AS_GROUP"
-
- chown "${DHCPD_RUN_AS}:${DHCPD_RUN_AS_GROUP}" \
- "$DAEMON_STATE/${DAEMON_PIDFILE%/*}"
- fi
-
-
- ## check syntax with -t (output to log file) and start only when the syntax is okay
- rm -f $STARTPROC_LOGFILE # start log
- error=0
- if ! $DAEMON_BIN $DHCPDv_OPT -t -cf $CHROOT_PREFIX/$DAEMON_CONF -pf $PID_FILE_ARG > $STARTPROC_LOGFILE 2>&1 ; then
- error=1
- else
- ## Start daemon. If this fails the return value is set appropriate.
- ## The init script should return 0, even if service is already running,
- ## to match the LSB spec.
-
- test "$2" = "-v" && echo -en \
- "\nexecuting '$DAEMON_BIN $DHCPDv_OPT -cf $DAEMON_CONF -pf $PID_FILE_ARG $DHCPD_ARGS $DHCPD_OTHER_ARGS $DHCPD_INTERFACE'"
-
- $DAEMON_BIN $DHCPDv_OPT -cf $DAEMON_CONF -pf $PID_FILE_ARG $DHCPD_ARGS $DHCPD_OTHER_ARGS $DHCPD_INTERFACE &> $STARTPROC_LOGFILE
- ret=$?
- fi
-
- if [ $error -gt 0 -o ${ret:-0} -gt 0 ]; then
- ## be verbose
- echo ""
- echo -n " please see $STARTPROC_LOGFILE for details "
- ## set status to failed
- rc_failed
- else
- ln -sf "$DAEMON_STATE$DAEMON_PIDFILE" "$DAEMON_PIDFILE"
- [ "$DHCPD_RUN_CHROOTED" = "yes" ] && echo -n "[chroot]" || :
- fi
-
- # Remember status and be verbose
- rc_status -v
- ;;
- stop)
- echo -n "Shutting down $DAEMON "
-
- # Catch the case where daemon is running without chroot,
- # but sysconfig/dhcp has been changed to use chroot (and
- # another way around).
- # In this case is there is no $chroot/$pidfile, but there
- # should be a /pidfile that we use instead.
- # We can not kill without pid file or dhcp4 kills dhcp6.
- PID_FILE="$DAEMON_STATE$DAEMON_PIDFILE"
- if test "$DHCPD_RUN_CHROOTED" = "yes" ; then
- if test ! -s "$DAEMON_STATE$DAEMON_PIDFILE" -a \
- -s "$DAEMON_PIDFILE" ; then
- PID_FILE="$DAEMON_PIDFILE"
- fi
- else
- if test ! -s "$DAEMON_PIDFILE" -a \
- -s "$DAEMON_STATE$DAEMON_PIDFILE" ; then
- PID_FILE="$DAEMON_STATE$DAEMON_PIDFILE"
- fi
- fi
-
- ## Stop daemon with killproc(8) and if this fails
- ## set echo the echo return value.
- killproc -p "$PID_FILE" $DAEMON_BIN
- ret=$?
-
- # umount proc and remove libraries from the chroot jail,
- # so they are not left over if the server is deinstalled
- if [ "$DHCPD_RUN_CHROOTED" = yes -a -n "$CHROOT_PREFIX" ]; then
- umount ${CHROOT_PREFIX}/proc 2>/dev/null
- rm -f $CHROOT_PREFIX/lib*/*
- fi
-
- # Remember status and be verbose
- rc_failed $ret
- rc_status -v
- ;;
- try-restart)
- ## Do a restart only if the service was active before.
- ## Note: try-restart is now part of LSB (as of 1.9).
- ## RH has a similar command named condrestart.
- $0 status
- if test $? = 0; then
- $0 restart
- else
- rc_reset # Not running is not a failure.
- fi
- # Remember status and be quiet
- rc_status
- ;;
- restart)
- ## Check syntax and when it is OK, stop the service
- ## and regardless of whether it was running or not,
- ## start it again.
- if ! $0 check-syntax &>/dev/null ; then
- echo -n "Syntax check reports errors, see log messages"
- rc_failed
- rc_status -v
- else
- $0 stop
- sleep 3
- $0 start
- # Remember status and be quiet
- rc_status
- fi
- ;;
- force-reload)
- ## Signal the daemon to reload its config. Most daemons
- ## do this on signal 1 (SIGHUP).
- ## If it does not support it, restart.
-
- if [ "$SUPPORTS_HUP" = "yes" ]; then
- echo -n "Reload service $DAEMON"
- killproc -p $DAEMON_STATE/$DAEMON_PIDFILE -HUP $DAEMON_BIN
- #touch $DAEMON_STATE/$DAEMON_PIDFILE
- rc_status -v
- elif ! $0 check-syntax &>/dev/null ; then
- echo -n "Syntax check reports errors, see log messages"
- rc_failed
- rc_status -v
- else
- $0 stop && sleep 3 && $0 start
- rc_status
- fi
- ;;
- reload)
- ## Like force-reload, but if daemon does not support
- ## signalling, do nothing (!)
-
- echo -n "Reload service $DAEMON"
- if [ "$SUPPORTS_HUP" = "yes" ]; then
- # If it supports signalling:
- killproc -p $DAEMON_STATE/$DAEMON_PIDFILE -HUP $DAEMON_BIN
- #touch $DAEMON_STATE/$DAEMON_PIDFILE
- rc_status -v
- else
- ## Otherwise if it does not support reload:
- rc_failed 3
- rc_status -v
- fi
- ;;
- status)
- echo -n "Checking for $DAEMON: "
- ## Check status with checkproc(8), if process is running
- ## checkproc will return with exit status 0.
-
- # Status has a slightly different for the status command:
- # 0 - service running
- # 1 - service dead, but /var/run/ pid file exists
- # 2 - service dead, but /var/lock/ lock file exists
- # 3 - service not running
-
- # NOTE: checkproc returns LSB compliant status values.
- checkproc -p $DAEMON_STATE/$DAEMON_PIDFILE $DAEMON_BIN
- rc_status -v
- ;;
- probe)
- ## Optional: Probe for the necessity of a reload,
- ## give out the argument which is required for a reload.
-
- rc=0
- for i in /etc/sysconfig/dhcpd $DAEMON_CONF $DHCPD_CONF_INCLUDE_FILES; do
- test $i -nt $DAEMON_STATE/$DAEMON_PIDFILE && rc=1
- done
- test $rc = 1 && echo restart
- ;;
- check-syntax|syntax-check)
- echo -n "Checking syntax of $DAEMON_CONF: "
-
- ## this nice bit is from Edwin Groothuis:
- ## check syntax (quiet)
- $DAEMON_BIN $DHCPDv_OPT -q -t -cf $DAEMON_CONF
- rc_status
- if [ $? -ne 0 ]; then
- echo ""
- ## check syntax (verbose)
- $DAEMON_BIN $DHCPDv_OPT -t -cf $DAEMON_CONF
- echo -ne '\nConfig is NOT okay'
- rc_failed
- fi
- rc_status -v
- ;;
- check-lease|check-lease-file)
- echo -n "Checking lease file $DAEMON_LEASES: "
-
- if [ -s ${DAEMON_STATE}/db/$DAEMON_LEASES ] ; then
- ## check leases file (quiet)
- $DAEMON_BIN $DHCPDv_OPT -q -T -cf /dev/null -lf ${DAEMON_STATE}/db/$DAEMON_LEASES
- rc_status
- if [ $? -ne 0 ]; then
- echo ""
- ## check leases file (verbose)
- $DAEMON_BIN $DHCPDv_OPT -T -cf $DAEMON_CONF -lf ${DAEMON_STATE}/db/$DAEMON_LEASES
- echo -ne '\nLease file is NOT okay'
- rc_failed
- fi
- else
- rc_status -u
- fi
- rc_status -v
- ;;
- *)
- echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload|probe|check-syntax} [-v]"
- exit 1
+test -x /usr/lib/dhcp/dhcpd || exit 5
+case $1 in
+start|stop|try-restart|restart|force-reload|reload|status|probe|*)
+ export SCRIPT=${0##*/}
+ exec /usr/lib/dhcp/dhcpd -4 "$@" || exit 1
+;;
esac
-rc_exit
+
++++++ rc.dhcpd6 ++++++
--- /var/tmp/diff_new_pack.3H7W85/_old 2014-02-13 06:44:50.000000000 +0100
+++ /var/tmp/diff_new_pack.3H7W85/_new 2014-02-13 06:44:50.000000000 +0100
@@ -41,432 +41,11 @@
# needs to rely on time synchronisation.)
### END INIT INFO
-test -s /etc/sysconfig/dhcpd && . /etc/sysconfig/dhcpd
-
-SUPPORTS_CHROOT="yes"
-SUPPORTS_RUN_AS="yes"
-SUPPORTS_HUP="no"
-
-DHCPDv_OPT=-6
-DHCPD_RUN_CHROOTED=$DHCPD6_RUN_CHROOTED
-DHCPD_RUN_AS=$DHCPD6_RUN_AS
-DHCPD_BINARY=$DHCPD6_BINARY
-DHCPD_INTERFACE=$DHCPD6_INTERFACE
-DHCPD_CONF_INCLUDE_FILES=${DHCPD6_CONF_INCLUDE_FILES:-/etc/dhcpd6.d}
-DHCPD_OTHER_ARGS=$DHCPD6_OTHER_ARGS
-
-test "$SUPPORTS_CHROOT" = no && DHCPD_RUN_CHROOTED=no
-test "$SUPPORTS_RUN_AS" = no && DHCPD_RUN_AS=""
-
-DAEMON='ISC DHCPv6 4.x Server'
-DAEMON_BIN=${DHCPD_BINARY:=/usr/sbin/dhcpd6}
-DAEMON_CONF=/etc/dhcpd6.conf
-DAEMON_STATE=/var/lib/dhcp6
-DAEMON_LEASES=dhcpd6.leases
-# note: $DAEMON_PIDFILE is a symlink to the
-# $DAEMON_STATE$DAEMON_PIDFILE (also
-# while DHCPD_RUN_CHROOTED=no) now,
-# as DHCPD_RUN_AS is not allowed to
-# create pid files in /var/run.
-DAEMON_PIDFILE=/var/run/dhcpd6.pid
-STARTPROC_LOGFILE=/var/log/rc.dhcpd6.log
-LDAP_CONF=
-
-test "$DHCPD_RUN_CHROOTED" = "yes" && \
-CHROOT_PREFIX="$DAEMON_STATE" || CHROOT_PREFIX=''
-
-# Shell functions sourced from /etc/rc.status:
-# rc_check check and set local and overall rc status
-# rc_status check and set local and overall rc status
-# rc_status -v ditto but be verbose in local rc status
-# rc_status -v -r ditto and clear the local rc status
-# rc_failed set local and overall rc status to failed
-# rc_failed <num> set local and overall rc status to <num><num>
-# rc_reset clear local rc status (overall remains)
-# rc_exit exit appropriate to overall rc status
-. /etc/rc.status
-
-# First reset status of this service
-rc_reset
-
-# Return values acc. to LSB for all commands but status:
-# 0 - success
-# 1 - generic or unspecified error
-# 2 - invalid or excess argument(s)
-# 3 - unimplemented feature (e.g. "reload")
-# 4 - insufficient privilege
-# 5 - program is not installed
-# 6 - program is not configured
-# 7 - program is not running
-#
-# Note that starting an already running service, stopping
-# or restarting a not-running service as well as the restart
-# with force-reload (in case signalling is not supported) are
-# considered a success.
-
-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
-if ! [ -r "$DAEMON_CONF" ] ; then
- 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
-# (these can occur if dhcpd does not start correctly)
-test -e $DAEMON_PIDFILE && ! test -s $DAEMON_PIDFILE && rm $DAEMON_PIDFILE
-test -e $DAEMON_STATE/$DAEMON_PIDFILE && ! test -s $DAEMON_STATE/$DAEMON_PIDFILE && rm $DAEMON_STATE/$DAEMON_PIDFILE
-
-case "$1" in
- start)
- echo -n "Starting $DAEMON "
-
- ## If there is no conf file, skip starting of dhcpd
- ## and return with "program not configured"
- if ! [ -f $DAEMON_CONF ]; then
- echo -n "... no configuration file found";
- # Tell the user this has skipped
- rc_status -s
- # service is not configured
- exit 6;
- fi
-
- ## If the interfaces are not set, skip starting of dhcpd
- ## and return with "program not configured"
- if [ -z "$DHCPD_INTERFACE" ]; then
- var="DHCPD_INTERFACE"
- case $DHCPDv_OPT in -6) var=DHCPD6_INTERFACE ;; esac
- echo -n "... set $var in /etc/sysconfig/dhcpd"
- # Tell the user this has skipped
- rc_status -s
- # service is not configured
- exit 6;
- fi
-
- if [ "$DHCPD_INTERFACE" = "ANY" ]; then
- DHCPD_INTERFACE=""
- fi
-
- jail=${CHROOT_PREFIX:-${DAEMON_STATE}}; leases=$DAEMON_LEASES
- if ! [ -e $jail/db/$leases ]; then
- # until 9.0, the lease file was in /var/lib/dhcp and part of the package
- if test -e $jail/$leases -a '!' -L $jail/$leases; then
- # this is the case where the %post script runs _before_ the old package is
- # removed (i.e., dhcpd.leases has not renamed to .rpmsave yet)
- mv $jail/$leases $jail/db/$leases && \
- ln -s db/$leases $jail/
- elif test -e $jail/$leases.rpmsave; then
- # this is what's left when the package is already gone.
- mv $jail/$leases.rpmsave $jail/db/$leases && \
- ln -s db/$leases $jail/
- else
- # fresh installation:
- # a lease file must be present. the server won't start without
- touch $jail/db/$leases
- fi
- fi
-
- if test "$DHCPD_RUN_CHROOTED" = "yes" ; then
- ## copy the conf file to the chroot jail (dhcpd has to be restarted anyway,
- ## when it has changed) and change path to leases file
- for i in $DAEMON_CONF $DHCPD_CONF_INCLUDE_FILES $LDAP_CONF /etc /dev; do
- if test -d "${i}" ; then
- test -d "$CHROOT_PREFIX/${i}" || \
- mkdir -p "$CHROOT_PREFIX/${i}"
- elif test -e "${i}" ; then
- test -d "$CHROOT_PREFIX/${i%/*}" || \
- mkdir -p "$CHROOT_PREFIX/${i%/*}"
- fi
- done
- rm -f $CHROOT_PREFIX/dev/urandom
- for i in $DAEMON_CONF $DHCPD_CONF_INCLUDE_FILES $LDAP_CONF /etc/{gai.conf,nsswitch.conf,resolv.conf,host.conf,hosts,localtime,bindresvport.blacklist} /dev/urandom; do
- if ! test -e "$i"; then continue; fi # neither of them is absolutely necessary
- cp -aL "$i" "${CHROOT_PREFIX}/${i%/*}/" &>/dev/null \
- || { echo "...$0:$LINENO: could not copy $i to chroot jail"; rc_failed; rc_status -v1; exit 6; }
- done
- libdir=$(basename $(echo ${CHROOT_PREFIX}/lib*))
- if test -x /usr/bin/ldd ; then
- get_ldd_deps()
- {
- ldd_wl="\/${libdir}\/lib"
- ldd_bl="\/${libdir}\/libc\."
- /usr/bin/ldd "$1" | \
- while read -sr a b c d ; do
- [ -n "$c" ] || continue
- [[ $c =~ $ldd_wl ]] || continue
- [[ $c =~ $ldd_bl ]] && continue
- echo $c
- done
- }
- else
- get_ldd_deps() { :; }
- fi
- cplibs=`for i in /$libdir/{libresolv.so.*,libnss_*.so.*} \
- /$libdir/{libpthread.so.0,libdl.so.2,libgcc_s.so.*} ;
- do
- if [ -s "$i" ] ; then
- echo "$i"
- get_ldd_deps "$i"
- fi
- done | sort -u`
- for i in $cplibs ; do
- if [ -s "$i" ]; then
- cp -pL "$i" "${CHROOT_PREFIX}/$libdir/" \
- || { echo "...$0:$LINENO: could not copy $i to chroot jail"; rc_failed; rc_status -v1; exit 6; }
- fi
- done
-
- # mount /proc into the chroot; the server fails if unable to read /proc/net/{dev,if_inet6}
- mkdir -p ${CHROOT_PREFIX}/proc
- mount -t proc -o ro proc ${CHROOT_PREFIX}/proc 2>/dev/null
-
- DHCPD_ARGS="-chroot $CHROOT_PREFIX -lf /db/$DAEMON_LEASES"
-
- ## If there is a pid file containing a pid, the machine might have crashed. pid files in
- ## /var/run are always cleaned up at boot time, but this is not the case for the pid file in
- ## the chroot jail. Therefore, and old pid file may exist. This is only a problem if it
- ## incidentally contains the pid of a running process. If this process is not a 'dhcpd',
- ## we remove the pid. (dhcpd itself only checks whether the pid is alive or not.)
- if test -s $DAEMON_STATE/$DAEMON_PIDFILE; then
- p=$(<$DAEMON_STATE/$DAEMON_PIDFILE)
- if test -n "$p" && grep -qsE "^${DAEMON_BIN}" "/proc/$p/cmdline" ; then
- echo -n '(already running) '
- else
- rm -f $DAEMON_STATE/$DAEMON_PIDFILE
- fi
- fi
- PID_FILE_ARG="$DAEMON_PIDFILE"
- else
- DHCPD_ARGS="-lf ${DAEMON_STATE}/db/$DAEMON_LEASES"
- PID_FILE_ARG="$DAEMON_STATE$DAEMON_PIDFILE"
- fi
-
- if [ -n "$DHCPD_RUN_AS" ]; then
- DHCPD_RUN_AS_GROUP="$(getent group $(getent passwd $DHCPD_RUN_AS | cut -d: -f4) | cut -d: -f1)"
- DHCPD_ARGS="$DHCPD_ARGS -user $DHCPD_RUN_AS -group $DHCPD_RUN_AS_GROUP"
-
- chown "${DHCPD_RUN_AS}:${DHCPD_RUN_AS_GROUP}" \
- "$DAEMON_STATE/${DAEMON_PIDFILE%/*}"
- fi
-
-
- ## check syntax with -t (output to log file) and start only when the syntax is okay
- rm -f $STARTPROC_LOGFILE # start log
- error=0
- if ! $DAEMON_BIN $DHCPDv_OPT -t -cf $CHROOT_PREFIX/$DAEMON_CONF -pf $PID_FILE_ARG > $STARTPROC_LOGFILE 2>&1 ; then
- error=1
- else
- ## Start daemon. If this fails the return value is set appropriate.
- ## The init script should return 0, even if service is already running,
- ## to match the LSB spec.
-
- test "$2" = "-v" && echo -en \
- "\nexecuting '$DAEMON_BIN $DHCPDv_OPT -cf $DAEMON_CONF -pf $PID_FILE_ARG $DHCPD_ARGS $DHCPD_OTHER_ARGS $DHCPD_INTERFACE'"
-
- $DAEMON_BIN $DHCPDv_OPT -cf $DAEMON_CONF -pf $PID_FILE_ARG $DHCPD_ARGS $DHCPD_OTHER_ARGS $DHCPD_INTERFACE &> $STARTPROC_LOGFILE
- ret=$?
- fi
-
- if [ $error -gt 0 -o ${ret:-0} -gt 0 ]; then
- ## be verbose
- echo ""
- echo -n " please see $STARTPROC_LOGFILE for details "
- ## set status to failed
- rc_failed
- else
- ln -sf "$DAEMON_STATE$DAEMON_PIDFILE" "$DAEMON_PIDFILE"
- [ "$DHCPD_RUN_CHROOTED" = "yes" ] && echo -n "[chroot]" || :
- fi
-
- # Remember status and be verbose
- rc_status -v
- ;;
- stop)
- echo -n "Shutting down $DAEMON "
-
- # Catch the case where daemon is running without chroot,
- # but sysconfig/dhcp has been changed to use chroot (and
- # another way around).
- # In this case is there is no $chroot/$pidfile, but there
- # should be a /pidfile that we use instead.
- # We can not kill without pid file or dhcp4 kills dhcp6.
- PID_FILE="$DAEMON_STATE$DAEMON_PIDFILE"
- if test "$DHCPD_RUN_CHROOTED" = "yes" ; then
- if test ! -s "$DAEMON_STATE$DAEMON_PIDFILE" -a \
- -s "$DAEMON_PIDFILE" ; then
- PID_FILE="$DAEMON_PIDFILE"
- fi
- else
- if test ! -s "$DAEMON_PIDFILE" -a \
- -s "$DAEMON_STATE$DAEMON_PIDFILE" ; then
- PID_FILE="$DAEMON_STATE$DAEMON_PIDFILE"
- fi
- fi
-
- ## Stop daemon with killproc(8) and if this fails
- ## set echo the echo return value.
- killproc -p "$PID_FILE" $DAEMON_BIN
- ret=$?
-
- # umount proc and remove libraries from the chroot jail,
- # so they are not left over if the server is deinstalled
- if [ "$DHCPD_RUN_CHROOTED" = yes -a -n "$CHROOT_PREFIX" ]; then
- umount ${CHROOT_PREFIX}/proc 2>/dev/null
- rm -f $CHROOT_PREFIX/lib*/*
- fi
-
- # Remember status and be verbose
- rc_failed $ret
- rc_status -v
- ;;
- try-restart)
- ## Do a restart only if the service was active before.
- ## Note: try-restart is now part of LSB (as of 1.9).
- ## RH has a similar command named condrestart.
- $0 status
- if test $? = 0; then
- $0 restart
- else
- rc_reset # Not running is not a failure.
- fi
- # Remember status and be quiet
- rc_status
- ;;
- restart)
- ## Check syntax and when it is OK, stop the service
- ## and regardless of whether it was running or not,
- ## start it again.
- if ! $0 check-syntax &>/dev/null ; then
- echo -n "Syntax check reports errors, see log messages"
- rc_failed
- rc_status -v
- else
- $0 stop
- sleep 3
- $0 start
- # Remember status and be quiet
- rc_status
- fi
- ;;
- force-reload)
- ## Signal the daemon to reload its config. Most daemons
- ## do this on signal 1 (SIGHUP).
- ## If it does not support it, restart.
-
- if [ "$SUPPORTS_HUP" = "yes" ]; then
- echo -n "Reload service $DAEMON"
- killproc -p $DAEMON_STATE/$DAEMON_PIDFILE -HUP $DAEMON_BIN
- #touch $DAEMON_STATE/$DAEMON_PIDFILE
- rc_status -v
- elif ! $0 check-syntax &>/dev/null ; then
- echo -n "Syntax check reports errors, see log messages"
- rc_failed
- rc_status -v
- else
- $0 stop && sleep 3 && $0 start
- rc_status
- fi
- ;;
- reload)
- ## Like force-reload, but if daemon does not support
- ## signalling, do nothing (!)
-
- echo -n "Reload service $DAEMON"
- if [ "$SUPPORTS_HUP" = "yes" ]; then
- # If it supports signalling:
- killproc -p $DAEMON_STATE/$DAEMON_PIDFILE -HUP $DAEMON_BIN
- #touch $DAEMON_STATE/$DAEMON_PIDFILE
- rc_status -v
- else
- ## Otherwise if it does not support reload:
- rc_failed 3
- rc_status -v
- fi
- ;;
- status)
- echo -n "Checking for $DAEMON: "
- ## Check status with checkproc(8), if process is running
- ## checkproc will return with exit status 0.
-
- # Status has a slightly different for the status command:
- # 0 - service running
- # 1 - service dead, but /var/run/ pid file exists
- # 2 - service dead, but /var/lock/ lock file exists
- # 3 - service not running
-
- # NOTE: checkproc returns LSB compliant status values.
- checkproc -p $DAEMON_STATE/$DAEMON_PIDFILE $DAEMON_BIN
- rc_status -v
- ;;
- probe)
- ## Optional: Probe for the necessity of a reload,
- ## give out the argument which is required for a reload.
-
- rc=0
- for i in /etc/sysconfig/dhcpd $DAEMON_CONF $DHCPD_CONF_INCLUDE_FILES; do
- test $i -nt $DAEMON_STATE/$DAEMON_PIDFILE && rc=1
- done
- test $rc = 1 && echo restart
- ;;
- check-syntax|syntax-check)
- echo -n "Checking syntax of $DAEMON_CONF: "
-
- ## this nice bit is from Edwin Groothuis:
- ## check syntax (quiet)
- $DAEMON_BIN $DHCPDv_OPT -q -t -cf $DAEMON_CONF
- rc_status
- if [ $? -ne 0 ]; then
- echo ""
- ## check syntax (verbose)
- $DAEMON_BIN $DHCPDv_OPT -t -cf $DAEMON_CONF
- echo -ne '\nConfig is NOT okay'
- rc_failed
- fi
- rc_status -v
- ;;
- check-lease|check-lease-file)
- echo -n "Checking lease file $DAEMON_LEASES: "
-
- if [ -s ${DAEMON_STATE}/db/$DAEMON_LEASES ] ; then
- ## check leases file (quiet)
- $DAEMON_BIN $DHCPDv_OPT -q -T -cf /dev/null -lf ${DAEMON_STATE}/db/$DAEMON_LEASES
- rc_status
- if [ $? -ne 0 ]; then
- echo ""
- ## check leases file (verbose)
- $DAEMON_BIN $DHCPDv_OPT -T -cf $DAEMON_CONF -lf ${DAEMON_STATE}/db/$DAEMON_LEASES
- echo -ne '\nLease file is NOT okay'
- rc_failed
- fi
- else
- rc_status -u
- fi
- rc_status -v
- ;;
- *)
- echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload|probe|check-syntax} [-v]"
- exit 1
+test -x /usr/lib/dhcp/dhcpd || exit 5
+case $1 in
+start|stop|try-restart|restart|force-reload|reload|status|probe|*)
+ export SCRIPT=${0##*/}
+ exec /usr/lib/dhcp/dhcpd -6 "$@" || exit 1
+;;
esac
-rc_exit
+
++++++ rc.dhcrelay ++++++
--- /var/tmp/diff_new_pack.3H7W85/_old 2014-02-13 06:44:50.000000000 +0100
+++ /var/tmp/diff_new_pack.3H7W85/_new 2014-02-13 06:44:50.000000000 +0100
@@ -25,197 +25,11 @@
# 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
-DAEMON_PIDFILE=/var/run/dhcrelay.pid
-STARTPROC_LOGFILE=/var/log/rc.dhcrelay.log
-SUPPORTS_HUP="no"
-
-test -s "$DAEMON_CONF" && . "$DAEMON_CONF"
-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
-# rc_status check and set local and overall rc status
-# rc_status -v ditto but be verbose in local rc status
-# rc_status -v -r ditto and clear the local rc status
-# rc_failed set local and overall rc status to failed
-# rc_failed <num> set local and overall rc status to <num><num>
-# rc_reset clear local rc status (overall remains)
-# rc_exit exit appropriate to overall rc status
-. /etc/rc.status
-
-# First reset status of this service
-rc_reset
-
-# Return values acc. to LSB for all commands but status:
-# 0 - success
-# 1 - generic or unspecified error
-# 2 - invalid or excess argument(s)
-# 3 - unimplemented feature (e.g. "reload")
-# 4 - insufficient privilege
-# 5 - program is not installed
-# 6 - program is not configured
-# 7 - program is not running
-#
-# Note that starting an already running service, stopping
-# or restarting a not-running service as well as the restart
-# with force-reload (in case signalling is not supported) are
-# considered a success.
-
-case "$1" in
- start)
- echo -n "Starting $DAEMON"
- 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"
- if [ -z "$DHCRELAY_INTERFACES" -o -z "$DHCRELAY_SERVERS" ]; then
- # Tell the user this has skipped
- rc_status -s
- # service is not configured
- exit 6;
- fi
-
- DHCRELAY_INTERFACES_ARGS=''
- for i in $DHCRELAY_INTERFACES ; do
- DHCRELAY_INTERFACES_ARGS="$DHCRELAY_INTERFACES_ARGS -i $i"
- done
-
- ## Start daemon with startproc(8). If this fails
- ## the echo return value is set appropriate.
-
- # startproc should return 0, even if service is
- # already running to match LSB spec.
- test "$2" = "-v" && echo -en \
- "\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 &>/dev/null
- rc=$?
- if ! [ $rc -eq 0 ]; then
- ## be verbose
- echo ""
- echo -n " please see $STARTPROC_LOGFILE for details "
- ## set status to failed
- rc_failed
- fi
-
- # Remember status and be verbose
- rc_status -v
- ;;
- stop)
- echo -n "Shutting down $DAEMON"
- ## Stop daemon with killproc(8) and if this fails
- ## set echo the echo return value.
-
- killproc -p $DAEMON_PIDFILE $DAEMON_BIN
-
- # Remember status and be verbose
- rc_status -v
- ;;
- try-restart)
- ## Do a restart only if the service was active before.
- ## Note: try-restart is now part of LSB (as of 1.9).
- ## RH has a similar command named condrestart.
- $0 status
- if test $? = 0; then
- $0 restart
- else
- rc_reset # Not running is not a failure.
- fi
- # Remember status and be quiet
- rc_status
- ;;
- restart)
- ## Stop the service and regardless of whether it was
- ## running or not, start it again.
- $0 stop
- sleep 1
- $0 start
-
- # Remember status and be quiet
- rc_status
- ;;
- force-reload)
- ## Signal the daemon to reload its config. Most daemons
- ## do this on signal 1 (SIGHUP).
- ## If it does not support it, restart.
-
- $0 stop && sleep 1 && $0 start
- rc_status
-
- echo -n "Reload service $DAEMON"
-
- if [ "$SUPPORTS_HUP" = "yes" ] ; then
- killproc -p $DAEMON_PIDFILE -HUP $DAEMON_BIN
- #touch $DAEMON_PIDFILE
- rc_status -v
- else
- $0 stop && $0 start
- rc_status
- fi
- ;;
- reload)
- ## Like force-reload, but if daemon does not support
- ## signalling, do nothing (!)
-
- if [ "$SUPPORTS_HUP" = "yes" ] ; then
- # If it supports signalling:
- echo -n "Reload service $DAEMON"
- killproc -p $DAEMON_PIDFILE -HUP $DAEMON_BIN
- #touch $DAEMON_PIDFILE
- rc_status -v
- else
- ## Otherwise if it does not support reload:
- rc_failed 3
- rc_status -v
- fi
- ;;
- status)
- echo -n "Checking for dhcp relay agent: "
- ## Check status with checkproc(8), if process is running
- ## checkproc will return with exit status 0.
-
- # Status has a slightly different for the status command:
- # 0 - service running
- # 1 - service dead, but /var/run/ pid file exists
- # 2 - service dead, but /var/lock/ lock file exists
- # 3 - service not running
-
- # NOTE: checkproc returns LSB compliant status values.
- checkproc -p $DAEMON_PIDFILE $DAEMON_BIN
- rc_status -v
- ;;
- probe)
- ## Optional: Probe for the necessity of a reload,
- ## give out the argument which is required for a reload.
-
- if [ "$DAEMON_CONF" -nt "$DAEMON_PIDFILE" ]; then
- if [ "$SUPPORTS_HUP" = "yes" ]; then
- echo reload
- else
- echo restart
- fi
- fi
- ;;
- *)
- echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload|probe} [-v]"
- exit 1
- ;;
+test -x /usr/lib/dhcp/dhcrelay || exit 5
+case $1 in
+start|stop|try-restart|restart|force-reload|reload|status|probe|*)
+ export SCRIPT=${0##*/}
+ exec /usr/lib/dhcp/dhcrelay -4 "$@" || exit 1
+;;
esac
-rc_exit
+
++++++ rc.dhcrelay6 ++++++
--- /var/tmp/diff_new_pack.3H7W85/_old 2014-02-13 06:44:50.000000000 +0100
+++ /var/tmp/diff_new_pack.3H7W85/_new 2014-02-13 06:44:50.000000000 +0100
@@ -25,205 +25,11 @@
# 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
-DAEMON_PIDFILE=/var/run/dhcrelay6.pid
-STARTPROC_LOGFILE=/var/log/rc.dhcrelay6.log
-SUPPORTS_HUP="no"
-
-test -s "$DAEMON_CONF" && . "$DAEMON_CONF"
-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
-# rc_status check and set local and overall rc status
-# rc_status -v ditto but be verbose in local rc status
-# rc_status -v -r ditto and clear the local rc status
-# rc_failed set local and overall rc status to failed
-# rc_failed <num> set local and overall rc status to <num><num>
-# rc_reset clear local rc status (overall remains)
-# rc_exit exit appropriate to overall rc status
-. /etc/rc.status
-
-# First reset status of this service
-rc_reset
-
-# Return values acc. to LSB for all commands but status:
-# 0 - success
-# 1 - generic or unspecified error
-# 2 - invalid or excess argument(s)
-# 3 - unimplemented feature (e.g. "reload")
-# 4 - insufficient privilege
-# 5 - program is not installed
-# 6 - program is not configured
-# 7 - program is not running
-#
-# Note that starting an already running service, stopping
-# or restarting a not-running service as well as the restart
-# with force-reload (in case signalling is not supported) are
-# considered a success.
-
-case "$1" in
- start)
- echo -n "Starting $DAEMON"
- 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 -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 -o "x$u" = "x-u" && continue
- DHCRELAY6_UPPER_INTERFACES_ARGS="$DHCRELAY6_UPPER_INTERFACES_ARGS -u $u"
- done
-
- ## If interfaces or servers are not set, skip starting of dhcrelay
- ## and return with "program not configured"
- if [ "x$DHCRELAY6_LOWER_INTERFACES_ARGS" = x -o \
- "x$DHCRELAY6_UPPER_INTERFACES_ARGS" = x ]; then
- # Tell the user this has skipped
- rc_status -s
- # service is not configured
- exit 6;
- fi
-
-
- ## Start daemon with startproc(8). If this fails
- ## the echo return value is set appropriate.
-
- # startproc should return 0, even if service is
- # already running to match LSB spec.
- test "$2" = "-v" && echo -en \
- "\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 &>/dev/null
- rc=$?
- if ! [ $rc -eq 0 ]; then
- ## be verbose
- echo ""
- echo -n " please see $STARTPROC_LOGFILE for details ";
- ## set status to failed
- rc_failed
- fi
-
- # Remember status and be verbose
- rc_status -v
- ;;
- stop)
- echo -n "Shutting down $DAEMON"
- ## Stop daemon with killproc(8) and if this fails
- ## set echo the echo return value.
-
- killproc -p $DAEMON_PIDFILE $DAEMON_BIN
-
- # Remember status and be verbose
- rc_status -v
- ;;
- try-restart)
- ## Do a restart only if the service was active before.
- ## Note: try-restart is now part of LSB (as of 1.9).
- ## RH has a similar command named condrestart.
- $0 status
- if test $? = 0; then
- $0 restart
- else
- rc_reset # Not running is not a failure.
- fi
- # Remember status and be quiet
- rc_status
- ;;
- restart)
- ## Stop the service and regardless of whether it was
- ## running or not, start it again.
- $0 stop
- sleep 1
- $0 start
-
- # Remember status and be quiet
- rc_status
- ;;
- force-reload)
- ## Signal the daemon to reload its config. Most daemons
- ## do this on signal 1 (SIGHUP).
- ## If it does not support it, restart.
-
- $0 stop && sleep 1 && $0 start
- rc_status
-
- echo -n "Reload service $DAEMON"
-
- if [ "$SUPPORTS_HUP" = "yes" ] ; then
- killproc -p $DAEMON_PIDFILE -HUP $DAEMON_BIN
- #touch $DAEMON_PIDFILE
- rc_status -v
- else
- $0 stop && $0 start
- rc_status
- fi
- ;;
- reload)
- ## Like force-reload, but if daemon does not support
- ## signalling, do nothing (!)
-
- if [ "$SUPPORTS_HUP" = "yes" ] ; then
- # If it supports signalling:
- echo -n "Reload service $DAEMON"
- killproc -p $DAEMON_PIDFILE -HUP $DAEMON_BIN
- #touch $DAEMON_PIDFILE
- rc_status -v
- else
- ## Otherwise if it does not support reload:
- rc_failed 3
- rc_status -v
- fi
- ;;
- status)
- echo -n "Checking for dhcp relay agent: "
- ## Check status with checkproc(8), if process is running
- ## checkproc will return with exit status 0.
-
- # Status has a slightly different for the status command:
- # 0 - service running
- # 1 - service dead, but /var/run/ pid file exists
- # 2 - service dead, but /var/lock/ lock file exists
- # 3 - service not running
-
- # NOTE: checkproc returns LSB compliant status values.
- checkproc -p $DAEMON_PIDFILE $DAEMON_BIN
- rc_status -v
- ;;
- probe)
- ## Optional: Probe for the necessity of a reload,
- ## give out the argument which is required for a reload.
-
- if [ "$DAEMON_CONF" -nt "$DAEMON_PIDFILE" ]; then
- if [ "$SUPPORTS_HUP" = "yes" ]; then
- echo reload
- else
- echo restart
- fi
- fi
- ;;
- *)
- echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload|probe} [-v]"
- exit 1
- ;;
+test -x /usr/lib/dhcp/dhcrelay || exit 5
+case $1 in
+start|stop|try-restart|restart|force-reload|reload|status|probe|*)
+ export SCRIPT=${0##*/}
+ exec /usr/lib/dhcp/dhcrelay -6 "$@" || exit 1
+;;
esac
-rc_exit
+
++++++ sysconfig.dhcpd ++++++
--- /var/tmp/diff_new_pack.3H7W85/_old 2014-02-13 06:44:50.000000000 +0100
+++ /var/tmp/diff_new_pack.3H7W85/_new 2014-02-13 06:44:50.000000000 +0100
@@ -182,25 +182,3 @@
#
DHCPD6_OTHER_ARGS=""
-## Type: string
-## Default: ""
-## ServiceRestart: dhcpd
-#
-# You may specify another dhcpd binary to be run.
-# The full path needs to be specified.
-#
-# If empty, the default applies.
-#
-DHCPD_BINARY=""
-
-## Type: string
-## Default: ""
-## ServiceRestart: dhcpd6
-#
-# You may specify another dhcpd binary to be run.
-# The full path needs to be specified.
-#
-# If empty, the default applies.
-#
-DHCPD6_BINARY=""
-
--
To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-commit+help@opensuse.org