1 # note: isc dhcp is now eol
2 # https://www.isc.org/blogs/isc-dhcp-eol/
5 %bcond_without ldap # without support for ldap storage
6 %bcond_without static_libs # don't build static library
7 %bcond_without systemd # without systemd units
14 %define pverdot %{nil}
15 %define pverdir %{nil}
19 %define vvendor PLD/Linux
21 Summary(es.UTF-8): Servidor DHCP
22 Summary(pl.UTF-8): Serwer DHCP
23 Summary(pt_BR.UTF-8): Servidor DHCP (Protocolo de configuração dinâmica de hosts)
25 Version: %{ver}%{pverdot}
29 Group: Networking/Daemons
30 Source0: ftp://ftp.isc.org/isc/dhcp/%{ver}%{pverdir}/%{name}-%{ver}%{pverdir}.tar.gz
31 # Source0-md5: 36c6ca77212373b0cff478ae9e5d32af
33 Source2: %{name}6.init
34 Source3: %{name}-relay.init
35 Source4: %{name}.sysconfig
36 Source5: %{name}-relay.sysconfig
37 Source6: dhcpd.service
38 Source7: dhcpd6.service
39 Source8: dhcp-relay.service
40 Source10: %{name}.schema
41 Source11: %{name}-README.ldap
42 Source12: draft-ietf-dhc-ldap-schema-01.txt
43 Source13: %{name}d-conf-to-ldap
44 Patch0: %{name}-release-by-ifup.patch
45 Patch1: %{name}-3.0.3-x-option.patch
46 Patch2: %{name}-paths.patch
47 Patch3: %{name}-timeouts.patch
48 Patch4: %{name}-options.patch
49 Patch5: %{name}-errwarn-message.patch
50 Patch6: %{name}-memory.patch
51 Patch7: %{name}-unicast-bootp.patch
52 Patch8: %{name}-default-requested-options.patch
53 Patch9: %{name}-manpages.patch
54 Patch10: %{name}-extravars.patch
55 Patch11: systemd-notify.patch
56 Patch12: %{name}-CLOEXEC.patch
57 Patch13: %{name}-garbage-in-format-string-error.patch
58 Patch14: %{name}-handle-null-timouet.patch
59 Patch15: %{name}-capabilities.patch
60 Patch16: %{name}-rfc3442-classless-static-routes.patch
61 Patch17: %{name}-ppp.patch
62 Patch18: %{name}-lpf-ib.patch
63 Patch19: %{name}-add-guid-duid-to-logs.patch
64 Patch20: %{name}-duid_uuid.patch
65 Patch21: %{name}-client-request-release-bind-iface.patch
66 Patch22: %{name}-no-subnet-error2info.patch
67 Patch23: %{name}-stateless-duid-llt.patch
68 Patch24: %{name}-hwaddress.patch
69 Patch25: %{name}-confparse.patch
70 Patch26: %{name}-link-local-address.patch
71 Patch27: %{name}-option97-pxe-client-id.patch
72 Patch28: %{name}-detect-time-changes.patch
73 Patch29: bind-detect-time-changes.patch
74 Patch30: bind-system-getaddrinfo.patch
75 URL: https://www.isc.org/dhcp/
76 BuildRequires: autoconf
77 BuildRequires: automake
80 BuildRequires: libatomic-devel
82 BuildRequires: libtool
83 %{?with_ldap:BuildRequires: openldap-devel}
84 %{?with_ldap:BuildRequires: openssl-devel}
85 BuildRequires: rpmbuild(macros) >= 1.644
86 %{?with_systemd:BuildRequires: systemd-devel}
87 Requires(post): coreutils
88 Requires(post,preun): /sbin/chkconfig
89 Requires: rc-scripts >= 0.2.0
90 %{?with_systemd:Requires: systemd-units >= 38}
92 Obsoletes: dhcpv6-server
93 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
95 %define _sbindir /sbin
96 %define schemadir /usr/share/openldap/schema
99 DHCP (Dynamic Host Configuration Protocol) is a protocol which allows
100 individual devices on an IP network to get their own network
101 configuration information (IP address, subnetmask, broadcast address,
102 etc.) from a DHCP server. The overall purpose of DHCP is to make it
103 easier to administer a large network.
105 %description -l es.UTF-8
106 DHCP permite que hosts en una red TCP/IP soliciten y tengan sus
107 direcciones IP alocadas dinámicamente, permite también descubrir
108 información sobre la red en que están conectados. BOOTP provee una
109 funcionalidad similar, con ciertas restricciones. Este servidor
112 %description -l pl.UTF-8
113 Serwer DHCP (Dynamic Host Configuration Protocol).
115 DHCP to protokół pozwalający urządzeniom pracującym w sieci IP na
116 pobieranie ich konfiguracji IP (adresu, maski podsieci, adresu
117 rozgłoszeniowego itp.) z serwera DHCP. Ułatwia on administrowanie
120 %description -l pt_BR.UTF-8
121 DHCP permite que hosts numa rede TCP/IP requisitem e tenham seus
122 endereços IP alocados dinamicamente, permite também descobrir
123 informações sobre a rede em que estão conectados. BOOTP provê uma
124 funcionalidade similar, com certas restrições. Este servidor também
125 atende aquelas requisições. Esta versão é ainda considerada um
128 %package -n openldap-schema-dhcp
129 Summary: LDAP Schema for DHCP Server
130 Summary(pl.UTF-8): Schemat LDAP dla serwera DHCP
131 Group: Networking/Daemons
132 Requires(post,postun): sed >= 4.0
133 Requires: openldap-servers
136 %description -n openldap-schema-dhcp
137 This package contains LDAPv3 schema for use with the DHCP Server.
139 %description -n openldap-schema-dhcp -l pl.UTF-8
140 Ten pakiet zawiera schemat LDAPv3 do używania z serwerem DHCP.
144 Summary(pl.UTF-8): Klient DHCP
145 Group: Networking/Daemons
153 Suggests: avahi-autoipd
154 Provides: dhclient = %{epoch}:%{version}-%{release}
156 Obsoletes: dhcpv6-client
157 Obsoletes: libdhcp4client
158 Obsoletes: libdhcp4client-devel
159 Obsoletes: libdhcp4client-static
162 Dynamic Host Configuration Protocol Client.
164 %description client -l pl.UTF-8
165 Klient DHCP (Dynamic Host Configuration Protocol).
168 Summary: DHCP Client common dirs
169 Summary(pl.UTF-8): Katalogi klienta DHCP
170 Group: Networking/Daemons
172 %description client-dirs
173 Directories for scripts for dhcp-client.
175 %description client-dirs -l pl.UTF-8
176 Katalog przeznaczony na skrypty dla klienta dhcp.
179 Summary: DHCP Relay Agent
180 Summary(pl.UTF-8): Agent przekazywania informacji DHCP
181 Group: Networking/Daemons
182 Requires(post): coreutils
183 Requires(post,preun): /sbin/chkconfig
184 Requires: rc-scripts >= 0.2.0
185 Obsoletes: dhcpv6-relay
188 Dhcp relay is a relay agent for DHCP packets. It is used on a subnet
189 with DHCP clients to "relay" their requests to a subnet that has a
190 DHCP server on it. Because DHCP packets can be broadcast, they will
191 not be routed off of the local subnet. The DHCP relay takes care of
194 %description relay -l pl.UTF-8
195 Agent przekazywania DHCP (Dynamic Host Configuration Protocol) między
196 podsieciami. Ponieważ komunikaty DHCP mogą być przekazywane w formie
197 rozgłoszeniowej, bez tego agenta nie zostaną przerutowane do innej
201 Summary: DHCP development includes and libs
202 Summary(pl.UTF-8): Pliki nagłówkowe i biblioteki dla oprogramowania DHCP
203 Group: Development/Libraries
206 Includes OMAPI and dhcptl libraries.
208 OMAPI is an programming layer designed for controlling remote
209 applications, and for querying them for their state. It is currently
210 used by the ISC DHCP server.
212 The dhcpctl set of functions provide an API that can be used to
213 communicate with and manipulate a running ISC DHCP server.
215 %description devel -l pl.UTF-8
216 Zawiera biblioteki OMAPI oraz dhcpctl.
218 OMAPI to warstwa programowa stworzona do kontroli zdalnych aplikacji i
219 odpytywania o ich stan. Aktualnie jest używana przez serwer ISC DHCP.
221 dhcpctl to zbiór funkcji tworzących API, które może być używane do
222 komunikacji z działającym serwerem ISC DHCP i jego kontroli.
225 %setup -q -n %{name}-%{ver}%{pverdir}
227 # This patch is required for dhcdbd to function
228 # CHECK ME: adds -x (formerly -y):
229 #The -x argument enables extended option information to be created in the
230 #-s dhclient-script environment, which would allow applications running
231 #in that environment to handle options they do not know about in advance -
232 #this is a Red Hat extension to support dhcdbd and NetworkManager.
233 # however, fedora doesn't have this patch anymore, so can drop?
271 # Copy in documentation and example scripts for LDAP patch to dhcpd
272 cp -a %{SOURCE11} README.ldap
273 cp -a %{SOURCE12} doc
274 cp -a %{SOURCE13} contrib
276 # Replace @PRODUCTNAME@
277 %{__sed} -i -e 's|@PRODUCTNAME@|%{vvendor}|g' common/dhcp-options.5
278 %{__sed} -i -e 's|@PRODUCTNAME@|%{vvendor}|g' configure.ac
280 # Update paths in all man pages
281 for page in client/dhclient.conf.5 client/dhclient.leases.5 client/dhclient-script.8 client/dhclient.8; do
282 %{__sed} -i -e 's|CLIENTBINDIR|/sbin|g' \
283 -e 's|RUNDIR|%{_localstatedir}/run|g' \
284 -e 's|DBDIR|%{_localstatedir}/db/dhclient|g' \
285 -e 's|ETCDIR|%{_sysconfdir}|g' $page
288 for page in server/dhcpd.conf.5 server/dhcpd.leases.5 server/dhcpd.8; do
289 %{__sed} -i -e 's|CLIENTBINDIR|/sbin|g' \
290 -e 's|RUNDIR|%{_localstatedir}/run|g' \
291 -e 's|DBDIR|%{_localstatedir}/db/dhcpd|g' \
292 -e 's|ETCDIR|%{_sysconfdir}|g' $page
301 CFLAGS="%{rpmcflags} -fPIC -D_GNU_SOURCE=1"
306 %{!?with_static_libs:--disable-static} \
308 --with-srv-lease-file=/var/lib/dhcpd/dhcpd.leases \
309 --with-cli-lease-file=/var/lib/dhclient/dhclient.leases \
310 --with-srv-pid-file=/var/run/dhcpd.pid \
311 --with-cli-pid-file=/var/run/dhclient.pid \
312 --with-relay-pid-file=/var/run/dhcrelay.pid \
313 --with%{!?with_ldap:out}-ldap \
314 --with%{!?with_systemd:out}-systemd
318 rm -rf $RPM_BUILD_ROOT
319 install -d $RPM_BUILD_ROOT{/etc/{rc.d/init.d,sysconfig,dhclient-enter-hooks.d,dhclient-exit-hooks.d},%{_pkgconfigdir},/var/lib/{dhcpd,dhclient}}
322 DESTDIR=$RPM_BUILD_ROOT
324 install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/dhcpd
325 install %{SOURCE2} $RPM_BUILD_ROOT/etc/rc.d/init.d/dhcpd6
326 install %{SOURCE3} $RPM_BUILD_ROOT/etc/rc.d/init.d/dhcp-relay
327 install %{SOURCE4} $RPM_BUILD_ROOT/etc/sysconfig/dhcpd
328 install %{SOURCE5} $RPM_BUILD_ROOT/etc/sysconfig/dhcp-relay
331 install -d $RPM_BUILD_ROOT%{systemdunitdir}
332 cp -p %{SOURCE6} %{SOURCE7} %{SOURCE8} $RPM_BUILD_ROOT%{systemdunitdir}
335 install client/scripts/linux $RPM_BUILD_ROOT/sbin/dhclient-script
337 install server/dhcpd.conf.example $RPM_BUILD_ROOT%{_sysconfdir}/dhcpd.conf
338 install doc/examples/dhcpd-dhcpv6.conf $RPM_BUILD_ROOT%{_sysconfdir}/dhcpd6.conf
341 install -d $RPM_BUILD_ROOT%{schemadir}
342 install %{SOURCE10} $RPM_BUILD_ROOT%{schemadir}
345 :> $RPM_BUILD_ROOT%{_sysconfdir}/dhclient.conf
347 touch $RPM_BUILD_ROOT/var/lib/dhcpd/dhcpd.leases
348 touch $RPM_BUILD_ROOT/var/lib/dhclient/dhclient.leases
350 touch $RPM_BUILD_ROOT/var/lib/dhcpd/dhcpd6.leases
351 touch $RPM_BUILD_ROOT/var/lib/dhclient/dhclient6.leases
353 %if %{with static_libs}
354 # HACK: strip doesn't like .a inside .a
355 install -d stripworkdir
357 for a in $RPM_BUILD_ROOT%{_libdir}/*.a; do
358 archives=$(ar t $a | grep '\.a$' || :)
359 [ "$archives" ] || continue
361 # hope we don't have to recurse here
362 for ar in $archives; do
374 rm -rf $RPM_BUILD_ROOT
377 touch /var/lib/dhcpd/dhcpd.leases
378 touch /var/lib/dhcpd/dhcpd6.leases
379 /sbin/chkconfig --add dhcpd
380 %service dhcpd restart "dhcpd daemon"
381 /sbin/chkconfig --add dhcpd6
382 %service dhcpd6 restart "dhcpd IPv6 daemon"
383 %{?with_systemd:%systemd_post dhcpd.service dhcpd6.service}
386 if [ "$1" = "0" ];then
388 /sbin/chkconfig --del dhcpd
390 /sbin/chkconfig --del dhcpd6
392 %{?with_systemd:%systemd_preun dhcpd.service dhcpd6.service}
395 %{?with_systemd:%systemd_reload}
397 %triggerpostun -- dhcp < 4.4.2-2
398 if ! grep -q ddns-update-style /etc/dhcpd.conf; then
399 %{__sed} -i -e '1iddns-update-style none;' /etc/dhcpd.conf
401 %systemd_trigger dhcpd.service dhcpd6.service
403 %post -n openldap-schema-dhcp
404 %openldap_schema_register %{schemadir}/dhcp.schema -d core
405 %service -q ldap restart
407 %postun -n openldap-schema-dhcp
408 if [ "$1" = "0" ]; then
409 %openldap_schema_unregister %{schemadir}/dhcp.schema
410 %service -q ldap restart
414 /sbin/chkconfig --add dhcp-relay
415 if [ -f /var/lock/subsys/dhcrelay ]; then
416 mv -f /var/lock/subsys/{dhcrelay,dhcp-relay}
418 %service dhcp-relay restart "dhcrelay daemon"
419 %{?with_systemd:%systemd_post dhcp-relay.service}
422 if [ "$1" = "0" ];then
423 %service dhcp-relay stop
424 /sbin/chkconfig --del dhcp-relay
426 %{?with_systemd:%systemd_preun dhcp-relay.service}
429 %{?with_systemd:%systemd_reload}
431 %triggerpostun -- dhcp-relay < 4.4.2-2
432 %systemd_trigger dhcp-relay.service
434 %triggerun client -- %{name}-client < 4:4.0.2-2
435 if [ -f /etc/dhclient-enter-hooks ] ; then
436 mv /etc/dhclient-enter-hooks /etc/dhclient-enter-hooks.d/
438 if [ -f /etc/dhclient-exit-hooks ] ; then
439 mv /etc/dhclient-exit-hooks /etc/dhclient-exit-hooks.d/
443 %defattr(644,root,root,755)
444 %doc doc/* README RELNOTES server/dhcpd.conf.example LICENSE
445 %doc contrib/ms2isc %{?with_ldap:contrib/dhcpd-conf-to-ldap README.ldap}
446 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/dhcpd
447 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/dhcpd.conf
448 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/dhcpd6.conf
449 %attr(755,root,root) %{_bindir}/omshell
450 %attr(755,root,root) %{_sbindir}/dhcpd
451 %attr(754,root,root) /etc/rc.d/init.d/dhcpd
452 %attr(754,root,root) /etc/rc.d/init.d/dhcpd6
454 %{systemdunitdir}/dhcpd.service
455 %{systemdunitdir}/dhcpd6.service
457 %attr(750,root,root) %dir /var/lib/dhcpd
458 %ghost /var/lib/dhcpd/dhcpd.leases
459 %ghost /var/lib/dhcpd/dhcpd6.leases
460 %{_mandir}/man1/omshell.1*
461 %{_mandir}/man5/dhcp-eval.5*
462 %{_mandir}/man5/dhcp-options.5*
463 %{_mandir}/man5/dhcpd.conf.5*
464 %{_mandir}/man5/dhcpd.leases.5*
465 %{_mandir}/man8/dhcpd.8*
468 %defattr(644,root,root,755)
469 %doc contrib/sethostname.sh client/dhclient.conf.example
470 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/dhclient.conf
471 %attr(755,root,root) /sbin/dhclient
472 %attr(755,root,root) /sbin/dhclient-script
473 %{_mandir}/man5/dhclient.conf.5*
474 %{_mandir}/man5/dhclient.leases.5*
475 %{_mandir}/man8/dhclient.8*
476 %{_mandir}/man8/dhclient-script.8*
477 %dir %attr(750,root,root) /var/lib/dhclient
478 %ghost /var/lib/dhclient/dhclient.leases
479 %ghost /var/lib/dhclient/dhclient6.leases
482 %defattr(644,root,root,755)
483 %dir %{_sysconfdir}/dhclient-enter-hooks.d
484 %dir %{_sysconfdir}/dhclient-exit-hooks.d
487 %defattr(644,root,root,755)
488 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/dhcp-relay
489 %attr(755,root,root) %{_sbindir}/dhcrelay
490 %attr(754,root,root) /etc/rc.d/init.d/dhcp-relay
491 %{?with_systemd:%{systemdunitdir}/dhcp-relay.service}
492 %{_mandir}/man8/dhcrelay.8*
495 %defattr(644,root,root,755)
497 %{_libdir}/libdhcpctl.a
498 %{_libdir}/libomapi.a
499 %{_includedir}/dhcpctl
500 %{_includedir}/omapip
501 %{_mandir}/man3/dhcpctl.3*
502 %{_mandir}/man3/omapi.3*
505 %files -n openldap-schema-dhcp
506 %defattr(644,root,root,755)
507 %{schemadir}/dhcp.schema