3 %bcond_without ldap # without support for ldap storage
4 %bcond_without static_libs # don't build static library
5 %bcond_without systemd # without systemd units
12 %define pverdot %{nil}
13 %define pverdir %{nil}
17 %define vvendor PLD/Linux
19 Summary(es.UTF-8): Servidor DHCP
20 Summary(pl.UTF-8): Serwer DHCP
21 Summary(pt_BR.UTF-8): Servidor DHCP (Protocolo de configuração dinâmica de hosts)
23 Version: %{ver}%{pverdot}
27 Group: Networking/Daemons
28 Source0: ftp://ftp.isc.org/isc/dhcp/%{ver}%{pverdir}/%{name}-%{ver}%{pverdir}.tar.gz
29 # Source0-md5: 9076af4cc1293dde5a7c6cae7de6ab45
31 Source2: %{name}6.init
32 Source3: %{name}-relay.init
33 Source4: %{name}.sysconfig
34 Source5: %{name}-relay.sysconfig
35 Source6: dhcpd.service
36 Source7: dhcpd6.service
37 Source8: dhcp-relay.service
38 Source10: %{name}.schema
39 Source11: %{name}-README.ldap
40 Source12: draft-ietf-dhc-ldap-schema-01.txt
41 Source13: %{name}d-conf-to-ldap
42 Patch0: %{name}-release-by-ifup.patch
43 Patch1: %{name}-3.0.3-x-option.patch
44 Patch2: %{name}-paths.patch
45 Patch3: %{name}-timeouts.patch
46 Patch4: %{name}-options.patch
47 Patch5: %{name}-errwarn-message.patch
48 Patch6: %{name}-memory.patch
49 Patch7: %{name}-unicast-bootp.patch
50 Patch8: %{name}-default-requested-options.patch
51 Patch9: %{name}-manpages.patch
52 Patch10: %{name}-extravars.patch
53 Patch11: systemd-notify.patch
54 Patch12: %{name}-CLOEXEC.patch
55 Patch13: %{name}-garbage-in-format-string-error.patch
56 Patch14: %{name}-handle-null-timouet.patch
57 Patch15: %{name}-capabilities.patch
58 Patch16: %{name}-rfc3442-classless-static-routes.patch
59 Patch17: %{name}-ppp.patch
60 Patch18: %{name}-lpf-ib.patch
61 Patch19: %{name}-add-guid-duid-to-logs.patch
62 Patch20: %{name}-duid_uuid.patch
63 Patch21: %{name}-client-request-release-bind-iface.patch
64 Patch22: %{name}-no-subnet-error2info.patch
65 Patch23: %{name}-stateless-duid-llt.patch
66 Patch24: %{name}-hwaddress.patch
67 Patch25: %{name}-confparse.patch
68 Patch26: %{name}-link-local-address.patch
69 Patch27: %{name}-option97-pxe-client-id.patch
70 Patch28: %{name}-detect-time-changes.patch
71 Patch29: bind-detect-time-changes.patch
72 Patch30: bind-system-getaddrinfo.patch
73 URL: https://www.isc.org/dhcp/
74 BuildRequires: autoconf
75 BuildRequires: automake
78 BuildRequires: libatomic-devel
80 BuildRequires: libtool
81 %{?with_ldap:BuildRequires: openldap-devel}
82 %{?with_ldap:BuildRequires: openssl-devel}
83 BuildRequires: rpmbuild(macros) >= 1.644
84 %{?with_systemd:BuildRequires: systemd-devel}
85 Requires(post): coreutils
86 Requires(post,preun): /sbin/chkconfig
87 Requires: rc-scripts >= 0.2.0
88 %{?with_systemd:Requires: systemd-units >= 38}
90 Obsoletes: dhcpv6-server
91 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
93 %define _sbindir /sbin
94 %define schemadir /usr/share/openldap/schema
97 DHCP (Dynamic Host Configuration Protocol) is a protocol which allows
98 individual devices on an IP network to get their own network
99 configuration information (IP address, subnetmask, broadcast address,
100 etc.) from a DHCP server. The overall purpose of DHCP is to make it
101 easier to administer a large network.
103 %description -l es.UTF-8
104 DHCP permite que hosts en una red TCP/IP soliciten y tengan sus
105 direcciones IP alocadas dinámicamente, permite también descubrir
106 información sobre la red en que están conectados. BOOTP provee una
107 funcionalidad similar, con ciertas restricciones. Este servidor
110 %description -l pl.UTF-8
111 Serwer DHCP (Dynamic Host Configuration Protocol).
113 DHCP to protokół pozwalający urządzeniom pracującym w sieci IP na
114 pobieranie ich konfiguracji IP (adresu, maski podsieci, adresu
115 rozgłoszeniowego itp.) z serwera DHCP. Ułatwia on administrowanie
118 %description -l pt_BR.UTF-8
119 DHCP permite que hosts numa rede TCP/IP requisitem e tenham seus
120 endereços IP alocados dinamicamente, permite também descobrir
121 informações sobre a rede em que estão conectados. BOOTP provê uma
122 funcionalidade similar, com certas restrições. Este servidor também
123 atende aquelas requisições. Esta versão é ainda considerada um
126 %package -n openldap-schema-dhcp
127 Summary: LDAP Schema for DHCP Server
128 Summary(pl.UTF-8): Schemat LDAP dla serwera DHCP
129 Group: Networking/Daemons
130 Requires(post,postun): sed >= 4.0
131 Requires: openldap-servers
134 %description -n openldap-schema-dhcp
135 This package contains LDAPv3 schema for use with the DHCP Server.
137 %description -n openldap-schema-dhcp -l pl.UTF-8
138 Ten pakiet zawiera schemat LDAPv3 do używania z serwerem DHCP.
142 Summary(pl.UTF-8): Klient DHCP
143 Group: Networking/Daemons
151 Suggests: avahi-autoipd
152 Provides: dhclient = %{epoch}:%{version}-%{release}
154 Obsoletes: dhcpv6-client
155 Obsoletes: libdhcp4client
156 Obsoletes: libdhcp4client-devel
157 Obsoletes: libdhcp4client-static
160 Dynamic Host Configuration Protocol Client.
162 %description client -l pl.UTF-8
163 Klient DHCP (Dynamic Host Configuration Protocol).
166 Summary: DHCP Client common dirs
167 Summary(pl.UTF-8): Katalogi klienta DHCP
168 Group: Networking/Daemons
170 %description client-dirs
171 Directories for scripts for dhcp-client.
173 %description client-dirs -l pl.UTF-8
174 Katalog przeznaczony na skrypty dla klienta dhcp.
177 Summary: DHCP Relay Agent
178 Summary(pl.UTF-8): Agent przekazywania informacji DHCP
179 Group: Networking/Daemons
180 Requires(post): coreutils
181 Requires(post,preun): /sbin/chkconfig
182 Requires: rc-scripts >= 0.2.0
183 Obsoletes: dhcpv6-relay
186 Dhcp relay is a relay agent for DHCP packets. It is used on a subnet
187 with DHCP clients to "relay" their requests to a subnet that has a
188 DHCP server on it. Because DHCP packets can be broadcast, they will
189 not be routed off of the local subnet. The DHCP relay takes care of
192 %description relay -l pl.UTF-8
193 Agent przekazywania DHCP (Dynamic Host Configuration Protocol) między
194 podsieciami. Ponieważ komunikaty DHCP mogą być przekazywane w formie
195 rozgłoszeniowej, bez tego agenta nie zostaną przerutowane do innej
199 Summary: DHCP development includes and libs
200 Summary(pl.UTF-8): Pliki nagłówkowe i biblioteki dla oprogramowania DHCP
201 Group: Development/Libraries
204 Includes OMAPI and dhcptl libraries.
206 OMAPI is an programming layer designed for controlling remote
207 applications, and for querying them for their state. It is currently
208 used by the ISC DHCP server.
210 The dhcpctl set of functions provide an API that can be used to
211 communicate with and manipulate a running ISC DHCP server.
213 %description devel -l pl.UTF-8
214 Zawiera biblioteki OMAPI oraz dhcpctl.
216 OMAPI to warstwa programowa stworzona do kontroli zdalnych aplikacji i
217 odpytywania o ich stan. Aktualnie jest używana przez serwer ISC DHCP.
219 dhcpctl to zbiór funkcji tworzących API, które może być używane do
220 komunikacji z działającym serwerem ISC DHCP i jego kontroli.
223 %setup -q -n %{name}-%{ver}%{pverdir}
225 # This patch is required for dhcdbd to function
226 # CHECK ME: adds -x (formerly -y):
227 #The -x argument enables extended option information to be created in the
228 #-s dhclient-script environment, which would allow applications running
229 #in that environment to handle options they do not know about in advance -
230 #this is a Red Hat extension to support dhcdbd and NetworkManager.
231 # however, fedora doesn't have this patch anymore, so can drop?
269 # Copy in documentation and example scripts for LDAP patch to dhcpd
270 cp -a %{SOURCE11} README.ldap
271 cp -a %{SOURCE12} doc
272 cp -a %{SOURCE13} contrib
274 # Replace @PRODUCTNAME@
275 %{__sed} -i -e 's|@PRODUCTNAME@|%{vvendor}|g' common/dhcp-options.5
276 %{__sed} -i -e 's|@PRODUCTNAME@|%{vvendor}|g' configure.ac
278 # Update paths in all man pages
279 for page in client/dhclient.conf.5 client/dhclient.leases.5 client/dhclient-script.8 client/dhclient.8; do
280 %{__sed} -i -e 's|CLIENTBINDIR|/sbin|g' \
281 -e 's|RUNDIR|%{_localstatedir}/run|g' \
282 -e 's|DBDIR|%{_localstatedir}/db/dhclient|g' \
283 -e 's|ETCDIR|%{_sysconfdir}|g' $page
286 for page in server/dhcpd.conf.5 server/dhcpd.leases.5 server/dhcpd.8; do
287 %{__sed} -i -e 's|CLIENTBINDIR|/sbin|g' \
288 -e 's|RUNDIR|%{_localstatedir}/run|g' \
289 -e 's|DBDIR|%{_localstatedir}/db/dhcpd|g' \
290 -e 's|ETCDIR|%{_sysconfdir}|g' $page
299 CFLAGS="%{rpmcflags} -fPIC -D_GNU_SOURCE=1"
304 %{!?with_static_libs:--disable-static} \
306 --with-srv-lease-file=/var/lib/dhcpd/dhcpd.leases \
307 --with-cli-lease-file=/var/lib/dhclient/dhclient.leases \
308 --with-srv-pid-file=/var/run/dhcpd.pid \
309 --with-cli-pid-file=/var/run/dhclient.pid \
310 --with-relay-pid-file=/var/run/dhcrelay.pid \
311 --with%{!?with_ldap:out}-ldap \
312 --with%{!?with_systemd:out}-systemd
316 rm -rf $RPM_BUILD_ROOT
317 install -d $RPM_BUILD_ROOT{/etc/{rc.d/init.d,sysconfig,dhclient-enter-hooks.d,dhclient-exit-hooks.d},%{_pkgconfigdir},/var/lib/{dhcpd,dhclient}}
320 DESTDIR=$RPM_BUILD_ROOT
322 install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/dhcpd
323 install %{SOURCE2} $RPM_BUILD_ROOT/etc/rc.d/init.d/dhcpd6
324 install %{SOURCE3} $RPM_BUILD_ROOT/etc/rc.d/init.d/dhcp-relay
325 install %{SOURCE4} $RPM_BUILD_ROOT/etc/sysconfig/dhcpd
326 install %{SOURCE5} $RPM_BUILD_ROOT/etc/sysconfig/dhcp-relay
329 install -d $RPM_BUILD_ROOT%{systemdunitdir}
330 cp -p %{SOURCE6} %{SOURCE7} %{SOURCE8} $RPM_BUILD_ROOT%{systemdunitdir}
333 install client/scripts/linux $RPM_BUILD_ROOT/sbin/dhclient-script
335 install server/dhcpd.conf.example $RPM_BUILD_ROOT%{_sysconfdir}/dhcpd.conf
336 install doc/examples/dhcpd-dhcpv6.conf $RPM_BUILD_ROOT%{_sysconfdir}/dhcpd6.conf
339 install -d $RPM_BUILD_ROOT%{schemadir}
340 install %{SOURCE10} $RPM_BUILD_ROOT%{schemadir}
343 :> $RPM_BUILD_ROOT%{_sysconfdir}/dhclient.conf
345 touch $RPM_BUILD_ROOT/var/lib/dhcpd/dhcpd.leases
346 touch $RPM_BUILD_ROOT/var/lib/dhclient/dhclient.leases
348 touch $RPM_BUILD_ROOT/var/lib/dhcpd/dhcpd6.leases
349 touch $RPM_BUILD_ROOT/var/lib/dhclient/dhclient6.leases
351 %if %{with static_libs}
352 # HACK: strip doesn't like .a inside .a
353 install -d stripworkdir
355 for a in $RPM_BUILD_ROOT%{_libdir}/*.a; do
356 archives=$(ar t $a | grep '\.a$' || :)
357 [ "$archives" ] || continue
359 # hope we don't have to recurse here
360 for ar in $archives; do
372 rm -rf $RPM_BUILD_ROOT
375 touch /var/lib/dhcpd/dhcpd.leases
376 touch /var/lib/dhcpd/dhcpd6.leases
377 /sbin/chkconfig --add dhcpd
378 %service dhcpd restart "dhcpd daemon"
379 /sbin/chkconfig --add dhcpd6
380 %service dhcpd6 restart "dhcpd IPv6 daemon"
381 %{?with_systemd:%systemd_post dhcpd.service dhcpd6.service}
384 if [ "$1" = "0" ];then
386 /sbin/chkconfig --del dhcpd
388 /sbin/chkconfig --del dhcpd6
390 %{?with_systemd:%systemd_preun dhcpd.service dhcpd6.service}
393 %{?with_systemd:%systemd_reload}
395 %triggerpostun -- dhcp < 4.4.2-2
396 if ! grep -q ddns-update-style /etc/dhcpd.conf; then
397 %{__sed} -i -e '1iddns-update-style none;' /etc/dhcpd.conf
399 %systemd_trigger dhcpd.service dhcpd6.service
401 %post -n openldap-schema-dhcp
402 %openldap_schema_register %{schemadir}/dhcp.schema -d core
403 %service -q ldap restart
405 %postun -n openldap-schema-dhcp
406 if [ "$1" = "0" ]; then
407 %openldap_schema_unregister %{schemadir}/dhcp.schema
408 %service -q ldap restart
412 /sbin/chkconfig --add dhcp-relay
413 if [ -f /var/lock/subsys/dhcrelay ]; then
414 mv -f /var/lock/subsys/{dhcrelay,dhcp-relay}
416 %service dhcp-relay restart "dhcrelay daemon"
417 %{?with_systemd:%systemd_post dhcp-relay.service}
420 if [ "$1" = "0" ];then
421 %service dhcp-relay stop
422 /sbin/chkconfig --del dhcp-relay
424 %{?with_systemd:%systemd_preun dhcp-relay.service}
427 %{?with_systemd:%systemd_reload}
429 %triggerpostun -- dhcp-relay < 4.4.2-2
430 %systemd_trigger dhcp-relay.service
432 %triggerun client -- %{name}-client < 4:4.0.2-2
433 if [ -f /etc/dhclient-enter-hooks ] ; then
434 mv /etc/dhclient-enter-hooks /etc/dhclient-enter-hooks.d/
436 if [ -f /etc/dhclient-exit-hooks ] ; then
437 mv /etc/dhclient-exit-hooks /etc/dhclient-exit-hooks.d/
441 %defattr(644,root,root,755)
442 %doc doc/* README RELNOTES server/dhcpd.conf.example LICENSE
443 %doc contrib/ms2isc %{?with_ldap:contrib/dhcpd-conf-to-ldap README.ldap}
444 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/dhcpd
445 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/dhcpd.conf
446 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/dhcpd6.conf
447 %attr(755,root,root) %{_bindir}/omshell
448 %attr(755,root,root) %{_sbindir}/dhcpd
449 %attr(754,root,root) /etc/rc.d/init.d/dhcpd
450 %attr(754,root,root) /etc/rc.d/init.d/dhcpd6
452 %{systemdunitdir}/dhcpd.service
453 %{systemdunitdir}/dhcpd6.service
455 %attr(750,root,root) %dir /var/lib/dhcpd
456 %ghost /var/lib/dhcpd/dhcpd.leases
457 %ghost /var/lib/dhcpd/dhcpd6.leases
458 %{_mandir}/man1/omshell.1*
459 %{_mandir}/man5/dhcp-eval.5*
460 %{_mandir}/man5/dhcp-options.5*
461 %{_mandir}/man5/dhcpd.conf.5*
462 %{_mandir}/man5/dhcpd.leases.5*
463 %{_mandir}/man8/dhcpd.8*
466 %defattr(644,root,root,755)
467 %doc contrib/sethostname.sh client/dhclient.conf.example
468 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/dhclient.conf
469 %attr(755,root,root) /sbin/dhclient
470 %attr(755,root,root) /sbin/dhclient-script
471 %{_mandir}/man5/dhclient.conf.5*
472 %{_mandir}/man5/dhclient.leases.5*
473 %{_mandir}/man8/dhclient.8*
474 %{_mandir}/man8/dhclient-script.8*
475 %dir %attr(750,root,root) /var/lib/dhclient
476 %ghost /var/lib/dhclient/dhclient.leases
477 %ghost /var/lib/dhclient/dhclient6.leases
480 %defattr(644,root,root,755)
481 %dir %{_sysconfdir}/dhclient-enter-hooks.d
482 %dir %{_sysconfdir}/dhclient-exit-hooks.d
485 %defattr(644,root,root,755)
486 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/dhcp-relay
487 %attr(755,root,root) %{_sbindir}/dhcrelay
488 %attr(754,root,root) /etc/rc.d/init.d/dhcp-relay
489 %{?with_systemd:%{systemdunitdir}/dhcp-relay.service}
490 %{_mandir}/man8/dhcrelay.8*
493 %defattr(644,root,root,755)
495 %{_libdir}/libdhcpctl.a
496 %{_libdir}/libomapi.a
497 %{_includedir}/dhcpctl
498 %{_includedir}/omapip
499 %{_mandir}/man3/dhcpctl.3*
500 %{_mandir}/man3/omapi.3*
503 %files -n openldap-schema-dhcp
504 %defattr(644,root,root,755)
505 %{schemadir}/dhcp.schema