- Enable LDAP/SSL support in dhcpd (#467740)
- Do not calculate a prefix for an address we did not receive (#473885) - Removed libdhcp4client because libdhcp has been removed from Fedora
This commit is contained in:
parent
e2381ffe75
commit
5c6578cbb4
@ -215,7 +215,7 @@ dhconfig() {
|
||||
[ ! "${old_ip_address}" = "${new_ip_address}" ]; then
|
||||
# IP address changed. Bringing down the interface will delete all
|
||||
# routes, and clear the ARP cache.
|
||||
ip -family inet addr flush dev ${interface}
|
||||
ip -family inet addr flush dev ${interface} >/dev/null 2>&1
|
||||
ip -family inet link set dev ${interface} down
|
||||
fi
|
||||
|
||||
@ -319,7 +319,7 @@ dhconfig() {
|
||||
|
||||
if [ ! "${new_ip_address}" = "${alias_ip_address}" ] &&
|
||||
[ -n "${alias_ip_address}" ]; then
|
||||
ip -family inet addr flush dev ${interface}:0
|
||||
ip -family inet addr flush dev ${interface}:0 >/dev/null 2>&1
|
||||
ip -family inet addr add ${alias_ip_address}/${alias_prefix} dev ${interface}:0
|
||||
ip route replace ${alias_ip_address}/32 dev ${interface}:0
|
||||
fi
|
||||
@ -413,6 +413,15 @@ dhconfig() {
|
||||
fi
|
||||
}
|
||||
|
||||
get_prefix() {
|
||||
ip="${1}"
|
||||
nm="${2}"
|
||||
|
||||
if [ -n "${ip}" -a -n "${nm}" ]; then
|
||||
ipcalc -s -p ${ip} ${nm} | cut -d '=' -f 2
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
#
|
||||
# ### MAIN
|
||||
@ -450,24 +459,13 @@ if [ -f /etc/sysconfig/networking/network ]; then
|
||||
. /etc/sysconfig/networking/network
|
||||
fi
|
||||
|
||||
CONFIG="${interface}"
|
||||
CONFIG="/etc/sysconfig/network-scripts/ifcfg-${interface}"
|
||||
need_config ${CONFIG}
|
||||
source_config >/dev/null 2>&1
|
||||
|
||||
if [ -f "${CONFIG}" ]; then
|
||||
source_config
|
||||
fi
|
||||
|
||||
if [ -n "${new_subnet_mask}" ]; then
|
||||
new_prefix="$(ipcalc -p ${new_ip_address} ${new_subnet_mask} | cut -d '=' -f 2)"
|
||||
fi
|
||||
|
||||
if [ -n "${old_subnet_mask}" ]; then
|
||||
old_prefix="$(ipcalc -p ${old_ip_address} ${new_subnet_mask} | cut -d '=' -f 2)"
|
||||
fi
|
||||
|
||||
if [ -n "${alias_subnet_mask}" ]; then
|
||||
alias_prefix="$(ipcalc -p ${alias_ip_address} ${alias_subnet_mask} | cut -d '=' -f 2)"
|
||||
fi
|
||||
new_prefix="$(get_prefix ${new_ip_address} ${new_subnet_mask})"
|
||||
old_prefix="$(get_prefix ${old_ip_address} ${new_subnet_mask})"
|
||||
alias_prefix="$(get_prefix ${alias_ip_address} ${alias_subnet_mask})"
|
||||
|
||||
case "${reason}" in
|
||||
MEDIUM)
|
||||
@ -484,7 +482,7 @@ case "${reason}" in
|
||||
if [ "${keep_old_ip}" = "yes" ]; then
|
||||
ip -family inet link set ${interface} up
|
||||
else
|
||||
ip -family inet addr flush dev ${interface}
|
||||
ip -family inet addr flush dev ${interface} >/dev/null 2>&1
|
||||
ip -family inet link set ${interface} up
|
||||
fi
|
||||
|
||||
@ -556,7 +554,7 @@ case "${reason}" in
|
||||
|
||||
if [ -n "${old_ip_address}" ]; then
|
||||
# Shut down interface, which will delete routes and clear arp cache.
|
||||
ip -family inet addr flush dev ${interface}
|
||||
ip -family inet addr flush dev ${interface} >/dev/null 2>&1
|
||||
ip -family inet link set ${interface} down
|
||||
fi
|
||||
|
||||
@ -571,7 +569,7 @@ case "${reason}" in
|
||||
TIMEOUT)
|
||||
if [ -n "${new_routers}" ]; then
|
||||
if [ -n "${alias_ip_address}" ]; then
|
||||
ip -family inet addr flush dev ${interface}:0
|
||||
ip -family inet addr flush dev ${interface}:0 >/dev/null 2>&1
|
||||
fi
|
||||
|
||||
ip -family inet addr add ${new_ip_address}/${new_prefix} broadcast ${new_broadcast_address} dev ${interface}
|
||||
@ -582,7 +580,7 @@ case "${reason}" in
|
||||
exit_with_hooks 0
|
||||
fi
|
||||
|
||||
ip -family inet addr flush dev ${interface}
|
||||
ip -family inet addr flush dev ${interface} >/dev/null 2>&1
|
||||
ip -family inet link set ${interface} down
|
||||
exit_with_hooks 1
|
||||
else
|
||||
|
File diff suppressed because it is too large
Load Diff
132
dhcp.spec
132
dhcp.spec
@ -1,10 +1,23 @@
|
||||
# vendor string (e.g., Fedora, EL)
|
||||
%define vvendor Fedora
|
||||
|
||||
# Make it easy for package rebuilders to select LPF or sockets
|
||||
%define netmethod USE_LPF
|
||||
|
||||
%define with_USE_SOCKETS %{?_with_USE_SOCKETS: 1} %{?!_with_USE_SOCKETS: 0}
|
||||
%if %{with_USE_SOCKETS}
|
||||
%define netmethod USE_SOCKETS
|
||||
%endif
|
||||
|
||||
%define with_USE_LPF %{?_with_USE_LPF: 1} %{?!_with_USE_LPF: 0}
|
||||
%if %{with_USE_LPF}
|
||||
%define netmethod USE_LPF
|
||||
%endif
|
||||
|
||||
Summary: DHCP (Dynamic Host Configuration Protocol) server and relay agent
|
||||
Name: dhcp
|
||||
Version: 4.0.0
|
||||
Release: 31%{?dist}
|
||||
Release: 32%{?dist}
|
||||
# NEVER CHANGE THE EPOCH on this package. The previous maintainer (prior to
|
||||
# dcantrell maintaining the package) made incorrect use of the epoch and
|
||||
# that's why it is at 12 now. It should have never been used, but it was.
|
||||
@ -16,15 +29,12 @@ URL: http://isc.org/products/DHCP/
|
||||
Source0: ftp://ftp.isc.org/isc/%{name}/%{name}-%{version}.tar.gz
|
||||
Source1: dhcpd.init
|
||||
Source2: dhcrelay.init
|
||||
Source3: libdhcp4client.pc
|
||||
Source5: README.ldap
|
||||
Source6: draft-ietf-dhc-ldap-schema-01.txt
|
||||
Source7: dhcpd-conf-to-ldap
|
||||
Source3: README.ldap
|
||||
Source4: draft-ietf-dhc-ldap-schema-01.txt
|
||||
Source5: dhcpd-conf-to-ldap
|
||||
Source8: dhclient-script
|
||||
Source9: dhcp4client.h
|
||||
Source10: libdhcp_control.h
|
||||
Source11: dhcp.schema
|
||||
Source12: get-ldap-patch.sh
|
||||
Source9: dhcp.schema
|
||||
Source10: get-ldap-patch.sh
|
||||
|
||||
Patch0: %{name}-4.0.0-errwarn-message.patch
|
||||
Patch1: %{name}-4.0.0-ldap-configuration.patch
|
||||
@ -44,11 +54,10 @@ Patch14: %{name}-4.0.0-manpages.patch
|
||||
Patch15: %{name}-4.0.0-paths.patch
|
||||
Patch16: %{name}-4.0.0-NetworkManager-crash.patch
|
||||
Patch17: %{name}-4.0.0-CLOEXEC.patch
|
||||
Patch18: %{name}-4.0.0-libdhcp4client.patch
|
||||
Patch19: %{name}-4.0.0-inherit-leases.patch
|
||||
Patch20: %{name}-4.0.0-garbage-chars.patch
|
||||
Patch21: %{name}-4.0.0-port-validation.patch
|
||||
Patch22: %{name}-4.0.0-invalid-dhclient-conf.patch
|
||||
Patch18: %{name}-4.0.0-inherit-leases.patch
|
||||
Patch19: %{name}-4.0.0-garbage-chars.patch
|
||||
Patch20: %{name}-4.0.0-port-validation.patch
|
||||
Patch21: %{name}-4.0.0-invalid-dhclient-conf.patch
|
||||
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||
BuildRequires: autoconf
|
||||
@ -101,29 +110,17 @@ Requires: %{name} = %{epoch}:%{version}-%{release}
|
||||
Header files and API documentation for using the ISC DHCP libraries. The
|
||||
libdhcpctl and libomapi static libraries are also included in this package.
|
||||
|
||||
%package -n libdhcp4client
|
||||
Summary: ISC DHCP IPv4 client in a library for invocation from other programs
|
||||
Group: Development/Libraries
|
||||
|
||||
%description -n libdhcp4client
|
||||
The Internet Software Consortium (ISC) Dynamic Host Configuration Protocol
|
||||
(DHCP) Internet Protocol version 4 (IPv4) client software in a library
|
||||
suitable for linkage with and invocation by other programs.
|
||||
|
||||
%package -n libdhcp4client-devel
|
||||
Summary: Header files for development with the ISC DHCP IPv4 client library
|
||||
Group: Development/Libraries
|
||||
Requires: dhcp-devel = %{epoch}:%{version}-%{release}
|
||||
Requires: libdhcp4client = %{epoch}:%{version}-%{release}
|
||||
Requires: openldap-devel
|
||||
Requires: pkgconfig
|
||||
|
||||
%description -n libdhcp4client-devel
|
||||
Header files for development with the Internet Software Consortium (ISC)
|
||||
Dynamic Host Configuration Protocol (DHCP) Internet Protocol version 4 (IPv4)
|
||||
client library.
|
||||
|
||||
%prep
|
||||
case "%{netmethod}" in
|
||||
USE_LPF|USE_SOCKETS)
|
||||
continue ;;
|
||||
*)
|
||||
echo >&2
|
||||
echo "ERROR: Only --with options supported: USE_LPF, USE_SOCKETS" >&2
|
||||
echo >&2
|
||||
exit 1 ;;
|
||||
esac
|
||||
|
||||
%setup -q
|
||||
|
||||
# Replace the standard ISC warning message about requesting help with an
|
||||
@ -196,36 +193,27 @@ client library.
|
||||
# Make sure all open file descriptors are closed-on-exec for SELinux (#446632)
|
||||
%patch17 -p1
|
||||
|
||||
# Add the libdhcp4client target (library version of dhclient)
|
||||
# If we have an active lease, do not down the interface (#453982)
|
||||
%patch18 -p1
|
||||
|
||||
# If we have an active lease, do not down the interface (#453982)
|
||||
%patch19 -p1
|
||||
|
||||
# Fix 'garbage in format string' error (#450052)
|
||||
%patch20 -p1
|
||||
%patch19 -p1
|
||||
|
||||
# Validate port numbers specified for dhclient, dhcpd, and dhcrelay
|
||||
# to make sure they are within 1-65535, inclusive. (#438149)
|
||||
%patch21 -p1
|
||||
%patch20 -p1
|
||||
|
||||
# The sample dhclient.conf should say 'supersede domain-search' (#467955)
|
||||
%patch22 -p1
|
||||
%patch21 -p1
|
||||
|
||||
# Copy in documentation and example scripts for LDAP patch to dhcpd
|
||||
%{__install} -p -m 0644 %{SOURCE5} .
|
||||
%{__install} -p -m 0644 %{SOURCE6} doc/
|
||||
%{__install} -p -m 0755 %{SOURCE7} contrib/
|
||||
%{__install} -p -m 0644 %{SOURCE3} .
|
||||
%{__install} -p -m 0644 %{SOURCE4} doc/
|
||||
%{__install} -p -m 0755 %{SOURCE5} contrib/
|
||||
|
||||
# Copy in the Fedora/RHEL dhclient script
|
||||
%{__install} -p -m 0755 %{SOURCE8} client/scripts/linux
|
||||
|
||||
# Copy in the libdhcp4client headers and Makefile.dist
|
||||
%{__install} -p -m 0644 %{SOURCE9} includes/
|
||||
|
||||
# Copy in libdhcp_control.h to the isc-dhcp includes directory
|
||||
%{__install} -p -m 0644 %{SOURCE10} includes/isc-dhcp/
|
||||
|
||||
# Ensure we don't pick up Perl as a dependency from the scripts and modules
|
||||
# in the contrib directory (we copy this to /usr/share/doc in the final
|
||||
# package).
|
||||
@ -278,7 +266,7 @@ autoheader
|
||||
automake --foreign --add-missing --copy
|
||||
|
||||
%build
|
||||
CFLAGS="%{optflags} -fPIC -D_GNU_SOURCE" \
|
||||
CFLAGS="%{optflags} -fPIC -D_GNU_SOURCE -DUSE_SSL=1 -D%{netmethod}=1" \
|
||||
%configure \
|
||||
--disable-dhcpv6 \
|
||||
--with-srv-lease-file=%{_localstatedir}/lib/dhcpd/dhcpd.leases \
|
||||
@ -288,15 +276,11 @@ CFLAGS="%{optflags} -fPIC -D_GNU_SOURCE" \
|
||||
--with-relay-pid-file=%{_localstatedir}/run/dhcrelay.pid
|
||||
%{__make} %{?_smp_mflags}
|
||||
|
||||
%{__sed} 's/@DHCP_VERSION@/%{version}/' < %{SOURCE3} > libdhcp4client.pc
|
||||
|
||||
%install
|
||||
%{__rm} -rf %{buildroot}
|
||||
%{__make} install DESTDIR=%{buildroot}
|
||||
|
||||
# Remove files we don't want
|
||||
%{__rm} -rf %{buildroot}%{_libdir}/libdhcp4client.a
|
||||
%{__rm} -rf %{buildroot}%{_libdir}/libdhcp4client.la
|
||||
%{__rm} %{buildroot}%{_sysconfdir}/dhclient.conf
|
||||
|
||||
# Install correct dhclient-script
|
||||
@ -304,19 +288,6 @@ CFLAGS="%{optflags} -fPIC -D_GNU_SOURCE" \
|
||||
%{__mv} %{buildroot}%{_sbindir}/dhclient %{buildroot}/sbin/dhclient
|
||||
%{__install} -p -m 0755 client/scripts/linux %{buildroot}/sbin/dhclient-script
|
||||
|
||||
# Install pkg-config file
|
||||
%{__install} -p -m 0644 %{SOURCE10} %{buildroot}%{_includedir}/isc-dhcp/
|
||||
%{__install} -p -m 0644 -D libdhcp4client.pc %{buildroot}%{_libdir}/pkgconfig/libdhcp4client.pc
|
||||
|
||||
# Install headers for libdhcp4client-devel
|
||||
%{__mkdir} -p %{buildroot}%{_includedir}/dhcp4client/minires
|
||||
%{__install} -p -m 0644 %{SOURCE9} %{buildroot}%{_includedir}/dhcp4client
|
||||
for hdr in cdefs.h ctrace.h dhcp.h dhcp6.h dhcpd.h dhctoken.h failover.h \
|
||||
heap.h inet.h minires/minires.h minires/res_update.h \
|
||||
minires/resolv.h osdep.h site.h statement.h tree.h ; do
|
||||
%{__install} -p -m 0644 includes/${hdr} %{buildroot}%{_includedir}/dhcp4client/${hdr}
|
||||
done
|
||||
|
||||
# Install init scripts
|
||||
%{__mkdir} -p %{buildroot}%{_initrddir}
|
||||
%{__install} -p -m 0755 %{SOURCE1} %{buildroot}%{_initrddir}/dhcpd
|
||||
@ -356,7 +327,7 @@ EOF
|
||||
|
||||
# Install dhcp.schema for LDAP configuration
|
||||
%{__mkdir} -p %{buildroot}%{_sysconfdir}/openldap/schema
|
||||
%{__install} -p -m 0644 -D %{SOURCE11} %{buildroot}%{_sysconfdir}/openldap/schema
|
||||
%{__install} -p -m 0644 -D %{SOURCE9} %{buildroot}%{_sysconfdir}/openldap/schema
|
||||
|
||||
%clean
|
||||
%{__rm} -rf %{buildroot}
|
||||
@ -387,10 +358,6 @@ if [ $1 -ge 1 ]; then
|
||||
/sbin/service dhcrelay condrestart >/dev/null 2>&1 || :
|
||||
fi
|
||||
|
||||
%post -n libdhcp4client -p /sbin/ldconfig
|
||||
|
||||
%postun -n libdhcp4client -p /sbin/ldconfig
|
||||
|
||||
%files
|
||||
%defattr(-,root,root,-)
|
||||
%doc LICENSE README README.ldap RELNOTES dhcpd.conf.sample
|
||||
@ -438,17 +405,12 @@ fi
|
||||
%attr(0644,root,root) %{_mandir}/man3/dhcpctl.3.gz
|
||||
%attr(0644,root,root) %{_mandir}/man3/omapi.3.gz
|
||||
|
||||
%files -n libdhcp4client
|
||||
%defattr(0755,root,root,0755)
|
||||
%{_libdir}/libdhcp4client-*.*.so.*
|
||||
|
||||
%files -n libdhcp4client-devel
|
||||
%defattr(0644,root,root,0755)
|
||||
%{_includedir}/dhcp4client
|
||||
%{_libdir}/pkgconfig/libdhcp4client.pc
|
||||
%{_libdir}/libdhcp4client.so
|
||||
|
||||
%changelog
|
||||
* Wed Dec 03 2008 David Cantrell <dcantrell@redhat.com> - 12:4.0.0-32
|
||||
- Enable LDAP/SSL support in dhcpd (#467740)
|
||||
- Do not calculate a prefix for an address we did not receive (#473885)
|
||||
- Removed libdhcp4client because libdhcp has been removed from Fedora
|
||||
|
||||
* Wed Oct 29 2008 David Cantrell <dcantrell@redhat.com> - 12:4.0.0-31
|
||||
- Use O_CLOEXEC in open(2) calls and "e" mode in fopen(3) calls, build
|
||||
with -D_GNU_SOURCE so we pick up O_CLOEXEC (#468984)
|
||||
|
@ -1,30 +0,0 @@
|
||||
/* dhcp4client.h
|
||||
*
|
||||
* Interface to the ISC dhcp IPv4 client libdhcp4client library.
|
||||
*
|
||||
* Copyright (C) 2006 Red Hat, Inc. All rights reserved.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use,
|
||||
* modify, copy, or redistribute it subject to the terms and conditions of
|
||||
* the GNU General Public License v.2, or (at your option) any later version.
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY expressed or implied, including the implied warranties of
|
||||
* MERCHANTABILITY or FITNESS FOR A * PARTICULAR PURPOSE. See the GNU General
|
||||
* Public License for more details. You should have received a copy of the
|
||||
* GNU General Public License along with this program; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301, USA. Any Red Hat trademarks that are incorporated in the
|
||||
* source code or documentation are not subject to the GNU General Public
|
||||
* License and may only be used or replicated with the express permission of
|
||||
* Red Hat, Inc.
|
||||
*
|
||||
* Red Hat Author(s): Jason Vas Dias
|
||||
* David Cantrell <dcantrell@redhat.com>
|
||||
*/
|
||||
|
||||
/* include libdhcp_control.h or libdhcp.h for this */
|
||||
extern struct libdhcp_control_s;
|
||||
|
||||
/* The ISC IPv4 DHCP client main() function */
|
||||
extern int dhcpv4_client(struct libdhcp_control_s *dhc_ctl,
|
||||
int argc, char **argv, char **envp);
|
@ -1,5 +0,0 @@
|
||||
Name: libdhcp4client
|
||||
Description: ISC DHCP IPv4 client library
|
||||
Version: @DHCP_VERSION@
|
||||
Libs: -ldhcp4client
|
||||
Cflags: -I/usr/include/dhcp4client
|
@ -1,132 +0,0 @@
|
||||
/* libdhcp_control.h
|
||||
*
|
||||
* DHCP client control API for libdhcp, a minimal interface to the
|
||||
* ISC dhcp IPv4 client libdhcp4client library,
|
||||
* and to the dhcpv6 DHCPv6 client libdhcp6client library.
|
||||
*
|
||||
* Each DHCP client library must include this file to be controlled
|
||||
* by libdhcp.
|
||||
*
|
||||
* Copyright (C) 2006 Red Hat, Inc. All rights reserved.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use,
|
||||
* modify, copy, or redistribute it subject to the terms and conditions of
|
||||
* the GNU General Public License v.2, or (at your option) any later version.
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY expressed or implied, including the implied warranties of
|
||||
* MERCHANTABILITY or FITNESS FOR A * PARTICULAR PURPOSE. See the GNU General
|
||||
* Public License for more details. You should have received a copy of the
|
||||
* GNU General Public License along with this program; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301, USA. Any Red Hat trademarks that are incorporated in the
|
||||
* source code or documentation are not subject to the GNU General Public
|
||||
* License and may only be used or replicated with the express permission of
|
||||
* Red Hat, Inc.
|
||||
*
|
||||
* Red Hat Author(s): Jason Vas Dias
|
||||
* David Cantrell <dcantrell@redhat.com>
|
||||
*/
|
||||
|
||||
#ifndef LIBDHCP_CONTROL_H
|
||||
#define LIBDHCP_CONTROL_H
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#define LOG_FATAL 8
|
||||
|
||||
typedef enum dhcp_state_e {
|
||||
/* DHCPv4 client states
|
||||
* third callback arg will be a 'struct client_state *'
|
||||
*/
|
||||
DHC4_NBI, /* failed: no broadcast interfaces found */
|
||||
DHC4_PREINIT, /* configuration started - bring the interface "UP" */
|
||||
DHC4_BOUND, /* lease obtained */
|
||||
DHC4_RENEW, /* lease renewed */
|
||||
DHC4_REBOOT, /* have valid lease, but now obtained a different one */
|
||||
DHC4_REBIND, /* new, different lease */
|
||||
DHC4_STOP, /* remove old lease */
|
||||
DHC4_MEDIUM, /* media selection begun */
|
||||
DHC4_TIMEOUT, /* timed out contacting DHCP server */
|
||||
DHC4_FAIL, /* all attempts to contact server timed out, sleeping */
|
||||
DHC4_EXPIRE, /* lease has expired, renewing */
|
||||
DHC4_RELEASE, /* releasing lease */
|
||||
|
||||
/* This state raised by both clients: */
|
||||
DHC_TIMEDOUT, /* libdhcp_control timeout has been exceeded */
|
||||
|
||||
/* DHCPv6 client states: */
|
||||
DHC6_BOUND, /* new lease obtained - arg is optinfo * */
|
||||
DHC6_REBIND, /* existing expired lease rebound - arg is optinfo * */
|
||||
DHC6_RELEASE /* existing lease expired - arg is dhcp6_iaidaddr*/
|
||||
} DHCP_State;
|
||||
|
||||
struct libdhcp_control_s;
|
||||
|
||||
/* ala syslog(3): LOG_EMERG=0 - LOG_DEBUG=7 (+ LOG_FATAL=8 : finished -> 1) */
|
||||
typedef int (*LIBDHCP_Error_Handler) (struct libdhcp_control_s *ctl,
|
||||
int priority, const char *fmt,
|
||||
va_list ap);
|
||||
|
||||
/* The DHCP clients will call the users' callback on important state change
|
||||
* events, with the second arg set to the client DHCP_State, and the third
|
||||
* arg set to a client specific pointer as described below. */
|
||||
typedef int (*LIBDHCP_Callback) (struct libdhcp_control_s *control,
|
||||
enum dhcp_state_e, void*);
|
||||
|
||||
typedef struct libdhcp_control_s {
|
||||
/* the DHCP clients' main loop calls this on state changes */
|
||||
LIBDHCP_Callback callback;
|
||||
|
||||
/* LIBDHCP_Capability bits to enable */
|
||||
uint16_t capability;
|
||||
|
||||
/* set to one to make clients exit their main loop */
|
||||
uint8_t finished;
|
||||
|
||||
/* set to one to decline the lease (DHCPv4 only) */
|
||||
uint8_t decline;
|
||||
|
||||
/* (timeout+now) == time after which clients MUST return */
|
||||
time_t timeout;
|
||||
|
||||
/* clients set this to time(0) on entering main loop */
|
||||
time_t now;
|
||||
|
||||
/* user data pointer */
|
||||
void *arg;
|
||||
LIBDHCP_Error_Handler eh;
|
||||
} LIBDHCP_Control;
|
||||
|
||||
/* DHCP client "capabilities" */
|
||||
typedef enum libdhcp_capability_e {
|
||||
/* use / do not use persistent lease database files */
|
||||
DHCP_USE_LEASE_DATABASE = 1,
|
||||
|
||||
/* use / do not use pid file */
|
||||
DHCP_USE_PID_FILE = 2,
|
||||
|
||||
/*
|
||||
* DHCPv6 supports these capabilities in process,
|
||||
* while the DHCPv4 client will fork and exec the dhclient-script to
|
||||
* implement them if these bits are set - otherwise, if no bits are set,
|
||||
* the callback is called and the script is not run.
|
||||
*/
|
||||
/* configure interfaces UP/DOWN as required */
|
||||
DHCP_CONFIGURE_INTERFACES = 4,
|
||||
|
||||
/* configure interface addresses as required */
|
||||
DHCP_CONFIGURE_ADDRESSES = 8,
|
||||
|
||||
/* configure routes as required */
|
||||
DHCP_CONFIGURE_ROUTES = 16,
|
||||
|
||||
/* configure resolv.conf as required */
|
||||
DHCP_CONFIGURE_RESOLVER = 32,
|
||||
|
||||
/* DHCPv6 only: */
|
||||
/* configure radvd.conf & restart radvd as required */
|
||||
DHCP_CONFIGURE_RADVD = 64,
|
||||
} LIBDHCP_Capability;
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user