- Ensure that Perl and Perl modules are not added as dependencies (#234688)
- Reorganize patches by feature/bug per packaging guidelines (#225691) - Move the following files from patches to source files: linux.dbus-example, linux, Makefile.dist, dhcp4client.h, libdhcp_control.h - Compile with -fno-strict-aliasing as ISC coding standards generally don't agree well with gcc 4.x.x
This commit is contained in:
parent
bf0715cdf3
commit
3b727ca6ac
127
Makefile.dist
Normal file
127
Makefile.dist
Normal file
@ -0,0 +1,127 @@
|
||||
# Makefile.dist for libdhcp4client
|
||||
#
|
||||
# We get the libdhcp4client library from the patched ISC source code. We
|
||||
# rebuild key C files with -DLIBDHCP to turn on the library features we
|
||||
# need. Normal build results in standard ISC code (i.e., not LIBDHCP
|
||||
# stuff enabled). We then link together a static library and a shared
|
||||
# library with the new resulting objects.
|
||||
#
|
||||
# David Cantrell <dcantrell@redhat.com>
|
||||
|
||||
# What version of ISC DHCP is this?
|
||||
VER = $(shell grep DHCP_VERSION ../../includes/version.h | head -1 | cut -d '"' -f 2 | cut -d 'V' -f 2 | cut -d '-' -f 1)
|
||||
|
||||
PROGS = libdhcp4client.a libdhcp4client-$(VER).so.0
|
||||
|
||||
# NOTE: The ordering of these file lists is important! We are using the
|
||||
# whole program optimization features of gcc, so the order matters here.
|
||||
|
||||
# Source files shared by all objects
|
||||
COMMON_SRCS = client_clparse.c client_dhclient.c common_alloc.c common_bpf.c \
|
||||
common_comapi.c common_conflex.c common_discover.c \
|
||||
common_dispatch.c common_dns.c common_ethernet.c \
|
||||
common_execute.c common_inet.c common_lpf.c common_memory.c \
|
||||
common_options.c common_packet.c common_parse.c common_print.c \
|
||||
common_socket.c common_tables.c common_tr.c common_tree.c \
|
||||
dst_dst_api.c dst_base64.c dst_hmac_link.c dst_md5_dgst.c \
|
||||
omapip_alloc.c omapip_array.c omapip_auth.c omapip_buffer.c \
|
||||
omapip_connection.c omapip_convert.c omapip_dispatch.c \
|
||||
omapip_errwarn.c omapip_handle.c omapip_hash.c \
|
||||
omapip_listener.c omapip_mrtrace.c omapip_result.c \
|
||||
omapip_support.c omapip_toisc.c omapip_trace.c
|
||||
|
||||
# Source files for libdhcp4client.o
|
||||
CLIENT_SRCS = common_ctrace.c common_dlpi.c common_nit.c common_upf.c \
|
||||
dst_dst_support.c dst_prandom.c omapip_generic.c \
|
||||
omapip_message.c omapip_protocol.c
|
||||
|
||||
# Source files for libres.o (minires)
|
||||
MINIRES_SRCS = minires_ns_date.c minires_ns_name.c minires_ns_parse.c \
|
||||
minires_ns_samedomain.c minires_ns_sign.c minires_ns_verify.c \
|
||||
minires_res_comp.c minires_res_findzonecut.c \
|
||||
minires_res_init.c minires_res_mkquery.c \
|
||||
minires_res_mkupdate.c minires_res_query.c minires_res_send.c \
|
||||
minires_res_sendsigned.c minires_res_update.c
|
||||
|
||||
HDRS = dhcp4client.h libdhcp_control.h
|
||||
SRCS = $(COMMON_SRCS) $(CLIENT_SRCS)
|
||||
OBJS = $(SRCS:.c=.o)
|
||||
|
||||
INCLUDES = -I$(TOP) -I$(TOP)/includes -I$(TOP)/dst -I.
|
||||
CFLAGS = $(DEBUG) $(PREDEFINES) $(INCLUDES) $(COPTS) \
|
||||
-DCLIENT_PATH=${CLIENT_PATH} -DLIBDHCP -DUSE_MD5
|
||||
|
||||
all: $(PROGS)
|
||||
|
||||
install: all
|
||||
install -p -m 0755 -D libdhcp4client-$(VER).so.0 $(DESTDIR)$(LIBDIR)/libdhcp4client-$(VER).so.0
|
||||
ln -sf libdhcp4client-$(VER).so.0 $(DESTDIR)/$(LIBDIR)/libdhcp4client.so
|
||||
install -p -m 0644 -D libdhcp4client.a $(DESTDIR)$(LIBDIR)/libdhcp4client.a
|
||||
install -p -m 0644 -D dhcp4client.h $(DESTDIR)$(INCDIR)/dhcp4client/dhcp4client.h
|
||||
install -p -m 0644 -D libdhcp_control.h $(DESTDIR)$(INCDIR)/dhcp4client/libdhcp_control.h
|
||||
( cd $(TOP)/includes ; \
|
||||
find . -name "*.h" -type f | while read h ; do \
|
||||
install -p -m 0644 -D $$h $(DESTDIR)$(INCDIR)/dhcp4client/isc_dhcp/$$h ; \
|
||||
done ; \
|
||||
)
|
||||
|
||||
depend:
|
||||
$(MKDEP) $(INCLUDES) $(PREDEFINES) $(SRCS)
|
||||
|
||||
clean:
|
||||
-rm -f $(OBJS)
|
||||
|
||||
realclean: clean
|
||||
-rm -f $(PROG) *~ #*
|
||||
|
||||
distclean: realclean
|
||||
-rm -f Makefile
|
||||
|
||||
# This isn't the cleanest way to set up links, but I prefer this so I don't
|
||||
# need object targets for each subdirectory. The idea is simple. Since
|
||||
# libdhcp4client is a linked together wad of objects from across the source
|
||||
# tree, we change / to _ when linking source files here. Follow this example:
|
||||
#
|
||||
# We need to use client/dhclient.c, so we make this link:
|
||||
# rm -f client_dhclient.c
|
||||
# ln -s $(TOP)/client/dhclient.c client_dhclient.c
|
||||
#
|
||||
# Simple. Given the way the ISC build system works, this is the easiest to
|
||||
# maintain and least invasive.
|
||||
#
|
||||
# David Cantrell <dcantrell@redhat.com>
|
||||
links:
|
||||
@for target in $(SRCS); do \
|
||||
source="`echo $$target | sed -e 's|_|/|'`"; \
|
||||
if [ ! -b $$target ]; then \
|
||||
rm -f $$target; \
|
||||
fi; \
|
||||
ln -s $(TOP)/$$source $$target; \
|
||||
done; \
|
||||
for hdr in $(HDRS); do \
|
||||
if [ ! -b $$hdr ]; then \
|
||||
rm -f $$hdr; \
|
||||
fi; \
|
||||
ln -s $(TOP)/libdhcp4client/$$hdr $$hdr; \
|
||||
done
|
||||
|
||||
# minires is difficult to build because it overrides things in common and dst,
|
||||
# so we just link with the already built libres.a since we need it all anyway
|
||||
libres.a:
|
||||
if [ ! -f ../minires/$@ ]; then \
|
||||
$(MAKE) -C ../minires; \
|
||||
fi; \
|
||||
ln ../minires/libres.a .; \
|
||||
$(AR) x libres.a
|
||||
|
||||
# Create the libraries
|
||||
# minires/res_query.o contains an undefined symbol __h_errno_set, is not
|
||||
# used by any dhcp code, and is optimized out by the linker when producing
|
||||
# the dhclient executable or a shared library
|
||||
libdhcp4client.a: $(OBJS) libres.a
|
||||
$(AR) crus $@ $(OBJS) `$(AR) t libres.a | grep -v res_query.o`
|
||||
|
||||
libdhcp4client-$(VER).so.0: $(OBJS) libres.a
|
||||
$(CC) -shared -o $@ -Wl,-soname,$@ $(OBJS) `$(AR) t libres.a | grep -v res_query.o`
|
||||
|
||||
# Dependencies (semi-automatically-generated)
|
12
dhcp-3.0.5-default-requested-options.patch
Normal file
12
dhcp-3.0.5-default-requested-options.patch
Normal file
@ -0,0 +1,12 @@
|
||||
--- dhcp-3.0.5/client/clparse.c.dho 2007-03-30 16:40:14.000000000 -0400
|
||||
+++ dhcp-3.0.5/client/clparse.c 2007-03-30 16:43:53.000000000 -0400
|
||||
@@ -49,6 +49,9 @@
|
||||
DHO_DOMAIN_NAME,
|
||||
DHO_DOMAIN_NAME_SERVERS,
|
||||
DHO_HOST_NAME,
|
||||
+ DHO_NIS_DOMAIN,
|
||||
+ DHO_NIS_SERVERS,
|
||||
+ DHO_NTP_SERVERS,
|
||||
0
|
||||
};
|
||||
|
58
dhcp-3.0.5-dhclient-decline-backoff.patch
Normal file
58
dhcp-3.0.5-dhclient-decline-backoff.patch
Normal file
@ -0,0 +1,58 @@
|
||||
--- dhcp-3.0.5/client/dhclient.c.decline 2007-03-30 15:29:58.000000000 -0400
|
||||
+++ dhcp-3.0.5/client/dhclient.c 2007-03-30 15:50:25.000000000 -0400
|
||||
@@ -934,6 +934,7 @@
|
||||
void *cpp;
|
||||
{
|
||||
struct client_state *client = cpp;
|
||||
+ enum dhcp_state init_state = client->state;
|
||||
|
||||
ASSERT_STATE(state, S_INIT);
|
||||
|
||||
@@ -946,9 +947,16 @@
|
||||
client -> first_sending = cur_time;
|
||||
client -> interval = client -> config -> initial_interval;
|
||||
|
||||
- /* Add an immediate timeout to cause the first DHCPDISCOVER packet
|
||||
- to go out. */
|
||||
- send_discover (client);
|
||||
+ if (init_state != S_DECLINED) {
|
||||
+ /* Add an immediate timeout to cause the first DHCPDISCOVER packet
|
||||
+ to go out. */
|
||||
+ send_discover(client);
|
||||
+ } else {
|
||||
+ /* We've received an OFFER and it has been DECLINEd by dhclient-script.
|
||||
+ * wait for a random time between 1 and backoff_cutoff seconds before
|
||||
+ * trying again. */
|
||||
+ add_timeout(cur_time + ((1 + (random() >> 2)) % client->config->backoff_cutoff), send_discover, client, 0, 0);
|
||||
+ }
|
||||
}
|
||||
|
||||
/* state_selecting is called when one or more DHCPOFFER packets have been
|
||||
@@ -1215,6 +1223,7 @@
|
||||
send_decline (client);
|
||||
destroy_client_lease (client -> new);
|
||||
client -> new = (struct client_lease *)0;
|
||||
+ client -> state = S_DECLINED;
|
||||
state_init (client);
|
||||
return;
|
||||
}
|
||||
@@ -3183,6 +3192,7 @@
|
||||
case S_INIT:
|
||||
case S_REBINDING:
|
||||
case S_STOPPED:
|
||||
+ case S_DECLINED:
|
||||
break;
|
||||
}
|
||||
client -> state = S_INIT;
|
||||
--- dhcp-3.0.5/includes/dhcpd.h.decline 2007-03-30 15:30:14.000000000 -0400
|
||||
+++ dhcp-3.0.5/includes/dhcpd.h 2007-03-30 15:50:53.000000000 -0400
|
||||
@@ -704,7 +704,8 @@
|
||||
S_BOUND = 5,
|
||||
S_RENEWING = 6,
|
||||
S_REBINDING = 7,
|
||||
- S_STOPPED = 8
|
||||
+ S_STOPPED = 8,
|
||||
+ S_DECLINED = 9
|
||||
};
|
||||
|
||||
/* Authentication and BOOTP policy possibilities (not all values work
|
42
dhcp-3.0.5-dhclient-usage.patch
Normal file
42
dhcp-3.0.5-dhclient-usage.patch
Normal file
@ -0,0 +1,42 @@
|
||||
--- dhcp-3.0.5/client/dhclient.c.usage 2007-04-01 13:49:43.000000000 -0400
|
||||
+++ dhcp-3.0.5/client/dhclient.c 2007-04-01 13:51:25.000000000 -0400
|
||||
@@ -819,20 +819,29 @@
|
||||
|
||||
static void usage ()
|
||||
{
|
||||
- log_info ("%s %s", message, DHCP_VERSION);
|
||||
- log_info (copyright);
|
||||
- log_info (arr);
|
||||
- log_info (url);
|
||||
+ printf ("%s %s\n", message, DHCP_VERSION);
|
||||
+ printf (copyright);
|
||||
+ printf ("\n");
|
||||
+ printf (arr);
|
||||
+ printf ("\n");
|
||||
+ printf (url);
|
||||
+ printf ("\n");
|
||||
|
||||
#ifdef EXTENDED_NEW_OPTION_INFO
|
||||
- log_error ("Usage: dhclient [-1dqr] [-nwx] [-p <port>] %s",
|
||||
+ printf ("Usage: dhclient [-1dqr] [-nwx] [-p <port>] %s",
|
||||
#else
|
||||
- log_error ("Usage: dhclient [-1dqr] [-nw] [-p <port>] %s",
|
||||
+ printf ("Usage: dhclient [-1dqr] [-nw] [-p <port>] %s",
|
||||
#endif
|
||||
- "[-s server]");
|
||||
- log_error (" [-cf config-file] [-lf lease-file]%s",
|
||||
- "[-pf pid-file] [-e VAR=val]");
|
||||
- log_fatal (" [-sf script-file] [interface]");
|
||||
+ "[-s server]");
|
||||
+ printf (" [-cf config-file] [-lf lease-file]%s",
|
||||
+ "[-pf pid-file] [-e VAR=val]");
|
||||
+ printf (" [ -I <dhcp-client-identifier> ] [-B]\n");
|
||||
+ printf (" [ -H <host-name> | -F <fqdn.fqdn> ] [ -T <timeout> ]\n");
|
||||
+ printf (" [ -V <vendor-class-identifier> ]\n");
|
||||
+ printf (" [ -R <request option list> ]\n");
|
||||
+ printf (" [-sf script-file] [interface]");
|
||||
+
|
||||
+ exit (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
isc_result_t find_class (struct class **c,
|
15
dhcp-3.0.5-enable-timeout-functions.patch
Normal file
15
dhcp-3.0.5-enable-timeout-functions.patch
Normal file
@ -0,0 +1,15 @@
|
||||
--- dhcp-3.0.5/common/dispatch.c.ecat 2006-02-22 17:43:27.000000000 -0500
|
||||
+++ dhcp-3.0.5/common/dispatch.c 2007-03-30 15:54:15.000000000 -0400
|
||||
@@ -195,7 +195,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
-#if defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT)
|
||||
void cancel_all_timeouts ()
|
||||
{
|
||||
struct timeout *t, *n;
|
||||
@@ -216,4 +215,3 @@
|
||||
dfree (t, MDL);
|
||||
}
|
||||
}
|
||||
-#endif
|
29
dhcp-3.0.5-errwarn-message.patch
Normal file
29
dhcp-3.0.5-errwarn-message.patch
Normal file
@ -0,0 +1,29 @@
|
||||
--- dhcp-3.0.5/omapip/errwarn.c.message 2007-03-29 15:03:12.000000000 -0400
|
||||
+++ dhcp-3.0.5/omapip/errwarn.c 2007-03-29 15:08:50.000000000 -0400
|
||||
@@ -80,20 +80,13 @@
|
||||
|
||||
#if !defined (NOMINUM)
|
||||
log_error ("%s", "");
|
||||
- log_error ("If you did not get this software from ftp.isc.org, please");
|
||||
- log_error ("get the latest from ftp.isc.org and install that before");
|
||||
- log_error ("requesting help.");
|
||||
+ log_error ("This version of ISC DHCP is based on the release available");
|
||||
+ log_error ("on ftp.isc.org. Features have been added and other changes");
|
||||
+ log_error ("have been made to the base software release in order to make");
|
||||
+ log_error ("it work better with this distribution.");
|
||||
log_error ("%s", "");
|
||||
- log_error ("If you did get this software from ftp.isc.org and have not");
|
||||
- log_error ("yet read the README, please read it before requesting help.");
|
||||
- log_error ("If you intend to request help from the dhcp-server@isc.org");
|
||||
- log_error ("mailing list, please read the section on the README about");
|
||||
- log_error ("submitting bug reports and requests for help.");
|
||||
- log_error ("%s", "");
|
||||
- log_error ("Please do not under any circumstances send requests for");
|
||||
- log_error ("help directly to the authors of this software - please");
|
||||
- log_error ("send them to the appropriate mailing list as described in");
|
||||
- log_error ("the README file.");
|
||||
+ log_error ("Please report for this software via the Red Hat Bugzilla site:");
|
||||
+ log_error (" http://bugzilla.redhat.com");
|
||||
log_error ("%s", "");
|
||||
log_error ("exiting.");
|
||||
#endif
|
@ -1,5 +1,5 @@
|
||||
--- dhcp-3.0.5/client/dhclient.c.enoi 2006-08-22 11:13:57.000000000 -0400
|
||||
+++ dhcp-3.0.5/client/dhclient.c 2007-03-04 15:19:43.000000000 -0500
|
||||
--- dhcp-3.0.5/client/dhclient.c.enoi 2007-03-30 16:27:32.000000000 -0400
|
||||
+++ dhcp-3.0.5/client/dhclient.c 2007-03-30 16:27:51.000000000 -0400
|
||||
@@ -74,6 +74,9 @@
|
||||
int onetry=0;
|
||||
int quiet=0;
|
||||
@ -10,7 +10,7 @@
|
||||
|
||||
static void usage PROTO ((void));
|
||||
|
||||
@@ -204,6 +207,11 @@
|
||||
@@ -203,6 +206,11 @@
|
||||
} else if (!strcmp (argv [i], "--version")) {
|
||||
log_info ("isc-dhclient-%s", DHCP_VERSION);
|
||||
exit (0);
|
||||
@ -22,7 +22,7 @@
|
||||
} else if (argv [i][0] == '-') {
|
||||
usage ();
|
||||
} else {
|
||||
@@ -476,7 +484,11 @@
|
||||
@@ -475,7 +483,11 @@
|
||||
log_info (arr);
|
||||
log_info (url);
|
||||
|
||||
@ -34,7 +34,7 @@
|
||||
"[-s server]");
|
||||
log_error (" [-cf config-file] [-lf lease-file]%s",
|
||||
"[-pf pid-file] [-e VAR=val]");
|
||||
@@ -2447,8 +2459,30 @@
|
||||
@@ -2426,8 +2438,30 @@
|
||||
struct envadd_state {
|
||||
struct client_state *client;
|
||||
const char *prefix;
|
||||
@ -65,7 +65,7 @@
|
||||
void client_option_envadd (struct option_cache *oc,
|
||||
struct packet *packet, struct lease *lease,
|
||||
struct client_state *client_state,
|
||||
@@ -2465,6 +2499,28 @@
|
||||
@@ -2444,6 +2478,28 @@
|
||||
in_options, cfg_options, scope, oc, MDL)) {
|
||||
if (data.len) {
|
||||
char name [256];
|
||||
@ -94,7 +94,15 @@
|
||||
if (dhcp_option_ev_name (name, sizeof name,
|
||||
oc -> option)) {
|
||||
client_envadd (es -> client, es -> prefix,
|
||||
@@ -2704,7 +2760,14 @@
|
||||
@@ -2470,6 +2526,7 @@
|
||||
|
||||
es.client = client;
|
||||
es.prefix = prefix;
|
||||
+ es.universe = NULL;
|
||||
|
||||
client_envadd (client,
|
||||
prefix, "ip_address", "%s", piaddr (lease -> address));
|
||||
@@ -2679,7 +2736,14 @@
|
||||
s = option -> name;
|
||||
if (j + 1 == buflen)
|
||||
return 0;
|
||||
@ -110,7 +118,7 @@
|
||||
++i;
|
||||
} while (i != 2);
|
||||
--- dhcp-3.0.5/client/dhclient.8.enoi 2005-09-14 12:03:33.000000000 -0400
|
||||
+++ dhcp-3.0.5/client/dhclient.8 2007-03-04 15:19:43.000000000 -0500
|
||||
+++ dhcp-3.0.5/client/dhclient.8 2007-03-30 16:27:32.000000000 -0400
|
||||
@@ -82,6 +82,9 @@
|
||||
.B -w
|
||||
]
|
||||
@ -133,9 +141,9 @@
|
||||
.SH CONFIGURATION
|
||||
The syntax of the dhclient.conf(5) file is discussed separately.
|
||||
.SH OMAPI
|
||||
--- dhcp-3.0.5/common/parse.c.enoi 2006-02-22 17:43:27.000000000 -0500
|
||||
+++ dhcp-3.0.5/common/parse.c 2007-03-04 15:19:43.000000000 -0500
|
||||
@@ -1271,6 +1271,10 @@
|
||||
--- dhcp-3.0.5/common/parse.c.enoi 2007-03-30 16:27:32.000000000 -0400
|
||||
+++ dhcp-3.0.5/common/parse.c 2007-03-30 16:27:32.000000000 -0400
|
||||
@@ -1266,6 +1266,10 @@
|
||||
option_hash_add (option -> universe -> hash,
|
||||
(const char *)option -> name,
|
||||
0, option, MDL);
|
||||
@ -147,7 +155,7 @@
|
||||
}
|
||||
|
||||
--- dhcp-3.0.5/common/tables.c.enoi 2006-02-22 17:43:27.000000000 -0500
|
||||
+++ dhcp-3.0.5/common/tables.c 2007-03-04 15:19:43.000000000 -0500
|
||||
+++ dhcp-3.0.5/common/tables.c 2007-03-30 16:27:32.000000000 -0400
|
||||
@@ -1250,3 +1250,35 @@
|
||||
fqdn_universe.name, 0,
|
||||
&fqdn_universe, MDL);
|
||||
@ -185,7 +193,7 @@
|
||||
+}
|
||||
+#endif
|
||||
--- dhcp-3.0.5/includes/dhcpd.h.enoi 2006-05-17 16:16:59.000000000 -0400
|
||||
+++ dhcp-3.0.5/includes/dhcpd.h 2007-03-04 15:19:43.000000000 -0500
|
||||
+++ dhcp-3.0.5/includes/dhcpd.h 2007-03-30 16:27:32.000000000 -0400
|
||||
@@ -1811,6 +1811,13 @@
|
||||
void initialize_common_option_spaces PROTO ((void));
|
||||
struct universe *config_universe;
|
||||
|
22
dhcp-3.0.5-failover-ports.patch
Normal file
22
dhcp-3.0.5-failover-ports.patch
Normal file
@ -0,0 +1,22 @@
|
||||
--- dhcp-3.0.5/server/confpars.c.failover 2007-03-30 16:28:08.000000000 -0400
|
||||
+++ dhcp-3.0.5/server/confpars.c 2007-03-30 16:32:39.000000000 -0400
|
||||
@@ -998,10 +998,17 @@
|
||||
parse_warn (cfile, "peer address may not be omitted");
|
||||
|
||||
/* XXX - when/if we get a port number assigned, just set as default */
|
||||
+ /* See Red Hat Bugzilla 167292:
|
||||
+ * we do now: dhcp-failover 647/tcp
|
||||
+ * dhcp-failover 647/udp
|
||||
+ * dhcp-failover 847/tcp
|
||||
+ * dhcp-failover 847/udp
|
||||
+ * IANA registration by Bernard Volz <volz@cisco.com>
|
||||
+ */
|
||||
if (!peer -> me.port)
|
||||
- parse_warn (cfile, "local port may not be omitted");
|
||||
+ peer -> me.port = 647;
|
||||
if (!peer -> partner.port)
|
||||
- parse_warn (cfile, "peer port may not be omitted");
|
||||
+ peer -> partner.port = 847;
|
||||
|
||||
if (peer -> i_am == primary) {
|
||||
if (!peer -> hba) {
|
14
dhcp-3.0.5-fast-timeout.patch
Normal file
14
dhcp-3.0.5-fast-timeout.patch
Normal file
@ -0,0 +1,14 @@
|
||||
--- dhcp-3.0.5/client/dhclient.c.fast 2007-03-30 16:22:54.000000000 -0400
|
||||
+++ dhcp-3.0.5/client/dhclient.c 2007-03-30 16:26:11.000000000 -0400
|
||||
@@ -766,10 +766,7 @@
|
||||
do_release (client);
|
||||
else {
|
||||
client -> state = S_INIT;
|
||||
- /* Set up a timeout to start the initialization
|
||||
- process. */
|
||||
- add_timeout (cur_time + random () % 5,
|
||||
- state_reboot, client, 0, 0);
|
||||
+ add_timeout (cur_time, state_reboot, client, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
17
dhcp-3.0.5-inherit-leases.patch
Normal file
17
dhcp-3.0.5-inherit-leases.patch
Normal file
@ -0,0 +1,17 @@
|
||||
--- dhcp-3.0.5/client/dhclient.c.inherit 2007-03-30 16:06:30.000000000 -0400
|
||||
+++ dhcp-3.0.5/client/dhclient.c 2007-03-30 16:09:06.000000000 -0400
|
||||
@@ -720,6 +720,14 @@
|
||||
continue;
|
||||
script_init (ip -> client,
|
||||
"PREINIT", (struct string_list *)0);
|
||||
+ /* Has an active lease */
|
||||
+ if (ip->client->active &&
|
||||
+ !ip->client->active->is_bootp &&
|
||||
+ ip->client->active->expiry > cur_time &&
|
||||
+ ip->primary_address.s_addr != 0 &&
|
||||
+ ip->client->active->address.len == 4 &&
|
||||
+ memcmp(ip->client->active->address.iabuf, &ip->primary_address, 4) == 0)
|
||||
+ client_envadd(ip->client, "", "keep_old_ip", "%s", "yes");
|
||||
if (ip -> client -> alias)
|
||||
script_write_params (ip -> client, "alias_",
|
||||
ip -> client -> alias);
|
@ -1,5 +1,5 @@
|
||||
--- dhcp-3.0.5/common/conflex.c.ldapconf 2007-03-04 15:32:24.000000000 -0500
|
||||
+++ dhcp-3.0.5/common/conflex.c 2007-03-04 15:32:24.000000000 -0500
|
||||
--- dhcp-3.0.5/common/conflex.c.ldap 2006-02-22 17:43:27.000000000 -0500
|
||||
+++ dhcp-3.0.5/common/conflex.c 2007-03-29 15:11:19.000000000 -0400
|
||||
@@ -47,6 +47,7 @@
|
||||
static enum dhcp_token read_number PROTO ((int, struct parse *));
|
||||
static enum dhcp_token read_num_or_name PROTO ((int, struct parse *));
|
||||
@ -46,7 +46,7 @@
|
||||
} else {
|
||||
c = cfile -> inbuf [cfile -> bufix];
|
||||
cfile -> bufix++;
|
||||
@@ -1130,3 +1124,25 @@
|
||||
@@ -1128,3 +1122,25 @@
|
||||
}
|
||||
return dfv;
|
||||
}
|
||||
@ -72,8 +72,8 @@
|
||||
+ return c;
|
||||
+}
|
||||
+
|
||||
--- dhcp-3.0.5/common/print.c.ldapconf 2007-03-04 15:32:24.000000000 -0500
|
||||
+++ dhcp-3.0.5/common/print.c 2007-03-04 15:32:24.000000000 -0500
|
||||
--- dhcp-3.0.5/common/print.c.ldap 2007-03-29 15:10:26.000000000 -0400
|
||||
+++ dhcp-3.0.5/common/print.c 2007-03-29 15:11:19.000000000 -0400
|
||||
@@ -166,9 +166,9 @@
|
||||
}
|
||||
|
||||
@ -87,8 +87,8 @@
|
||||
{
|
||||
static char habuf [49];
|
||||
char *s;
|
||||
--- dhcp-3.0.5/includes/dhcpd.h.ldapconf 2007-03-04 15:32:24.000000000 -0500
|
||||
+++ dhcp-3.0.5/includes/dhcpd.h 2007-03-04 15:32:24.000000000 -0500
|
||||
--- dhcp-3.0.5/includes/dhcpd.h.ldap 2007-03-29 15:10:26.000000000 -0400
|
||||
+++ dhcp-3.0.5/includes/dhcpd.h 2007-03-29 15:11:19.000000000 -0400
|
||||
@@ -79,6 +79,11 @@
|
||||
#include <isc-dhcp/result.h>
|
||||
#include <omapip/omapip_p.h>
|
||||
@ -154,7 +154,7 @@
|
||||
#if !defined (DEFAULT_DEFAULT_LEASE_TIME)
|
||||
# define DEFAULT_DEFAULT_LEASE_TIME 43200
|
||||
#endif
|
||||
@@ -1526,7 +1563,7 @@
|
||||
@@ -1531,7 +1568,7 @@
|
||||
char *quotify_string (const char *, const char *, int);
|
||||
char *quotify_buf (const unsigned char *, unsigned, const char *, int);
|
||||
char *print_base64 (const unsigned char *, unsigned, const char *, int);
|
||||
@ -163,7 +163,7 @@
|
||||
void print_lease PROTO ((struct lease *));
|
||||
void dump_raw PROTO ((const unsigned char *, unsigned));
|
||||
void dump_packet_option (struct option_cache *, struct packet *,
|
||||
@@ -2640,3 +2677,14 @@
|
||||
@@ -2639,3 +2676,14 @@
|
||||
#endif /* FAILOVER_PROTOCOL */
|
||||
|
||||
const char *binding_state_print (enum failover_state);
|
||||
@ -178,8 +178,8 @@
|
||||
+ struct data_string *);
|
||||
+#endif
|
||||
+
|
||||
--- dhcp-3.0.5/includes/site.h.ldapconf 2002-03-12 13:33:39.000000000 -0500
|
||||
+++ dhcp-3.0.5/includes/site.h 2007-03-04 15:32:24.000000000 -0500
|
||||
--- dhcp-3.0.5/includes/site.h.ldap 2002-03-12 13:33:39.000000000 -0500
|
||||
+++ dhcp-3.0.5/includes/site.h 2007-03-29 15:11:19.000000000 -0400
|
||||
@@ -177,3 +177,13 @@
|
||||
traces. */
|
||||
|
||||
@ -194,8 +194,8 @@
|
||||
+#define _PATH_DHCLIENT_DB "/var/lib/dhclient/dhclient.leases"
|
||||
+#define _PATH_DHCPD_DB "/var/lib/dhcpd/dhcpd.leases"
|
||||
+#define _PATH_DHCLIENT_DB "/var/lib/dhclient/dhclient.leases"
|
||||
--- dhcp-3.0.5/server/Makefile.dist.ldapconf 2004-06-10 13:59:50.000000000 -0400
|
||||
+++ dhcp-3.0.5/server/Makefile.dist 2007-03-04 15:33:01.000000000 -0500
|
||||
--- dhcp-3.0.5/server/Makefile.dist.ldap 2004-06-10 13:59:50.000000000 -0400
|
||||
+++ dhcp-3.0.5/server/Makefile.dist 2007-03-29 15:11:19.000000000 -0400
|
||||
@@ -25,9 +25,9 @@
|
||||
CATMANPAGES = dhcpd.cat8 dhcpd.conf.cat5 dhcpd.leases.cat5
|
||||
SEDMANPAGES = dhcpd.man8 dhcpd.conf.man5 dhcpd.leases.man5
|
||||
@ -216,8 +216,8 @@
|
||||
+ $(CC) $(LFLAGS) -o dhcpd $(OBJS) $(DHCPLIB) $(LIBS) -lldap
|
||||
|
||||
# Dependencies (semi-automatically-generated)
|
||||
--- dhcp-3.0.5/server/class.c.ldapconf 2004-06-10 13:59:51.000000000 -0400
|
||||
+++ dhcp-3.0.5/server/class.c 2007-03-04 15:32:24.000000000 -0500
|
||||
--- dhcp-3.0.5/server/class.c.ldap 2004-06-10 13:59:51.000000000 -0400
|
||||
+++ dhcp-3.0.5/server/class.c 2007-03-29 15:11:19.000000000 -0400
|
||||
@@ -90,6 +90,7 @@
|
||||
int matched = 0;
|
||||
int status;
|
||||
@ -249,8 +249,8 @@
|
||||
#if defined (DEBUG_CLASS_MATCHING)
|
||||
log_info ("matches subclass %s.",
|
||||
print_hex_1 (data.len,
|
||||
--- dhcp-3.0.5/server/confpars.c.ldapconf 2007-03-04 15:32:24.000000000 -0500
|
||||
+++ dhcp-3.0.5/server/confpars.c 2007-03-04 15:32:24.000000000 -0500
|
||||
--- dhcp-3.0.5/server/confpars.c.ldap 2007-03-29 15:10:26.000000000 -0400
|
||||
+++ dhcp-3.0.5/server/confpars.c 2007-03-29 15:11:19.000000000 -0400
|
||||
@@ -63,7 +63,17 @@
|
||||
|
||||
isc_result_t readconf ()
|
||||
@ -270,8 +270,8 @@
|
||||
}
|
||||
|
||||
isc_result_t read_conf_file (const char *filename, struct group *group,
|
||||
--- dhcp-3.0.5/server/dhcpd.c.ldapconf 2007-03-04 15:32:24.000000000 -0500
|
||||
+++ dhcp-3.0.5/server/dhcpd.c 2007-03-04 15:32:24.000000000 -0500
|
||||
--- dhcp-3.0.5/server/dhcpd.c.ldap 2007-03-29 15:10:26.000000000 -0400
|
||||
+++ dhcp-3.0.5/server/dhcpd.c 2007-03-29 15:11:19.000000000 -0400
|
||||
@@ -433,6 +433,9 @@
|
||||
/* Add the ddns update style enumeration prior to parsing. */
|
||||
add_enumeration (&ddns_styles);
|
||||
@ -282,8 +282,8 @@
|
||||
|
||||
if (!group_allocate (&root_group, MDL))
|
||||
log_fatal ("Can't allocate root group!");
|
||||
--- /dev/null 2007-03-03 18:04:36.394738328 -0500
|
||||
+++ dhcp-3.0.5/server/ldap.c 2007-03-04 15:32:24.000000000 -0500
|
||||
--- /dev/null 2007-03-29 11:34:09.579686084 -0400
|
||||
+++ dhcp-3.0.5/server/ldap.c 2007-03-29 15:11:19.000000000 -0400
|
||||
@@ -0,0 +1,1142 @@
|
||||
+/* ldap.c
|
||||
+
|
||||
@ -1427,8 +1427,8 @@
|
||||
+
|
||||
+#endif
|
||||
+
|
||||
--- dhcp-3.0.5/server/mdb.c.ldapconf 2007-03-04 15:32:24.000000000 -0500
|
||||
+++ dhcp-3.0.5/server/mdb.c 2007-03-04 15:32:24.000000000 -0500
|
||||
--- dhcp-3.0.5/server/mdb.c.ldap 2007-03-29 15:10:26.000000000 -0400
|
||||
+++ dhcp-3.0.5/server/mdb.c 2007-03-29 15:11:19.000000000 -0400
|
||||
@@ -373,6 +373,12 @@
|
||||
const char *file, int line)
|
||||
{
|
||||
@ -1442,8 +1442,8 @@
|
||||
|
||||
h.hlen = hlen + 1;
|
||||
h.hbuf [0] = htype;
|
||||
--- dhcp-3.0.5/server/stables.c.ldapconf 2004-06-10 13:59:58.000000000 -0400
|
||||
+++ dhcp-3.0.5/server/stables.c 2007-03-04 15:32:24.000000000 -0500
|
||||
--- dhcp-3.0.5/server/stables.c.ldap 2004-06-10 13:59:58.000000000 -0400
|
||||
+++ dhcp-3.0.5/server/stables.c 2007-03-29 15:11:19.000000000 -0400
|
||||
@@ -483,12 +483,21 @@
|
||||
{ "log-facility", "Nsyslog-facilities.", &server_universe, 44 },
|
||||
{ "do-forward-updates", "f", &server_universe, 45 },
|
||||
|
File diff suppressed because it is too large
Load Diff
313
dhcp-3.0.5-manpages.patch
Normal file
313
dhcp-3.0.5-manpages.patch
Normal file
@ -0,0 +1,313 @@
|
||||
--- dhcp-3.0.5/client/dhclient-script.8.manpages 2005-09-28 15:17:08.000000000 -0400
|
||||
+++ dhcp-3.0.5/client/dhclient-script.8 2007-03-29 14:55:09.000000000 -0400
|
||||
@@ -47,7 +47,7 @@
|
||||
exit hooks provided (see HOOKS for details). These hooks will allow the
|
||||
user to override the default behaviour of the client in creating a
|
||||
.B /etc/resolv.conf
|
||||
-file.
|
||||
+file, and to handle DHCP options not handled by default.
|
||||
.PP
|
||||
No standard client script exists for some operating systems, even though
|
||||
the actual client may work, so a pioneering user may well need to create
|
||||
@@ -91,6 +91,27 @@
|
||||
.B ETCDIR/dhclient-exit-hooks
|
||||
script can modify the valid of exit_status to change the exit status
|
||||
of dhclient-script.
|
||||
+.PP
|
||||
+Immediately after dhclient brings an interface UP with a new IP address,
|
||||
+subnet mask, and routes, in the REBOOT/BOUND states, it will check for the
|
||||
+existence of an executable
|
||||
+.B ETCDIR/dhclient-up-hooks
|
||||
+script, and source it if found. This script can handle DHCP options in
|
||||
+the environment that are not handled by default. A per-interface
|
||||
+.B ETCDIR/dhclient-up-${IF}-hooks
|
||||
+script will override the generic script and be sourced when interface
|
||||
+$IF has been brought up.
|
||||
+.PP
|
||||
+Immediately before dhclient brings an interface DOWN, removing its IP
|
||||
+address, subnet mask, and routes, in the STOP/RELEASE states, it will
|
||||
+check for the existence of an executable
|
||||
+.B ETCDIR/dhclient-down-hooks
|
||||
+script, and source it if found. This script can handle DHCP options in
|
||||
+the environment that are not handled by default. A per-interface
|
||||
+.B ETCDIR/dhclient-down-${IF}-hooks
|
||||
+script will override the generic script and be sourced when interface
|
||||
+$IF is about to be brought down.
|
||||
+
|
||||
.SH OPERATION
|
||||
When dhclient needs to invoke the client configuration script, it
|
||||
defines a set of variables in the environment, and then invokes
|
||||
--- dhcp-3.0.5/client/dhclient.conf.5.manpages 2005-06-16 15:40:13.000000000 -0400
|
||||
+++ dhcp-3.0.5/client/dhclient.conf.5 2007-03-29 14:55:21.000000000 -0400
|
||||
@@ -185,7 +185,8 @@
|
||||
options. Only the option names should be specified in the request
|
||||
statement - not option parameters. By default, the DHCP server
|
||||
requests the subnet-mask, broadcast-address, time-offset, routers,
|
||||
-domain-name, domain-name-servers and host-name options.
|
||||
+domain-name, domain-name-servers, host-name, nis-domain, nis-servers,
|
||||
+and ntp-servers options.
|
||||
.PP
|
||||
In some cases, it may be desirable to send no parameter request list
|
||||
at all. To do this, simply write the request statement but specify
|
||||
@@ -581,6 +582,18 @@
|
||||
Whenever the client tries to renew the lease, it will use that same
|
||||
media type. The lease must expire before the client will go back to
|
||||
cycling through media types.
|
||||
+.PP
|
||||
+ \fBbootp-broadcast-always;\fR
|
||||
+.PP
|
||||
+The
|
||||
+.B bootp-broadcast-always
|
||||
+statement instructs dhclient to always set the bootp broadcast flag in
|
||||
+request packets, so that servers will always broadcast replies.
|
||||
+This is equivalent to supplying the dhclient -B argument, and has
|
||||
+the same effect as specifying 'always-broadcast' in the server's dhcpd.conf.
|
||||
+This option is provided as a Red Hat extension to enable dhclient to work
|
||||
+on IBM zSeries z/OS Linux guests .
|
||||
+.PP
|
||||
.SH SAMPLE
|
||||
The following configuration file is used on a laptop running NetBSD
|
||||
1.3. The laptop has an IP alias of 192.5.5.213, and has one
|
||||
--- dhcp-3.0.5/client/dhclient.8.manpages 2007-03-29 14:54:16.000000000 -0400
|
||||
+++ dhcp-3.0.5/client/dhclient.8 2007-03-29 14:58:16.000000000 -0400
|
||||
@@ -85,6 +85,28 @@
|
||||
.B -x
|
||||
]
|
||||
[
|
||||
+.B -I
|
||||
+.I dhcp-client-identifier
|
||||
+]
|
||||
+[
|
||||
+.B -H
|
||||
+.I host-name
|
||||
+.R |
|
||||
+.B -F fqdn.fqdn
|
||||
+]
|
||||
+[
|
||||
+.B -V
|
||||
+.I vendor-class-identifier
|
||||
+]
|
||||
+[
|
||||
+.B -R
|
||||
+.I request option list
|
||||
+]
|
||||
+[
|
||||
+.B -T
|
||||
+.I timeout
|
||||
+]
|
||||
+[
|
||||
.I if0
|
||||
[
|
||||
.I ...ifN
|
||||
@@ -273,6 +295,107 @@
|
||||
-s dhclient-script environment, which would allow applications running
|
||||
in that environment to handle options they do not know about in advance -
|
||||
this is a Red Hat extension to support dhcdbd and NetworkManager.
|
||||
+.PP
|
||||
+The -I <id> argument allows you to specify the dhcp-client-identifier string, <id>,
|
||||
+to be sent to the dhcp server on the command line. It is equivalent to the
|
||||
+top level dhclient.conf statement:
|
||||
+.br
|
||||
+ \fBsend dhcp-client-identifier "<id>";\fR
|
||||
+.br
|
||||
+The -I <id> command line option will override any top level dhclient.conf
|
||||
+ 'send dhcp-client-identifier' statement, but more specific per-interface
|
||||
+ 'interface "X" { send dhcp-client-identifier...; }' statements in dhclient.conf
|
||||
+will override the -I <id> command line option for interface "X".
|
||||
+This option is provided as a Red Hat extension to enable dhclient to work
|
||||
+on IBM zSeries z/OS Linux guests.
|
||||
+.PP
|
||||
+The -B option instructs dhclient to set the bootp broadcast flag in request
|
||||
+packets, so that servers will always broadcast replies. This is equivalent
|
||||
+to specifying the 'bootp-broadcast-always' option in dhclient.conf, and has
|
||||
+the same effect as specifying 'always-broadcast' in the server's dhcpd.conf.
|
||||
+This option is provided as a Red Hat extension to enable dhclient to work
|
||||
+on IBM zSeries z/OS Linux guests.
|
||||
+.PP
|
||||
+The -H <host-name> option allows you to specify the DHCP host-name option
|
||||
+to send to the server on the dhclient command line. It is equivalent to the
|
||||
+top level dhclient.conf statement:
|
||||
+.br
|
||||
+\f send host-name "<host-name>";\fR
|
||||
+.br
|
||||
+The -H <host-name> option will override any top level dhclient.conf
|
||||
+ 'send host-name' statement, but more specific per-interface
|
||||
+ 'interface "X" { send host-name...;' statements in dhclient.conf
|
||||
+will override the -H <host-name> command line option for interface "X".
|
||||
+The host-name option only specifies the client's host name prefix, to which
|
||||
+the server will append the 'ddns-domainname' or 'domain-name' options, if any,
|
||||
+to derive the fully qualified domain name of the client host.
|
||||
+The -H <host-name> option cannot be used with the -F <fqdn.fqdn> option.
|
||||
+Only one -H <host-name> option may be specified.
|
||||
+The -H <host-name> option is provided as a Red Hat extension to simplify
|
||||
+configuration of clients of DHCP servers that require the host-name option
|
||||
+to be sent (eg. some modern cable modems), and for dynamic DNS updates (DDNS).
|
||||
+.PP
|
||||
+The -F <fqdn.fqdn> option allows you to specify the DHCP fqdn.fqdn option
|
||||
+to send to the server on the dhclient command line. It is equivalent to the
|
||||
+top level dhclient.conf statement:
|
||||
+.br
|
||||
+\f send fqdn.fqdn "<domain-name>";\fR
|
||||
+.br
|
||||
+The -F <fqdn.fqdn> option will override any top level dhclient.conf
|
||||
+ 'send fqdn.fqdn' statement, but more specific per-interface
|
||||
+ 'interface "X" { send fqdn.fqdn...;' statements in dhclient.conf
|
||||
+will override the -F <fqdn.fqdn> command line option for interface "X".
|
||||
+This option cannot be used with the -H <host-name> option.
|
||||
+The DHCP fqdn.fqdn option must specify the complete domain name of the client
|
||||
+host, which the server may use for dynamic DNS updates.
|
||||
+Only one -F <fqdn.fqdn> option may be specified.
|
||||
+The -F <fqdn.fqdn> option is provided as a Red Hat extension to simplify
|
||||
+configuration of DDNS.
|
||||
+.PP
|
||||
+The -T <timeout> option allows you to specify the time after which
|
||||
+the dhclient will decide that no DHCP servers can be contacted when
|
||||
+no responses have been received. It is equivalent to the
|
||||
+.br
|
||||
+\f timeout <integer>;\fR
|
||||
+.br
|
||||
+dhclient.conf statement, and will override any such statements in dhclient.conf.
|
||||
+.br
|
||||
+This option is provided as a Red Hat extension.
|
||||
+.PP
|
||||
+The -V <vendor-class-identifier> option allows you to specify the DHCP
|
||||
+vendor-class-identifier option to send to the server on the dhclient command line.
|
||||
+It is equivalent to the top level dhclient.conf statement:
|
||||
+.br
|
||||
+\f send vendor-class-identifier "<vendor-class-identifier>";\fR
|
||||
+.br
|
||||
+The -V <vendor-class-identifier> option will override any top level dhclient.conf
|
||||
+ 'send vendor-class-identifier' statement, but more specific per-interface
|
||||
+ 'interface "X" { send vendor-class-identifier...;' statements in dhclient.conf
|
||||
+will override the -V <vendor-class-identifier> command line option for interface "X".
|
||||
+The -V <vendor-class-identifier> option is provided as a Red Hat extension to simplify
|
||||
+configuration of clients of DHCP servers that require the vendor-class-identifier option
|
||||
+to be sent.
|
||||
+.PP
|
||||
+The -R <request option list> option allows you to specify the list of options the
|
||||
+client is to request from the server on the dhclient command line.
|
||||
+The option list must be a single string, consisting of option names separated
|
||||
+by at least one comma and optional space characters. The default option list
|
||||
+is :
|
||||
+.br
|
||||
+ subnet-mask, broadcast-address, time-offset, routers,
|
||||
+.br
|
||||
+ domain-name, domain-name-servers, host-name, nis-domain,
|
||||
+.br
|
||||
+ nis-servers, ntp-servers
|
||||
+.br
|
||||
+You can specify a different list of options to request with the -R <option list> argument.
|
||||
+This is equivalent to the dhclient.conf statement:
|
||||
+.br
|
||||
+\f request <option list> ;\fR
|
||||
+.br
|
||||
+The -R argument is provided as a Red Hat extension to ISC dhclient to facilitate requesting
|
||||
+a list of options from the server different to the default.
|
||||
+.PP
|
||||
.SH CONFIGURATION
|
||||
The syntax of the dhclient.conf(5) file is discussed separately.
|
||||
.SH OMAPI
|
||||
--- dhcp-3.0.5/common/dhcp-options.5.manpages 2006-04-26 11:12:43.000000000 -0400
|
||||
+++ dhcp-3.0.5/common/dhcp-options.5 2007-03-29 14:58:42.000000000 -0400
|
||||
@@ -834,6 +834,24 @@
|
||||
classless IP routing is now the most widely deployed routing standard,
|
||||
this option is virtually useless, and is not implemented by any of the
|
||||
popular DHCP clients, for example the Microsoft DHCP client.
|
||||
+.PP
|
||||
+NOTE to Red Hat dhclient users:
|
||||
+.br
|
||||
+The RedHat dhclient-script interprets trailing 0 octets of the target
|
||||
+as indicating the subnet class of the route - so for this
|
||||
+static-routes value:
|
||||
+.br
|
||||
+ option static-routes 172.0.0.0 172.16.2.254,
|
||||
+.br
|
||||
+ 192.168.0.0 192.168.2.254;
|
||||
+.br
|
||||
+the Red Hat dhclient-script will create routes:
|
||||
+.br
|
||||
+ 172/8 via 172.16.2.254 dev $interface
|
||||
+.br
|
||||
+ 192.168/16 via 192.168.2.254 dev $interface
|
||||
+.br
|
||||
+which slightly increases the usefulness of the static-routes option.
|
||||
.RE
|
||||
.PP
|
||||
.nf
|
||||
--- dhcp-3.0.5/dhcpctl/dhcpctl.3.manpages 2004-09-24 17:08:38.000000000 -0400
|
||||
+++ dhcp-3.0.5/dhcpctl/dhcpctl.3 2007-03-29 14:59:16.000000000 -0400
|
||||
@@ -43,7 +43,8 @@
|
||||
.\"
|
||||
.\"
|
||||
.Sh SYNOPSIS
|
||||
-.Fd #include <dhcpctl/dhcpctl.h>
|
||||
+.Fd #include <dhcpctl.h>
|
||||
+.sp
|
||||
.Ft dhcpctl_status
|
||||
.Fo dhcpctl_initialize
|
||||
.Fa void
|
||||
@@ -426,7 +427,7 @@
|
||||
#include <netinet/in.h>
|
||||
|
||||
#include <isc/result.h>
|
||||
-#include <dhcpctl/dhcpctl.h>
|
||||
+#include <dhcpctl.h>
|
||||
|
||||
int main (int argc, char **argv) {
|
||||
dhcpctl_data_string ipaddrstring = NULL;
|
||||
--- dhcp-3.0.5/server/dhcpd.conf.5.manpages 2006-07-09 11:02:24.000000000 -0400
|
||||
+++ dhcp-3.0.5/server/dhcpd.conf.5 2007-03-29 14:58:59.000000000 -0400
|
||||
@@ -531,9 +531,9 @@
|
||||
failover peer "foo" {
|
||||
primary;
|
||||
address anthrax.rc.vix.com;
|
||||
- port 519;
|
||||
+ port 647;
|
||||
peer address trantor.rc.vix.com;
|
||||
- peer port 520;
|
||||
+ peer port 847;
|
||||
max-response-delay 60;
|
||||
max-unacked-updates 10;
|
||||
mclt 3600;
|
||||
@@ -592,9 +592,7 @@
|
||||
.B port \fIport-number\fR\fB;\fR
|
||||
.PP
|
||||
The \fBport\fR statement declares the TCP port on which the server
|
||||
-should listen for connections from its failover peer. This statement
|
||||
-may not currently be omitted, because the failover protocol does not
|
||||
-yet have a reserved TCP port number.
|
||||
+should listen for connections from its failover peer.
|
||||
.RE
|
||||
.PP
|
||||
The
|
||||
@@ -606,10 +604,8 @@
|
||||
.PP
|
||||
The \fBpeer port\fR statement declares the TCP port to which the
|
||||
server should connect to reach its failover peer for failover
|
||||
-messages. This statement may not be omitted because the failover
|
||||
-protocol does not yet have a reserved TCP port number. The port
|
||||
-number declared in the \fBpeer port\fR statement may be the same as
|
||||
-the port number declared in the \fBport\fR statement.
|
||||
+messages. The port number declared in the \fBpeer port\fR statement
|
||||
+may be the same as the port number declared in the \fBport\fR statement.
|
||||
.RE
|
||||
.PP
|
||||
The
|
||||
@@ -1133,7 +1129,7 @@
|
||||
.PP
|
||||
.nf
|
||||
key DHCP_UPDATER {
|
||||
- algorithm HMAC-MD5.SIG-ALG.REG.INT;
|
||||
+ algorithm hmac-md5;
|
||||
secret pRP5FapFoJ95JEL06sv4PQ==;
|
||||
};
|
||||
|
||||
@@ -1156,7 +1152,7 @@
|
||||
.PP
|
||||
.nf
|
||||
key DHCP_UPDATER {
|
||||
- algorithm HMAC-MD5.SIG-ALG.REG.INT;
|
||||
+ algorithm hmac-md5;
|
||||
secret pRP5FapFoJ95JEL06sv4PQ==;
|
||||
};
|
||||
|
52
dhcp-3.0.5-memory.patch
Normal file
52
dhcp-3.0.5-memory.patch
Normal file
@ -0,0 +1,52 @@
|
||||
--- dhcp-3.0.5/common/packet.c.memory 2005-03-03 11:55:23.000000000 -0500
|
||||
+++ dhcp-3.0.5/common/packet.c 2007-03-30 17:11:06.000000000 -0400
|
||||
@@ -140,6 +140,7 @@
|
||||
struct ip ip;
|
||||
struct udphdr udp;
|
||||
|
||||
+ memset( &ip, '\0', sizeof ip);
|
||||
/* Fill out the IP header */
|
||||
IP_V_SET (&ip, 4);
|
||||
IP_HL_SET (&ip, 20);
|
||||
@@ -219,7 +220,7 @@
|
||||
{
|
||||
unsigned char *data;
|
||||
struct ip ip;
|
||||
- struct udphdr *udp;
|
||||
+ struct udphdr udph, *udp=&udph;
|
||||
u_int32_t ip_len = (buf [bufix] & 0xf) << 2;
|
||||
u_int32_t sum, usum;
|
||||
static int ip_packets_seen;
|
||||
@@ -233,7 +234,7 @@
|
||||
int ignore = 0;
|
||||
|
||||
memcpy(&ip, buf + bufix, sizeof (struct ip));
|
||||
- udp = (struct udphdr *)(buf + bufix + ip_len);
|
||||
+ memcpy(udp, buf + bufix + ip_len, sizeof(struct udphdr));
|
||||
|
||||
#ifdef USERLAND_FILTER
|
||||
/* Is it a UDP packet? */
|
||||
--- dhcp-3.0.5/common/lpf.c.memory 2007-03-30 17:11:06.000000000 -0400
|
||||
+++ dhcp-3.0.5/common/lpf.c 2007-03-30 17:11:55.000000000 -0400
|
||||
@@ -246,6 +246,7 @@
|
||||
struct interface_info *info;
|
||||
{
|
||||
struct sock_fprog p;
|
||||
+ memset(&p,'\0', sizeof(struct sock_fprog));
|
||||
|
||||
/* Set up the bpf filter program structure. This is defined in
|
||||
bpf.c */
|
||||
--- dhcp-3.0.5/minires/ns_name.c.memory 2004-06-10 13:59:40.000000000 -0400
|
||||
+++ dhcp-3.0.5/minires/ns_name.c 2007-03-30 17:11:06.000000000 -0400
|
||||
@@ -71,6 +71,11 @@
|
||||
dn = dst;
|
||||
eom = dst + dstsiz;
|
||||
|
||||
+ if (dn >= eom) {
|
||||
+ errno = EMSGSIZE;
|
||||
+ return (-1);
|
||||
+ }
|
||||
+
|
||||
while ((n = *cp++) != 0) {
|
||||
if ((n & NS_CMPRSFLGS) != 0) {
|
||||
/* Some kind of compression pointer. */
|
400
dhcp-3.0.5-options.patch
Normal file
400
dhcp-3.0.5-options.patch
Normal file
@ -0,0 +1,400 @@
|
||||
--- dhcp-3.0.5/client/dhclient.c.options 2007-03-29 16:33:14.000000000 -0400
|
||||
+++ dhcp-3.0.5/client/dhclient.c 2007-03-30 15:15:59.000000000 -0400
|
||||
@@ -38,6 +38,12 @@
|
||||
#include "dhcpd.h"
|
||||
#include "version.h"
|
||||
|
||||
+/*
|
||||
+ * Defined in stdio.h when _GNU_SOURCE is set, but we don't want to define
|
||||
+ * that when building ISC code.
|
||||
+ */
|
||||
+extern int asprintf(char **strp, const char *fmt, ...);
|
||||
+
|
||||
TIME default_lease_time = 43200; /* 12 hours... */
|
||||
TIME max_lease_time = 86400; /* 24 hours... */
|
||||
|
||||
@@ -77,6 +83,9 @@
|
||||
#ifdef EXTENDED_NEW_OPTION_INFO
|
||||
int extended_option_environment = 0;
|
||||
#endif
|
||||
+int bootp_broadcast_always = 0;
|
||||
+
|
||||
+extern u_int32_t default_requested_options[];
|
||||
|
||||
static void usage PROTO ((void));
|
||||
|
||||
@@ -103,6 +112,15 @@
|
||||
int no_dhclient_pid = 0;
|
||||
int no_dhclient_script = 0;
|
||||
char *s;
|
||||
+ char *dhcp_client_identifier_arg = NULL;
|
||||
+ char *dhcp_host_name_arg = NULL;
|
||||
+ char *dhcp_fqdn_arg = NULL;
|
||||
+ char *dhcp_vendor_class_identifier_arg = NULL;
|
||||
+ char *dhclient_request_options = NULL;
|
||||
+
|
||||
+ int timeout_arg = 0;
|
||||
+ char *arg_conf = NULL;
|
||||
+ int arg_conf_len = 0;
|
||||
|
||||
/* Make sure we have stdin, stdout and stderr. */
|
||||
i = open ("/dev/null", O_RDWR);
|
||||
@@ -211,6 +229,88 @@
|
||||
extended_option_environment = 1;
|
||||
new_option_info_tree = GENERATE_NEW_OPTION_INFO;
|
||||
#endif
|
||||
+ } else if (!strcmp (argv [i], "-I")) {
|
||||
+ if ((++i == argc) || (argv[i] == NULL) || (*(argv[i])=='\0')) {
|
||||
+ usage ();
|
||||
+ return EXIT_FAILURE;
|
||||
+ }
|
||||
+
|
||||
+ if (strlen(argv[i]) >= DHCP_OPTION_LEN) {
|
||||
+ log_error("-I option dhcp-client-identifier string \"%s\" is too long - maximum length is: %d", argv[i], DHCP_OPTION_LEN-1);
|
||||
+ exit(1);
|
||||
+ }
|
||||
+
|
||||
+ dhcp_client_identifier_arg = argv[i];
|
||||
+ } else if (!strcmp (argv [i], "-B")) {
|
||||
+ bootp_broadcast_always = 1;
|
||||
+ } else if (!strcmp (argv [i], "-H")) {
|
||||
+ if ((++i == argc) || (argv[i] == NULL) || (*(argv[i])=='\0')) {
|
||||
+ usage ();
|
||||
+ return EXIT_FAILURE;
|
||||
+ }
|
||||
+
|
||||
+ if (strlen(argv[i]) >= DHCP_OPTION_LEN) {
|
||||
+ log_error("-H option host-name string \"%s\" is too long - maximum length is: %d", argv[i], DHCP_OPTION_LEN-1);
|
||||
+ exit(1);
|
||||
+ }
|
||||
+
|
||||
+ if (dhcp_host_name_arg != NULL) {
|
||||
+ log_error("The -H <host-name> and -F <fqdn> arguments are mutually exclusive");
|
||||
+ exit(1);
|
||||
+ }
|
||||
+
|
||||
+ dhcp_host_name_arg = argv[i];
|
||||
+ } else if (!strcmp (argv [i], "-F")) {
|
||||
+ if ((++i == argc) || (argv[i] == NULL) || (*(argv[i])=='\0')) {
|
||||
+ usage ();
|
||||
+ return EXIT_FAILURE;
|
||||
+ }
|
||||
+
|
||||
+ if (strlen(argv[i]) >= DHCP_OPTION_LEN) {
|
||||
+ log_error("-F option fqdn.fqdn string \"%s\" is too long - maximum length is: %d", argv[i], DHCP_OPTION_LEN-1);
|
||||
+ exit(1);
|
||||
+ }
|
||||
+
|
||||
+ if (dhcp_fqdn_arg != NULL) {
|
||||
+ log_error("Only one -F <fqdn> argument can be specified");
|
||||
+ exit(1);
|
||||
+ }
|
||||
+
|
||||
+ if (dhcp_host_name_arg != NULL) {
|
||||
+ log_error("The -F <fqdn> and -H <host-name> arguments are mutually exclusive");
|
||||
+ exit(1);
|
||||
+ }
|
||||
+
|
||||
+ dhcp_fqdn_arg = argv[i];
|
||||
+ } else if (!strcmp (argv [i], "-T")) {
|
||||
+ if ((++i == argc) || (argv[i] == NULL) || (*(argv[i])=='\0')) {
|
||||
+ usage ();
|
||||
+ return EXIT_FAILURE;
|
||||
+ }
|
||||
+
|
||||
+ if ((timeout_arg = atoi(argv[i])) <= 0) {
|
||||
+ log_error("-T timeout option must be > 0 - bad value: %s",argv[i]);
|
||||
+ exit(1);
|
||||
+ }
|
||||
+ } else if (!strcmp (argv [i], "-V")) {
|
||||
+ if ((++i == argc) || (argv[i] == NULL) || (*(argv[i])=='\0')) {
|
||||
+ usage ();
|
||||
+ return EXIT_FAILURE;
|
||||
+ }
|
||||
+
|
||||
+ if (strlen(argv[i]) >= DHCP_OPTION_LEN) {
|
||||
+ log_error("-V option vendor-class-identifier string \"%s\" is too long - maximum length is: %d", argv[i], DHCP_OPTION_LEN-1);
|
||||
+ exit(1);
|
||||
+ }
|
||||
+
|
||||
+ dhcp_vendor_class_identifier_arg = argv[i];
|
||||
+ } else if (!strcmp (argv [i], "-R")) {
|
||||
+ if ((++i == argc) || (argv[i] == NULL) || (*(argv[i])=='\0')) {
|
||||
+ usage ();
|
||||
+ return EXIT_FAILURE;
|
||||
+ }
|
||||
+
|
||||
+ dhclient_request_options=argv[i];
|
||||
} else if (argv [i][0] == '-') {
|
||||
usage ();
|
||||
} else {
|
||||
@@ -347,6 +447,170 @@
|
||||
/* Parse the dhclient.conf file. */
|
||||
read_client_conf ();
|
||||
|
||||
+ /* Parse any extra command line configuration arguments: */
|
||||
+ if ((dhcp_client_identifier_arg != NULL) && (*dhcp_client_identifier_arg != '\0')) {
|
||||
+ arg_conf_len = asprintf(&arg_conf, "send dhcp-client-identifier \"%s\";", dhcp_client_identifier_arg);
|
||||
+
|
||||
+ if ((arg_conf == 0) || (arg_conf_len <= 0))
|
||||
+ log_fatal("Unable to send -I option dhcp-client-identifier");
|
||||
+ }
|
||||
+
|
||||
+ if ((dhcp_host_name_arg != NULL) && (*dhcp_host_name_arg != '\0')) {
|
||||
+ if (arg_conf == 0) {
|
||||
+ arg_conf_len = asprintf(&arg_conf, "send host-name \"%s\";", dhcp_host_name_arg);
|
||||
+
|
||||
+ if ((arg_conf == 0) || (arg_conf_len <= 0))
|
||||
+ log_fatal("Unable to send -H option host-name");
|
||||
+ } else {
|
||||
+ char *last_arg_conf = arg_conf;
|
||||
+ arg_conf = NULL;
|
||||
+ arg_conf_len = asprintf( &arg_conf, "%s\nsend host-name \"%s\";", last_arg_conf, dhcp_host_name_arg);
|
||||
+
|
||||
+ if ((arg_conf == 0) || (arg_conf_len <= 0))
|
||||
+ log_fatal("Unable to send -H option host-name");
|
||||
+
|
||||
+ free(last_arg_conf);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if ((dhcp_fqdn_arg != NULL) && (*dhcp_fqdn_arg != '\0')) {
|
||||
+ if (arg_conf == 0) {
|
||||
+ arg_conf_len = asprintf(&arg_conf, "send fqdn.fqdn \"%s\";", dhcp_fqdn_arg);
|
||||
+
|
||||
+ if ((arg_conf == 0) || (arg_conf_len <= 0))
|
||||
+ log_fatal("Unable to send -F option fqdn.fqdn");
|
||||
+ } else {
|
||||
+ char *last_arg_conf = arg_conf;
|
||||
+ arg_conf = NULL;
|
||||
+ arg_conf_len = asprintf( &arg_conf, "%s\nsend fqdn.fqdn \"%s\";", last_arg_conf, dhcp_fqdn_arg);
|
||||
+
|
||||
+ if ((arg_conf == 0) || (arg_conf_len <= 0))
|
||||
+ log_fatal("Unable to send -F option fqdn.fqdn");
|
||||
+
|
||||
+ free(last_arg_conf);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (timeout_arg) {
|
||||
+ if( arg_conf == 0 )
|
||||
+ {
|
||||
+ arg_conf_len = asprintf(&arg_conf, "timeout %d;", timeout_arg);
|
||||
+
|
||||
+ if ((arg_conf == 0) || (arg_conf_len <= 0))
|
||||
+ log_fatal("Unable to process -T timeout argument");
|
||||
+ } else {
|
||||
+ char *last_arg_conf = arg_conf;
|
||||
+ arg_conf = NULL;
|
||||
+ arg_conf_len = asprintf( &arg_conf, "%s\ntimeout %d;", last_arg_conf, timeout_arg);
|
||||
+
|
||||
+ if ((arg_conf == 0) || (arg_conf_len == 0))
|
||||
+ log_fatal("Unable to process -T timeout argument");
|
||||
+
|
||||
+ free(last_arg_conf);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if ((dhcp_vendor_class_identifier_arg != NULL) && (*dhcp_vendor_class_identifier_arg != '\0')) {
|
||||
+ if (arg_conf == 0) {
|
||||
+ arg_conf_len = asprintf(&arg_conf, "send vendor-class-identifier \"%s\";", dhcp_vendor_class_identifier_arg);
|
||||
+
|
||||
+ if ((arg_conf == 0) || (arg_conf_len <= 0))
|
||||
+ log_fatal("Unable to send -V option vendor-class-identifier");
|
||||
+ } else {
|
||||
+ char *last_arg_conf = arg_conf;
|
||||
+ arg_conf = NULL;
|
||||
+ arg_conf_len = asprintf(&arg_conf, "%s\nsend vendor-class-identifier \"%s\";", last_arg_conf, dhcp_vendor_class_identifier_arg);
|
||||
+
|
||||
+ if ((arg_conf == 0) || (arg_conf_len <= 0))
|
||||
+ log_fatal("Unable to send -V option vendor-class-identifier");
|
||||
+
|
||||
+ free(last_arg_conf);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (dhclient_request_options != NULL) {
|
||||
+ if (arg_conf == 0) {
|
||||
+ arg_conf_len = asprintf(&arg_conf, "request %s;", dhclient_request_options);
|
||||
+
|
||||
+ if ((arg_conf == 0) || (arg_conf_len <= 0))
|
||||
+ log_fatal("Unable to parse -R <request options list> argument");
|
||||
+ } else {
|
||||
+ char *last_arg_conf = arg_conf;
|
||||
+ arg_conf = NULL;
|
||||
+ arg_conf_len = asprintf(&arg_conf, "%s\nrequest %s;", last_arg_conf, dhclient_request_options);
|
||||
+
|
||||
+ if ((arg_conf == 0) || (arg_conf_len <= 0))
|
||||
+ log_fatal("Unable to parse -R <request options list> argument");
|
||||
+
|
||||
+ free(last_arg_conf);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (arg_conf) {
|
||||
+ if( arg_conf_len == 0 )
|
||||
+ if( (arg_conf_len = strlen(arg_conf)) == 0 )
|
||||
+ /* huh ? cannot happen ! */
|
||||
+ log_fatal("Unable to process -I/-H/-F/-T/-V/-R configuration arguments");
|
||||
+
|
||||
+ /* parse the extra dhclient.conf configuration arguments
|
||||
+ * into top level config: */
|
||||
+ struct parse *cfile = (struct parse *)0;
|
||||
+ const char *val = NULL;
|
||||
+ int token;
|
||||
+
|
||||
+ status = new_parse (&cfile, -1, arg_conf, arg_conf_len, "extra dhclient -I/-H/-F/-T/-V/-R configuration arguments", 0);
|
||||
+
|
||||
+ if ((status != ISC_R_SUCCESS) || (cfile -> warnings_occurred))
|
||||
+ log_fatal("Cannot parse -I/-H/-F/-T/-V/-R configuration arguments !");
|
||||
+ /* more detailed parse failures will be logged */
|
||||
+
|
||||
+ do {
|
||||
+ token = peek_token (&val, (unsigned *)0, cfile);
|
||||
+ if (token == END_OF_FILE)
|
||||
+ break;
|
||||
+
|
||||
+ parse_client_statement (cfile, (struct interface_info *)0, &top_level_config);
|
||||
+
|
||||
+
|
||||
+ } while (1);
|
||||
+
|
||||
+ if (cfile -> warnings_occurred)
|
||||
+ log_fatal ("Cannot parse -I/-H/-F/-T/-V/-R configuration arguments !");
|
||||
+ end_parse (&cfile);
|
||||
+
|
||||
+ if (timeout_arg) {
|
||||
+ /* we just set the toplevel timeout, but per-client
|
||||
+ * timeouts may still be at defaults. Also, it makes no
|
||||
+ * sense having the reboot_timeout or backoff_cutoff
|
||||
+ * greater than the timeout:
|
||||
+ */
|
||||
+ if ((top_level_config.backoff_cutoff == 15) && (top_level_config.backoff_cutoff > (timeout_arg / 2)))
|
||||
+ top_level_config.backoff_cutoff = (((unsigned long)(timeout_arg / 2)) == 0) ? timeout_arg : (unsigned long)(timeout_arg / 2);
|
||||
+
|
||||
+ for (ip = interfaces; ip; ip = ip -> next) {
|
||||
+ if (ip->client->config->timeout == 60)
|
||||
+ ip->client->config->timeout = timeout_arg;
|
||||
+
|
||||
+ if ((ip->client->config->reboot_timeout == 10) && (ip->client->config->reboot_timeout > ip->client->config->timeout))
|
||||
+ ip->client->config->reboot_timeout = ip->client->config->timeout;
|
||||
+
|
||||
+ if ((ip->client->config->backoff_cutoff == 15) && (ip->client->config->backoff_cutoff > top_level_config.backoff_cutoff))
|
||||
+ ip->client->config->backoff_cutoff = top_level_config.backoff_cutoff;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if ((dhclient_request_options != 0) && (top_level_config.requested_options != default_requested_options)) {
|
||||
+ for (ip = interfaces; ip; ip = ip -> next) {
|
||||
+ if (ip->client->config->requested_options == default_requested_options)
|
||||
+ ip->client->config->requested_options = top_level_config.requested_options;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ free(arg_conf);
|
||||
+ arg_conf = NULL;
|
||||
+ arg_conf_len = 0;
|
||||
+ }
|
||||
+
|
||||
/* Parse the lease database. */
|
||||
read_client_leases ();
|
||||
|
||||
@@ -1924,7 +2188,8 @@
|
||||
client -> packet.xid = random ();
|
||||
client -> packet.secs = 0; /* filled in by send_discover. */
|
||||
|
||||
- if (can_receive_unicast_unconfigured (client -> interface))
|
||||
+ if ((!(bootp_broadcast_always || client->config->bootp_broadcast_always))
|
||||
+ && can_receive_unicast_unconfigured(client->interface))
|
||||
client -> packet.flags = 0;
|
||||
else
|
||||
client -> packet.flags = htons (BOOTP_BROADCAST);
|
||||
@@ -2008,7 +2273,9 @@
|
||||
} else {
|
||||
memset (&client -> packet.ciaddr, 0,
|
||||
sizeof client -> packet.ciaddr);
|
||||
- if (can_receive_unicast_unconfigured (client -> interface))
|
||||
+ if ((!(bootp_broadcast_always ||
|
||||
+ client ->config->bootp_broadcast_always)) &&
|
||||
+ can_receive_unicast_unconfigured (client -> interface))
|
||||
client -> packet.flags = 0;
|
||||
else
|
||||
client -> packet.flags = htons (BOOTP_BROADCAST);
|
||||
@@ -2067,7 +2334,8 @@
|
||||
client -> packet.hops = 0;
|
||||
client -> packet.xid = client -> xid;
|
||||
client -> packet.secs = 0; /* Filled in by send_request. */
|
||||
- if (can_receive_unicast_unconfigured (client -> interface))
|
||||
+ if ((!(bootp_broadcast_always || client->config-> bootp_broadcast_always))
|
||||
+ && can_receive_unicast_unconfigured (client->interface))
|
||||
client -> packet.flags = 0;
|
||||
else
|
||||
client -> packet.flags = htons (BOOTP_BROADCAST);
|
||||
--- dhcp-3.0.5/client/clparse.c.options 2007-03-29 16:33:14.000000000 -0400
|
||||
+++ dhcp-3.0.5/client/clparse.c 2007-03-29 16:33:29.000000000 -0400
|
||||
@@ -81,6 +81,7 @@
|
||||
top_level_config.requested_options = default_requested_options;
|
||||
top_level_config.omapi_port = -1;
|
||||
top_level_config.do_forward_update = 1;
|
||||
+ top_level_config.bootp_broadcast_always = 0;
|
||||
|
||||
group_allocate (&top_level_config.on_receipt, MDL);
|
||||
if (!top_level_config.on_receipt)
|
||||
@@ -227,7 +228,8 @@
|
||||
interface-declaration |
|
||||
LEASE client-lease-statement |
|
||||
ALIAS client-lease-statement |
|
||||
- KEY key-definition */
|
||||
+ KEY key-definition |
|
||||
+ BOOTP_BROADCAST_ALWAYS */
|
||||
|
||||
void parse_client_statement (cfile, ip, config)
|
||||
struct parse *cfile;
|
||||
@@ -549,6 +551,12 @@
|
||||
parse_reject_statement (cfile, config);
|
||||
return;
|
||||
|
||||
+ case BOOTP_BROADCAST_ALWAYS:
|
||||
+ token = next_token(&val, (unsigned*)0, cfile);
|
||||
+ config -> bootp_broadcast_always = 1;
|
||||
+ parse_semi (cfile);
|
||||
+ return;
|
||||
+
|
||||
default:
|
||||
lose = 0;
|
||||
stmt = (struct executable_statement *)0;
|
||||
--- dhcp-3.0.5/common/conflex.c.options 2007-03-29 16:33:14.000000000 -0400
|
||||
+++ dhcp-3.0.5/common/conflex.c 2007-03-29 16:33:29.000000000 -0400
|
||||
@@ -599,6 +599,8 @@
|
||||
return BALANCE;
|
||||
if (!strcasecmp (atom + 1, "ound"))
|
||||
return BOUND;
|
||||
+ if (!strcasecmp (atom + 1, "ootp-broadcast-always"))
|
||||
+ return BOOTP_BROADCAST_ALWAYS;
|
||||
break;
|
||||
case 'c':
|
||||
if (!strcasecmp (atom + 1, "ase"))
|
||||
--- dhcp-3.0.5/includes/dhcpd.h.options 2007-03-29 16:33:14.000000000 -0400
|
||||
+++ dhcp-3.0.5/includes/dhcpd.h 2007-03-30 15:14:56.000000000 -0400
|
||||
@@ -767,6 +767,9 @@
|
||||
int do_forward_update; /* If nonzero, and if we have the
|
||||
information we need, update the
|
||||
A record for the address we get. */
|
||||
+
|
||||
+ int bootp_broadcast_always; /* If nonzero, always set the BOOTP_BROADCAST
|
||||
+ flag in requests */
|
||||
};
|
||||
|
||||
/* Per-interface state used in the dhcp client... */
|
||||
--- dhcp-3.0.5/includes/dhctoken.h.options 2005-09-22 12:19:57.000000000 -0400
|
||||
+++ dhcp-3.0.5/includes/dhctoken.h 2007-03-29 16:33:29.000000000 -0400
|
||||
@@ -309,7 +309,8 @@
|
||||
DOMAIN_NAME = 613,
|
||||
DO_FORWARD_UPDATE = 614,
|
||||
KNOWN_CLIENTS = 615,
|
||||
- ATSFP = 616
|
||||
+ ATSFP = 616,
|
||||
+ BOOTP_BROADCAST_ALWAYS = 616
|
||||
};
|
||||
|
||||
#define is_identifier(x) ((x) >= FIRST_TOKEN && \
|
73
dhcp-3.0.5-prototypes.patch
Normal file
73
dhcp-3.0.5-prototypes.patch
Normal file
@ -0,0 +1,73 @@
|
||||
--- dhcp-3.0.5/dst/dst_api.c.prototypes 2007-04-01 16:29:10.000000000 -0400
|
||||
+++ dhcp-3.0.5/dst/dst_api.c 2007-04-01 16:29:10.000000000 -0400
|
||||
@@ -58,6 +58,10 @@
|
||||
|
||||
#include "dst_internal.h"
|
||||
|
||||
+/* prototypes */
|
||||
+extern int b64_pton(char const *src, u_char *target, size_t targsize);
|
||||
+extern int b64_ntop(u_char const *src, size_t srclength, char *target, size_t targsize);
|
||||
+
|
||||
/* static variables */
|
||||
static int done_init = 0;
|
||||
dst_func *dst_t_func[DST_MAX_ALGS];
|
||||
--- dhcp-3.0.5/dst/dst_support.c.prototypes 2001-02-22 02:22:08.000000000 -0500
|
||||
+++ dhcp-3.0.5/dst/dst_support.c 2007-04-01 16:29:10.000000000 -0400
|
||||
@@ -32,6 +32,10 @@
|
||||
|
||||
#include "dst_internal.h"
|
||||
|
||||
+/* prototypes */
|
||||
+extern int b64_pton(char const *src, u_char *target, size_t targsize);
|
||||
+extern int b64_ntop(u_char const *src, size_t srclength, char *target, size_t targsize);
|
||||
+
|
||||
/*
|
||||
* dst_s_conv_bignum_u8_to_b64
|
||||
* This function converts binary data stored as a u_char[] to a
|
||||
--- dhcp-3.0.5/includes/minires/minires.h.prototypes 2004-06-10 13:59:37.000000000 -0400
|
||||
+++ dhcp-3.0.5/includes/minires/minires.h 2007-04-01 16:29:10.000000000 -0400
|
||||
@@ -65,7 +65,6 @@
|
||||
#define res_protocolname MRres_protocolname
|
||||
#define res_servicename MRres_servicename
|
||||
#define ns_datetosecs MRns_datetosecs
|
||||
-#define b64_pton MRb64_pton
|
||||
#define res_ninit minires_ninit
|
||||
#define res_randomid MRres_randomid
|
||||
#define res_findzonecut MRres_findzonecut
|
||||
--- dhcp-3.0.5/minires/res_mkupdate.c.prototypes 2007-04-01 16:29:10.000000000 -0400
|
||||
+++ dhcp-3.0.5/minires/res_mkupdate.c 2007-04-01 16:30:12.000000000 -0400
|
||||
@@ -49,6 +49,10 @@
|
||||
#include "minires/minires.h"
|
||||
#include "arpa/nameser.h"
|
||||
|
||||
+/* prototypes */
|
||||
+extern int b64_pton(char const *src, u_char *target, size_t targsize);
|
||||
+int dn_comp(const char *src, u_char *dst, unsigned dstsiz, u_char **dnptrs, u_char **lastdnptr);
|
||||
+
|
||||
/* Options. Leave them on. */
|
||||
#define DEBUG
|
||||
#define MAXPORT 1024
|
||||
--- dhcp-3.0.5/minires/res_comp.c.prototypes 2004-06-10 13:59:42.000000000 -0400
|
||||
+++ dhcp-3.0.5/minires/res_comp.c 2007-04-01 16:31:02.000000000 -0400
|
||||
@@ -91,6 +91,11 @@
|
||||
#include "minires/minires.h"
|
||||
#include "arpa/nameser.h"
|
||||
|
||||
+/* prototypes */
|
||||
+int ns_name_uncompress(const u_char *msg, const u_char *eom, const u_char *src, char *dst, size_t dstsiz);
|
||||
+int ns_name_compress(const char *src, u_char *dst, size_t dstsiz, const u_char **dnptrs, const u_char **lastdnptr);
|
||||
+int ns_name_skip(const u_char **ptrptr, const u_char *eom);
|
||||
+
|
||||
/*
|
||||
* Expand compressed domain name 'comp_dn' to full domain name.
|
||||
* 'msg' is a pointer to the begining of the message,
|
||||
--- dhcp-3.0.5/minires/res_init.c.prototypes 2004-06-10 13:59:43.000000000 -0400
|
||||
+++ dhcp-3.0.5/minires/res_init.c 2007-04-01 16:31:38.000000000 -0400
|
||||
@@ -102,6 +102,7 @@
|
||||
#define DEBUG
|
||||
|
||||
static void res_setoptions (res_state, const char *, const char *);
|
||||
+u_int res_randomid(void);
|
||||
|
||||
#ifdef RESOLVSORT
|
||||
static const char sort_mask[] = "/&";
|
84
dhcp-3.0.5-release-by-ifup.patch
Normal file
84
dhcp-3.0.5-release-by-ifup.patch
Normal file
@ -0,0 +1,84 @@
|
||||
--- dhcp-3.0.5/client/dhclient.c.release 2007-03-30 15:30:14.000000000 -0400
|
||||
+++ dhcp-3.0.5/client/dhclient.c 2007-03-30 15:29:58.000000000 -0400
|
||||
@@ -366,9 +366,81 @@
|
||||
}
|
||||
}
|
||||
fclose(pidfd);
|
||||
+ } else {
|
||||
+ /* handle release for interfaces requested with Red Hat
|
||||
+ * /sbin/ifup - pidfile will be /var/run/dhclient-$interface.pid
|
||||
+ */
|
||||
+
|
||||
+ if ((path_dhclient_pid == NULL) || (*path_dhclient_pid == '\0'))
|
||||
+ path_dhclient_pid = "/var/run/dhclient.pid";
|
||||
+
|
||||
+ char *new_path_dhclient_pid;
|
||||
+ struct interface_info *ip;
|
||||
+ int pdp_len = strlen(path_dhclient_pid), pfx, dpfx;
|
||||
+
|
||||
+ /* find append point: beginning of any trailing '.pid'
|
||||
+ * or '-$IF.pid' */
|
||||
+ for (pfx=pdp_len; (pfx >= 0) && (path_dhclient_pid[pfx] != '.') && (path_dhclient_pid[pfx] != '/'); pfx--);
|
||||
+ if (pfx == -1)
|
||||
+ pfx = pdp_len;
|
||||
+
|
||||
+ if (path_dhclient_pid[pfx] == '/')
|
||||
+ pfx += 1;
|
||||
+
|
||||
+ for (dpfx=pfx; (dpfx >= 0) && (path_dhclient_pid[dpfx] != '-') && (path_dhclient_pid[dpfx] != '/'); dpfx--);
|
||||
+ if ((dpfx > -1) && (path_dhclient_pid[dpfx] != '/'))
|
||||
+ pfx = dpfx;
|
||||
+
|
||||
+ for (ip = interfaces; ip; ip = ip->next) {
|
||||
+ if (interfaces_requested && (ip->flags & (INTERFACE_REQUESTED)) && (ip->name != NULL)) {
|
||||
+ int n_len = strlen(ip->name);
|
||||
+
|
||||
+ new_path_dhclient_pid = (char*) malloc(pfx + n_len + 6);
|
||||
+ strncpy(new_path_dhclient_pid, path_dhclient_pid, pfx);
|
||||
+ sprintf(new_path_dhclient_pid + pfx, "-%s.pid", ip->name);
|
||||
+
|
||||
+ if ((pidfd = fopen(new_path_dhclient_pid, "r")) != NULL) {
|
||||
+ e = fscanf(pidfd, "%ld\n", &temp);
|
||||
+ oldpid = (pid_t)temp;
|
||||
+
|
||||
+ if (e != 0 && e != EOF) {
|
||||
+ if (oldpid) {
|
||||
+ if (kill(oldpid, SIGTERM) == 0)
|
||||
+ unlink(path_dhclient_pid);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ fclose(pidfd);
|
||||
+ }
|
||||
+
|
||||
+ free(new_path_dhclient_pid);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ } else {
|
||||
+ FILE *pidfp = NULL;
|
||||
+ long temp = 0;
|
||||
+ pid_t dhcpid = 0;
|
||||
+ int dhc_running = 0;
|
||||
+ char procfn[256] = "";
|
||||
+
|
||||
+ if ((pidfp = fopen(path_dhclient_pid, "r")) != NULL) {
|
||||
+ if ((fscanf(pidfp, "%ld", &temp)==1) && ((dhcpid=(pid_t)temp) > 0)) {
|
||||
+ snprintf(procfn,256,"/proc/%u",dhcpid);
|
||||
+ dhc_running = (access(procfn, F_OK) == 0);
|
||||
+ }
|
||||
+
|
||||
+ fclose(pidfp);
|
||||
+ }
|
||||
+
|
||||
+ if (dhc_running) {
|
||||
+ log_fatal("dhclient(%u) is already running - exiting. ", dhcpid);
|
||||
+ return(1);
|
||||
}
|
||||
}
|
||||
|
||||
+ write_client_pid_file();
|
||||
+
|
||||
if (!quiet) {
|
||||
log_info ("%s %s", message, DHCP_VERSION);
|
||||
log_info (copyright);
|
11
dhcp-3.0.5-selinux.patch
Normal file
11
dhcp-3.0.5-selinux.patch
Normal file
@ -0,0 +1,11 @@
|
||||
--- dhcp-3.0.5/client/dhclient.c.selinux 2007-03-30 16:11:54.000000000 -0400
|
||||
+++ dhcp-3.0.5/client/dhclient.c 2007-03-30 16:12:27.000000000 -0400
|
||||
@@ -3009,6 +3009,8 @@
|
||||
wstatus = 0;
|
||||
}
|
||||
} else {
|
||||
+ if (leaseFile)
|
||||
+ fclose(leaseFile);
|
||||
execve (scriptName, argv, envp);
|
||||
log_error ("execve (%s, ...): %m", scriptName);
|
||||
exit (0);
|
97
dhcp-3.0.5-unicast-bootp.patch
Normal file
97
dhcp-3.0.5-unicast-bootp.patch
Normal file
@ -0,0 +1,97 @@
|
||||
--- dhcp-3.0.5/server/bootp.c.unicast 2005-05-18 15:54:17.000000000 -0400
|
||||
+++ dhcp-3.0.5/server/bootp.c 2007-03-30 16:16:00.000000000 -0400
|
||||
@@ -62,6 +62,7 @@
|
||||
char msgbuf [1024];
|
||||
int ignorep;
|
||||
int peer_has_leases = 0;
|
||||
+ int norelay = 0;
|
||||
|
||||
if (packet -> raw -> op != BOOTREQUEST)
|
||||
return;
|
||||
@@ -77,7 +78,7 @@
|
||||
? inet_ntoa (packet -> raw -> giaddr)
|
||||
: packet -> interface -> name);
|
||||
|
||||
- if (!locate_network (packet)) {
|
||||
+ if ((norelay = locate_network (packet)) == 0) {
|
||||
log_info ("%s: network unknown", msgbuf);
|
||||
return;
|
||||
}
|
||||
@@ -357,6 +358,13 @@
|
||||
from, &to, &hto);
|
||||
goto out;
|
||||
}
|
||||
+ } else if (norelay == 2) {
|
||||
+ to.sin_addr = raw.ciaddr;
|
||||
+ to.sin_port = remote_port;
|
||||
+ if (fallback_interface) {
|
||||
+ result = send_packet (fallback_interface, (struct packet *)0, &raw, outgoing.packet_length, from, &to, &hto);
|
||||
+ goto out;
|
||||
+ }
|
||||
|
||||
/* If it comes from a client that already knows its address
|
||||
and is not requesting a broadcast response, and we can
|
||||
--- dhcp-3.0.5/server/dhcp.c.unicast 2007-03-30 16:13:36.000000000 -0400
|
||||
+++ dhcp-3.0.5/server/dhcp.c 2007-03-30 16:19:35.000000000 -0400
|
||||
@@ -3817,6 +3817,7 @@
|
||||
struct data_string data;
|
||||
struct subnet *subnet = (struct subnet *)0;
|
||||
struct option_cache *oc;
|
||||
+ int norelay = 0;
|
||||
|
||||
/* See if there's a subnet selection option. */
|
||||
oc = lookup_option (&dhcp_universe, packet -> options,
|
||||
@@ -3826,12 +3827,24 @@
|
||||
from the interface, if there is one. If not, fail. */
|
||||
if (!oc && !packet -> raw -> giaddr.s_addr) {
|
||||
if (packet -> interface -> shared_network) {
|
||||
- shared_network_reference
|
||||
- (&packet -> shared_network,
|
||||
- packet -> interface -> shared_network, MDL);
|
||||
- return 1;
|
||||
+ struct in_addr any_addr;
|
||||
+ any_addr.s_addr = INADDR_ANY;
|
||||
+
|
||||
+ if (!packet -> packet_type && memcmp(&packet -> raw -> ciaddr, &any_addr, 4)) {
|
||||
+ struct iaddr cip;
|
||||
+ memcpy(cip.iabuf, &packet -> raw -> ciaddr, 4);
|
||||
+ cip.len = 4;
|
||||
+ if (!find_grouped_subnet(&subnet, packet->interface->shared_network, cip, MDL))
|
||||
+ norelay = 2;
|
||||
+ }
|
||||
+
|
||||
+ if (!norelay) {
|
||||
+ shared_network_reference(&packet -> shared_network, packet -> interface -> shared_network, MDL);
|
||||
+ return 1;
|
||||
+ }
|
||||
+ } else {
|
||||
+ return 0;
|
||||
}
|
||||
- return 0;
|
||||
}
|
||||
|
||||
/* If there's an SSO, and it's valid, use it to figure out the
|
||||
@@ -3853,7 +3866,10 @@
|
||||
data_string_forget (&data, MDL);
|
||||
} else {
|
||||
ia.len = 4;
|
||||
- memcpy (ia.iabuf, &packet -> raw -> giaddr, 4);
|
||||
+ if (norelay)
|
||||
+ memcpy (ia.iabuf, &packet->raw->ciaddr, 4);
|
||||
+ else
|
||||
+ memcpy (ia.iabuf, &packet->raw->giaddr, 4);
|
||||
}
|
||||
|
||||
/* If we know the subnet on which the IP address lives, use it. */
|
||||
@@ -3861,7 +3877,10 @@
|
||||
shared_network_reference (&packet -> shared_network,
|
||||
subnet -> shared_network, MDL);
|
||||
subnet_dereference (&subnet, MDL);
|
||||
- return 1;
|
||||
+ if (norelay)
|
||||
+ return norelay;
|
||||
+ else
|
||||
+ return 1;
|
||||
}
|
||||
|
||||
/* Otherwise, fail. */
|
2165
dhcp-3.0.5-warnings.patch
Normal file
2165
dhcp-3.0.5-warnings.patch
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,31 +1,28 @@
|
||||
diff -ur dhcp-3.0.5.orig/common/bpf.c dhcp-3.0.5/common/bpf.c
|
||||
--- dhcp-3.0.5.orig/common/bpf.c 2004-11-25 04:39:15.000000000 +1100
|
||||
+++ dhcp-3.0.5/common/bpf.c 2007-01-10 15:39:38.000000000 +1100
|
||||
--- dhcp-3.0.5/common/bpf.c.xen 2004-11-24 12:39:15.000000000 -0500
|
||||
+++ dhcp-3.0.5/common/bpf.c 2007-03-30 16:34:45.000000000 -0400
|
||||
@@ -478,7 +478,8 @@
|
||||
interface -> rbuf,
|
||||
interface -> rbuf_offset,
|
||||
from,
|
||||
- hdr.bh_caplen);
|
||||
+ hdr.bh_caplen,
|
||||
+ 0);
|
||||
interface -> rbuf,
|
||||
interface -> rbuf_offset,
|
||||
from,
|
||||
- hdr.bh_caplen);
|
||||
+ hdr.bh_caplen,
|
||||
+ 0);
|
||||
|
||||
/* If the IP or UDP checksum was bad, skip the packet... */
|
||||
if (offset < 0) {
|
||||
diff -ur dhcp-3.0.5.orig/common/dlpi.c dhcp-3.0.5/common/dlpi.c
|
||||
--- dhcp-3.0.5.orig/common/dlpi.c 2004-11-25 04:39:15.000000000 +1100
|
||||
+++ dhcp-3.0.5/common/dlpi.c 2007-01-10 15:40:57.000000000 +1100
|
||||
/* If the IP or UDP checksum was bad, skip the packet... */
|
||||
if (offset < 0) {
|
||||
--- dhcp-3.0.5/common/dlpi.c.xen 2004-11-24 12:39:15.000000000 -0500
|
||||
+++ dhcp-3.0.5/common/dlpi.c 2007-03-30 16:34:45.000000000 -0400
|
||||
@@ -679,7 +679,7 @@
|
||||
length -= offset;
|
||||
length -= offset;
|
||||
#endif
|
||||
offset = decode_udp_ip_header (interface, dbuf, bufix,
|
||||
- from, length);
|
||||
+ from, length, 0);
|
||||
offset = decode_udp_ip_header (interface, dbuf, bufix,
|
||||
- from, length);
|
||||
+ from, length, 0);
|
||||
|
||||
/* If the IP or UDP checksum was bad, skip the packet... */
|
||||
if (offset < 0) {
|
||||
diff -ur dhcp-3.0.5.orig/common/lpf.c dhcp-3.0.5/common/lpf.c
|
||||
--- dhcp-3.0.5.orig/common/lpf.c 2007-01-10 15:49:04.000000000 +1100
|
||||
+++ dhcp-3.0.5/common/lpf.c 2007-01-25 08:54:25.000000000 +1100
|
||||
/* If the IP or UDP checksum was bad, skip the packet... */
|
||||
if (offset < 0) {
|
||||
--- dhcp-3.0.5/common/lpf.c.xen 2007-03-30 16:34:26.000000000 -0400
|
||||
+++ dhcp-3.0.5/common/lpf.c 2007-03-30 16:34:45.000000000 -0400
|
||||
@@ -34,16 +34,31 @@
|
||||
#include "dhcpd.h"
|
||||
#if defined (USE_LPF_SEND) || defined (USE_LPF_RECEIVE)
|
||||
@ -47,11 +44,11 @@ diff -ur dhcp-3.0.5.orig/common/lpf.c dhcp-3.0.5/common/lpf.c
|
||||
+
|
||||
+struct tpacket_auxdata
|
||||
+{
|
||||
+ __u32 tp_status;
|
||||
+ __u32 tp_len;
|
||||
+ __u32 tp_snaplen;
|
||||
+ __u16 tp_mac;
|
||||
+ __u16 tp_net;
|
||||
+ __u32 tp_status;
|
||||
+ __u32 tp_len;
|
||||
+ __u32 tp_snaplen;
|
||||
+ __u16 tp_mac;
|
||||
+ __u16 tp_net;
|
||||
+};
|
||||
+#endif
|
||||
+
|
||||
@ -59,191 +56,187 @@ diff -ur dhcp-3.0.5.orig/common/lpf.c dhcp-3.0.5/common/lpf.c
|
||||
is not required for packet-filter APIs. */
|
||||
|
||||
@@ -69,10 +84,14 @@
|
||||
struct interface_info *info;
|
||||
struct interface_info *info;
|
||||
{
|
||||
int sock;
|
||||
- struct sockaddr sa;
|
||||
+ union {
|
||||
+ struct sockaddr_ll ll;
|
||||
+ struct sockaddr common;
|
||||
+ } sa;
|
||||
+ struct ifreq ifr;
|
||||
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 ||
|
||||
/* 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 ||
|
||||
@@ -87,11 +106,16 @@
|
||||
log_fatal ("Open a socket for LPF: %m");
|
||||
}
|
||||
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");
|
||||
+ 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) {
|
||||
/* 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) {
|
||||
@@ -171,9 +195,18 @@
|
||||
void if_register_receive (info)
|
||||
struct interface_info *info;
|
||||
struct interface_info *info;
|
||||
{
|
||||
+ int val;
|
||||
+ int val;
|
||||
+
|
||||
/* Open a LPF device and hang it on this interface... */
|
||||
info -> rfdesc = if_register_lpf (info);
|
||||
/* 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");
|
||||
+ }
|
||||
+ 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);
|
||||
@@ -292,7 +325,6 @@
|
||||
double hh [16];
|
||||
double ih [1536 / sizeof (double)];
|
||||
unsigned char *buf = (unsigned char *)ih;
|
||||
- struct sockaddr sa;
|
||||
int result;
|
||||
int fudge;
|
||||
if (info -> hw_address.hbuf [0] == HTYPE_IEEE802)
|
||||
lpf_tr_filter_setup (info);
|
||||
@@ -291,7 +324,6 @@
|
||||
double hh [16];
|
||||
double ih [1536 / sizeof (double)];
|
||||
unsigned char *buf = (unsigned char *)ih;
|
||||
- struct sockaddr sa;
|
||||
int result;
|
||||
int fudge;
|
||||
|
||||
@@ -310,15 +342,7 @@
|
||||
(unsigned char *)raw, len);
|
||||
memcpy (buf + ibufp, raw, len);
|
||||
@@ -309,15 +341,7 @@
|
||||
(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.sa_family = AF_PACKET;
|
||||
- strncpy (sa.sa_data,
|
||||
- (const char *)interface -> ifp, sizeof sa.sa_data);
|
||||
- /* 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.sa_family = AF_PACKET;
|
||||
- strncpy (sa.sa_data,
|
||||
- (const char *)interface -> ifp, sizeof sa.sa_data);
|
||||
-
|
||||
- result = sendto (interface -> wfdesc,
|
||||
- buf + fudge, ibufp + len - fudge, 0, &sa, sizeof sa);
|
||||
+ result = write (interface -> wfdesc, buf + fudge, ibufp + len - fudge);
|
||||
if (result < 0)
|
||||
log_error ("send_packet: %m");
|
||||
return result;
|
||||
@@ -335,13 +359,34 @@
|
||||
- result = sendto (interface -> wfdesc,
|
||||
- buf + fudge, ibufp + len - fudge, 0, &sa, sizeof sa);
|
||||
+ result = write (interface -> wfdesc, buf + fudge, ibufp + len - fudge);
|
||||
if (result < 0)
|
||||
log_error ("send_packet: %m");
|
||||
return result;
|
||||
@@ -334,13 +358,34 @@
|
||||
{
|
||||
int length = 0;
|
||||
int offset = 0;
|
||||
+ int nocsum = 0;
|
||||
unsigned char ibuf [1536];
|
||||
unsigned bufix = 0;
|
||||
+ 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;
|
||||
int length = 0;
|
||||
int offset = 0;
|
||||
+ int nocsum = 0;
|
||||
unsigned char ibuf [1536];
|
||||
unsigned bufix = 0;
|
||||
+ 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 = read (interface -> rfdesc, ibuf, sizeof ibuf);
|
||||
+ length = recvmsg (interface -> rfdesc, &msg, 0);
|
||||
if (length <= 0)
|
||||
return length;
|
||||
- length = read (interface -> rfdesc, ibuf, sizeof ibuf);
|
||||
+ 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;
|
||||
+ }
|
||||
+ }
|
||||
+ 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);
|
||||
@@ -358,7 +403,7 @@
|
||||
bufix = 0;
|
||||
/* Decode the physical header... */
|
||||
offset = decode_hw_header (interface, ibuf, bufix, hfrom);
|
||||
@@ -357,7 +402,7 @@
|
||||
|
||||
/* Decode the IP and UDP headers... */
|
||||
offset = decode_udp_ip_header (interface, ibuf, bufix, from,
|
||||
- (unsigned)length);
|
||||
+ (unsigned)length, nocsum);
|
||||
/* Decode the IP and UDP headers... */
|
||||
offset = decode_udp_ip_header (interface, ibuf, bufix, from,
|
||||
- (unsigned)length);
|
||||
+ (unsigned)length, nocsum);
|
||||
|
||||
/* If the IP or UDP checksum was bad, skip the packet... */
|
||||
if (offset < 0)
|
||||
diff -ur dhcp-3.0.5.orig/common/nit.c dhcp-3.0.5/common/nit.c
|
||||
--- dhcp-3.0.5.orig/common/nit.c 2004-11-25 04:39:15.000000000 +1100
|
||||
+++ dhcp-3.0.5/common/nit.c 2007-01-10 15:39:47.000000000 +1100
|
||||
/* If the IP or UDP checksum was bad, skip the packet... */
|
||||
if (offset < 0)
|
||||
--- dhcp-3.0.5/common/nit.c.xen 2004-11-24 12:39:15.000000000 -0500
|
||||
+++ dhcp-3.0.5/common/nit.c 2007-03-30 16:34:45.000000000 -0400
|
||||
@@ -370,7 +370,7 @@
|
||||
|
||||
/* Decode the IP and UDP headers... */
|
||||
offset = decode_udp_ip_header (interface, ibuf, bufix,
|
||||
- from, length);
|
||||
+ from, length, 0);
|
||||
/* Decode the IP and UDP headers... */
|
||||
offset = decode_udp_ip_header (interface, ibuf, bufix,
|
||||
- from, length);
|
||||
+ from, length, 0);
|
||||
|
||||
/* If the IP or UDP checksum was bad, skip the packet... */
|
||||
if (offset < 0)
|
||||
diff -ur dhcp-3.0.5.orig/common/packet.c dhcp-3.0.5/common/packet.c
|
||||
--- dhcp-3.0.5.orig/common/packet.c 2007-01-10 15:49:04.000000000 +1100
|
||||
+++ dhcp-3.0.5/common/packet.c 2007-01-10 15:40:47.000000000 +1100
|
||||
/* If the IP or UDP checksum was bad, skip the packet... */
|
||||
if (offset < 0)
|
||||
--- dhcp-3.0.5/common/packet.c.xen 2007-03-30 16:34:26.000000000 -0400
|
||||
+++ dhcp-3.0.5/common/packet.c 2007-03-30 16:34:45.000000000 -0400
|
||||
@@ -211,12 +211,13 @@
|
||||
|
||||
/* UDP header and IP header decoded together for convenience. */
|
||||
|
||||
-ssize_t decode_udp_ip_header (interface, buf, bufix, from, buflen)
|
||||
+ssize_t decode_udp_ip_header (interface, buf, bufix, from, buflen, nocsum)
|
||||
struct interface_info *interface;
|
||||
unsigned char *buf;
|
||||
unsigned bufix;
|
||||
struct sockaddr_in *from;
|
||||
unsigned buflen;
|
||||
+ int nocsum;
|
||||
struct interface_info *interface;
|
||||
unsigned char *buf;
|
||||
unsigned bufix;
|
||||
struct sockaddr_in *from;
|
||||
unsigned buflen;
|
||||
+ int nocsum;
|
||||
{
|
||||
unsigned char *data;
|
||||
struct ip ip;
|
||||
@@ -319,7 +320,7 @@
|
||||
(u_int32_t)ulen))));
|
||||
(u_int32_t)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 -ur dhcp-3.0.5.orig/common/upf.c dhcp-3.0.5/common/upf.c
|
||||
--- dhcp-3.0.5.orig/common/upf.c 2004-11-25 04:39:16.000000000 +1100
|
||||
+++ dhcp-3.0.5/common/upf.c 2007-01-10 15:39:59.000000000 +1100
|
||||
udp_packets_bad_checksum++;
|
||||
if (udp_packets_seen > 4 &&
|
||||
(udp_packets_seen / udp_packets_bad_checksum) < 2) {
|
||||
--- dhcp-3.0.5/common/upf.c.xen 2004-11-24 12:39:16.000000000 -0500
|
||||
+++ dhcp-3.0.5/common/upf.c 2007-03-30 16:34:45.000000000 -0400
|
||||
@@ -321,7 +321,7 @@
|
||||
|
||||
/* Decode the IP and UDP headers... */
|
||||
offset = decode_udp_ip_header (interface, ibuf, bufix,
|
||||
- from, length);
|
||||
+ from, length, 0);
|
||||
/* Decode the IP and UDP headers... */
|
||||
offset = decode_udp_ip_header (interface, ibuf, bufix,
|
||||
- from, length);
|
||||
+ from, length, 0);
|
||||
|
||||
/* If the IP or UDP checksum was bad, skip the packet... */
|
||||
if (offset < 0)
|
||||
diff -ur dhcp-3.0.5.orig/includes/dhcpd.h dhcp-3.0.5/includes/dhcpd.h
|
||||
--- dhcp-3.0.5.orig/includes/dhcpd.h 2007-01-10 15:49:04.000000000 +1100
|
||||
+++ dhcp-3.0.5/includes/dhcpd.h 2007-01-10 15:41:08.000000000 +1100
|
||||
@@ -1948,7 +1948,7 @@
|
||||
unsigned, struct hardware *));
|
||||
/* If the IP or UDP checksum was bad, skip the packet... */
|
||||
if (offset < 0)
|
||||
--- dhcp-3.0.5/includes/dhcpd.h.xen 2007-03-30 16:34:26.000000000 -0400
|
||||
+++ dhcp-3.0.5/includes/dhcpd.h 2007-03-30 16:34:45.000000000 -0400
|
||||
@@ -1988,7 +1988,7 @@
|
||||
unsigned, struct hardware *));
|
||||
ssize_t decode_udp_ip_header PROTO ((struct interface_info *, unsigned char *,
|
||||
unsigned, struct sockaddr_in *,
|
||||
- unsigned));
|
||||
+ unsigned, int));
|
||||
unsigned, struct sockaddr_in *,
|
||||
- unsigned));
|
||||
+ unsigned, int));
|
||||
|
||||
/* ethernet.c */
|
||||
void assemble_ethernet_header PROTO ((struct interface_info *, unsigned char *,
|
||||
|
253
dhcp.spec
253
dhcp.spec
@ -7,51 +7,53 @@
|
||||
# value to avoid any problems guessing what it might be during installation.
|
||||
%define workdir work.linux-2.2
|
||||
|
||||
Summary: DHCP (Dynamic Host Configuration Protocol) server and relay agent
|
||||
Name: dhcp
|
||||
Version: 3.0.5
|
||||
Release: 26%{?dist}
|
||||
Epoch: 12
|
||||
License: ISC
|
||||
Group: System Environment/Daemons
|
||||
URL: http://isc.org/products/DHCP/
|
||||
Source0: ftp://ftp.isc.org/isc/dhcp/dhcp-%{version}.tar.gz
|
||||
Source1: dhcpd.conf.sample
|
||||
Source2: dhcpd.init
|
||||
Source3: dhcrelay.init
|
||||
Source4: dhcpd.conf
|
||||
Source5: libdhcp4client.pc
|
||||
Source6: README.ldap
|
||||
Source7: draft-ietf-dhc-ldap-schema-01.txt
|
||||
Source8: dhcpd-conf-to-ldap.pl
|
||||
Source9: linux.dbus-example
|
||||
Summary: DHCP (Dynamic Host Configuration Protocol) server and relay agent
|
||||
Name: dhcp
|
||||
Version: 3.0.5
|
||||
Release: 27%{?dist}
|
||||
Epoch: 12
|
||||
License: ISC
|
||||
Group: System Environment/Daemons
|
||||
URL: http://isc.org/products/DHCP/
|
||||
Source0: ftp://ftp.isc.org/isc/%{name}/%{name}-%{version}.tar.gz
|
||||
Source1: dhcpd.conf.sample
|
||||
Source2: dhcpd.init
|
||||
Source3: dhcrelay.init
|
||||
Source4: dhcpd.conf
|
||||
Source5: libdhcp4client.pc
|
||||
Source6: README.ldap
|
||||
Source7: draft-ietf-dhc-ldap-schema-01.txt
|
||||
Source8: dhcpd-conf-to-ldap
|
||||
Source9: linux.dbus-example
|
||||
Source10: linux
|
||||
Source11: Makefile.dist
|
||||
Source12: dhcp4client.h
|
||||
Source13: libdhcp_control.h
|
||||
|
||||
# Main patches
|
||||
Patch0: dhcp-3.0.5-extended-new-option-info.patch
|
||||
Patch1: dhcp-3.0.5-Makefile.patch
|
||||
Patch2: dhcp-3.0.5-version.patch
|
||||
Patch3: dhcp-3.0.5-client.patch
|
||||
Patch4: dhcp-3.0.5-common.patch
|
||||
Patch5: dhcp-3.0.5-dhcpctl.patch
|
||||
Patch6: dhcp-3.0.5-dst.patch
|
||||
Patch7: dhcp-3.0.5-includes.patch
|
||||
Patch8: dhcp-3.0.5-omapip.patch
|
||||
Patch9: dhcp-3.0.5-minires.patch
|
||||
Patch10: dhcp-3.0.5-server.patch
|
||||
Patch11: dhcp-3.0.5-timeouts.patch
|
||||
Patch12: dhcp-3.0.5-fix-warnings.patch
|
||||
Patch13: dhcp-3.0.5-xen-checksum.patch
|
||||
Patch14: dhcp-3.0.5-ldap-configuration.patch
|
||||
Patch15: dhcp-3.0.5-no-win32.patch
|
||||
|
||||
# adds libdhcp4client to the ISC code base
|
||||
Patch50: dhcp-3.0.5-libdhcp4client.patch
|
||||
|
||||
# Bug fixes
|
||||
Patch100: dhcp-3.0.5-dhclient-man-page.patch
|
||||
Patch0: %{name}-%{version}-version.patch
|
||||
Patch1: %{name}-%{version}-Makefile.patch
|
||||
Patch2: %{name}-%{version}-warnings.patch
|
||||
Patch3: %{name}-%{version}-extended-new-option-info.patch
|
||||
Patch4: %{name}-%{version}-errwarn-message.patch
|
||||
Patch5: %{name}-%{version}-ldap-configuration.patch
|
||||
Patch6: %{name}-%{version}-memory.patch
|
||||
Patch7: %{name}-%{version}-options.patch
|
||||
Patch8: %{name}-%{version}-release-by-ifup.patch
|
||||
Patch9: %{name}-%{version}-dhclient-decline-backoff.patch
|
||||
Patch10: %{name}-%{version}-enable-timeout-functions.patch
|
||||
Patch11: %{name}-%{version}-inherit-leases.patch
|
||||
Patch12: %{name}-%{version}-selinux.patch
|
||||
Patch13: %{name}-%{version}-unicast-bootp.patch
|
||||
Patch14: %{name}-%{version}-fast-timeout.patch
|
||||
Patch15: %{name}-%{version}-failover-ports.patch
|
||||
Patch16: %{name}-%{version}-xen-checksum.patch
|
||||
Patch17: %{name}-%{version}-dhclient-usage.patch
|
||||
Patch18: %{name}-%{version}-default-requested-options.patch
|
||||
Patch19: %{name}-%{version}-prototypes.patch
|
||||
Patch20: %{name}-%{version}-manpages.patch
|
||||
Patch21: %{name}-%{version}-libdhcp4client.patch
|
||||
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||
Requires: perl
|
||||
Requires(post): chkconfig, coreutils
|
||||
Requires(preun): chkconfig
|
||||
Requires(postun): coreutils
|
||||
@ -116,64 +118,99 @@ client library .
|
||||
%prep
|
||||
%setup -q
|
||||
|
||||
# Extended new option info patch. Adds the -x option to dhclient, which is
|
||||
# needed for dhcdbd and NetworkManager
|
||||
%patch0 -p1 -b .enoi
|
||||
# Add -RedHat to the version number
|
||||
%patch0 -p1 -b .version
|
||||
|
||||
# Build fixes
|
||||
# Use $(MAKE) and $(CC) in the Makefiles
|
||||
%patch1 -p1 -b .Makefile
|
||||
|
||||
# Add -RedHat to the version number
|
||||
%patch2 -p1 -b .version
|
||||
|
||||
# Patches for the client/ subdirectory
|
||||
%patch3 -p1 -b .client
|
||||
|
||||
# Patches for the common/ subdirectory
|
||||
%patch4 -p1 -b .common
|
||||
|
||||
# Patches for the dhcpctl/ subdirectory
|
||||
%patch5 -p1 -b .dhcpctl
|
||||
|
||||
# Patches for the dst/ subdirectory
|
||||
%patch6 -p1 -b .dst
|
||||
|
||||
# Patches for the includes/ subdirectory
|
||||
%patch7 -p1 -b .includes
|
||||
|
||||
# Patches for the omapip/ subdirectory
|
||||
%patch8 -p1 -b .omapip
|
||||
|
||||
# Patches for the minires/ subdirectory
|
||||
%patch9 -p1 -b .minires
|
||||
|
||||
# Patches for the server/ subdirectory
|
||||
%patch10 -p1 -b .server
|
||||
|
||||
# Fix up timeout handling in dhclient and libdhcp4client
|
||||
%patch11 -p1 -b .timeouts
|
||||
|
||||
# Fix up anything that fails -Wall -Werror
|
||||
%patch12 -p1 -b .warnings
|
||||
%patch2 -p1 -b .warnings
|
||||
|
||||
# Fix Xen host networking problems (partial checksums)
|
||||
#%patch13 -p1 -b .xen
|
||||
# Extended new option info patch. Adds the -x option to dhclient, which is
|
||||
# needed for dhcdbd and NetworkManager
|
||||
%patch3 -p1 -b .enoi
|
||||
|
||||
# Replace the standard ISC warning message about requesting help with an
|
||||
# explanation that this is a patched build of ISC DHCP and bugs should be
|
||||
# reported through bugzilla.redhat.com
|
||||
%patch4 -p1 -b .message
|
||||
|
||||
# Add support for dhcpd.conf data in LDAP
|
||||
%patch14 -p1 -b .ldap
|
||||
%patch5 -p1 -b .ldap
|
||||
|
||||
# The contrib/ms2isc/Registry.pm file requires Win32API::Registry, which is
|
||||
# not part of Fedora by default. We comment out this use line in the script
|
||||
# so that RPM doesn't automatically add perl(Win32API::Registry) dependency.
|
||||
# The patch puts a comment in the script telling the user which perl module
|
||||
# should be installed to use the Registry.pm contrib file.
|
||||
%patch15 -p1 -b .no-win32
|
||||
# Fix memory alignment and initialization problems in common/packet.c
|
||||
# Fix buffer overflow in minires library
|
||||
# Init struct sock_prog in common/lpf.c to NULL
|
||||
%patch6 -p1 -b .memory
|
||||
|
||||
# Add more dhclient options (-I, -B, -H, -F, -T, -V, and -R)
|
||||
%patch7 -p1 -b .options
|
||||
|
||||
# Handle releasing interfaces requested by /sbin/ifup
|
||||
# pid file is assumed to be /var/run/dhclient-$interface.pid
|
||||
%patch8 -p1 -b .release
|
||||
|
||||
# If we receive a DHCP offer in dhclient and it's DECLINEd in dhclient-script,
|
||||
# backoff for an amount of time before trying again
|
||||
%patch9 -p1 -b .decline
|
||||
|
||||
# Enable cancel_all_timeouts() and relinquish_timeouts() regardless of
|
||||
# the DEBUG_MEMORY_LEAKAGE_ON_EXIT macro
|
||||
%patch10 -p1 -b .etf
|
||||
|
||||
# Inherit active leases
|
||||
%patch11 -p1 -b .inherit
|
||||
|
||||
# Close lease file before exec to fix SELinux error message
|
||||
%patch12 -p1 -b .selinux
|
||||
|
||||
# Support unicast BOOTP for IBM pSeries systems (and maybe others)
|
||||
%patch13 -p1 -b .unicast
|
||||
|
||||
# Fast timeout for dhclient
|
||||
%patch14 -p1 -b .fast
|
||||
|
||||
# Use the following IANA-registered failover ports:
|
||||
# dhcp-failover 647/tcp
|
||||
# dhcp-failover 647/udp
|
||||
# dhcp-failover 847/tcp
|
||||
# dhcp-failover 847/udp
|
||||
%patch15 -p1 -b .failover
|
||||
|
||||
# Fix Xen host networking problems (partial checksums)
|
||||
%patch16 -p1 -b .xen
|
||||
|
||||
# Update the usage screen for dhclient(8) indicating new options
|
||||
# Use printf() rather than log_info() to display the information
|
||||
# Also, return EXIT_FAILURE when the usage() screen is displayed (stop parsing)
|
||||
%patch17 -p1 -b .usage
|
||||
|
||||
# Add NIS domain, NIS servers, and NTP servers to the list of default
|
||||
# requested DHCP options
|
||||
%patch18 -p1 -b .dho
|
||||
|
||||
# Add missing prototypes to take care of gcc warnings
|
||||
# in dst/dst_api.c: add b64_pton() and b64_ntop()
|
||||
# in includes/minires/minires.h: remove macro for b64_pton
|
||||
# in minires/res_mkupdate.c: add b64_pton() and dn_comp()
|
||||
# in minires/res_comp.c: add ns_name_uncompress(), ns_name_compress(), and
|
||||
# ns_name_skip()
|
||||
# in minires/res_init.c: add res_randomid()
|
||||
%patch19 -p1 -b .prototypes
|
||||
|
||||
# Man page updates explaining new features added from the above patches.
|
||||
# Normally these man page changes would be included in the feature patch,
|
||||
# however, man page changes generate more hunk failures when applying only
|
||||
# a select set of patches. Instead, the man page changes are grouped
|
||||
# together in one patch so changes can be made to just those more easily
|
||||
# and not affect the code changes in the other patches. It's actually
|
||||
# pretty common to update or alter these man pages independent of the code
|
||||
# changes.
|
||||
%patch20 -p1 -b .manpages
|
||||
|
||||
# Add the libdhcp4client target (library version of dhclient)
|
||||
%patch50 -p1 -b .libdhcp4client
|
||||
|
||||
# Apply bug fixes
|
||||
%patch100 -p1 -b .dhclient-man-page
|
||||
%patch21 -p1 -b .libdhcp4client
|
||||
|
||||
# Copy in documentation and example scripts for LDAP patch to dhcpd
|
||||
%{__cp} -p %SOURCE6 .
|
||||
@ -184,6 +221,23 @@ client library .
|
||||
# new option info patch too)
|
||||
%{__cp} -p %SOURCE9 client/scripts
|
||||
|
||||
# Copy in the Fedora/RHEL dhclient script
|
||||
%{__cp} -p %SOURCE10 client/scripts
|
||||
|
||||
# Copy in the libdhcp4client headers and Makefile.dist
|
||||
%{__mkdir} -p libdhcp4client
|
||||
%{__cp} -p %SOURCE11 libdhcp4client
|
||||
%{__cp} -p %SOURCE12 libdhcp4client
|
||||
%{__cp} -p %SOURCE13 libdhcp4client
|
||||
|
||||
# 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).
|
||||
%{__chmod} -x contrib/3.0b1-lease-convert
|
||||
%{__chmod} -x contrib/dhcpd-conf-to-ldap
|
||||
%{__cp} -p contrib/ms2isc/Registry.pm contrib/ms2isc/Registry.perlmodule
|
||||
%{__rm} -f contrib/ms2isc/Registry.pm
|
||||
|
||||
%build
|
||||
%{__cp} %SOURCE1 .
|
||||
%{__cat} <<EOF > site.conf
|
||||
@ -200,15 +254,17 @@ EOF
|
||||
#define _PATH_DHCLIENT_DB "%{_localstatedir}/lib/dhclient/dhclient.leases"
|
||||
EOF
|
||||
|
||||
# Enable extended option info patch (-DEXTENDED_NEW_OPTION_INFO)
|
||||
# Disable gcc's strict aliasing since ISC code tends to cast a lot.
|
||||
#
|
||||
# Use -fvisibility=hidden for libdhcp4client. The way that library is
|
||||
# constructed, we need to follow the hide-by-default/expose-what-we-need
|
||||
# plan for the library API.
|
||||
COPTS="-fPIC -Werror -Dlint -DEXTENDED_NEW_OPTION_INFO -fvisibility=hidden"
|
||||
COPTS="-fPIC -Werror -Dlint -fno-strict-aliasing -fvisibility=hidden"
|
||||
|
||||
# DO NOT use the %%configure macro because this configure script is not autognu
|
||||
# Enable extended option info patch (-DEXTENDED_NEW_OPTION_INFO)
|
||||
CC="%{__cc}" ./configure \
|
||||
--copts "$RPM_OPT_FLAGS $COPTS %{?bigptrs}" \
|
||||
--copts "$RPM_OPT_FLAGS $COPTS %{?bigptrs} -DEXTENDED_NEW_OPTION_INFO" \
|
||||
--work-dir %{workdir}
|
||||
|
||||
%{__sed} 's/@DHCP_VERSION@/'%{version}'/' < %SOURCE5 > libdhcp4client.pc
|
||||
@ -220,8 +276,6 @@ CC="%{__cc}" ./configure \
|
||||
|
||||
%{__make} install DESTDIR=%{buildroot}
|
||||
|
||||
%{__install} -p -m 0755 contrib/dhcpd-conf-to-ldap.pl %{buildroot}/usr/bin/dhcpd-conf-to-ldap
|
||||
|
||||
%{__mkdir} -p %{buildroot}%{_initrddir}
|
||||
%{__install} -p -m 0755 %SOURCE2 %{buildroot}%{_initrddir}/dhcpd
|
||||
|
||||
@ -298,7 +352,6 @@ exit 0
|
||||
%{_initrddir}/dhcpd
|
||||
%{_initrddir}/dhcrelay
|
||||
%{_bindir}/omshell
|
||||
%{_bindir}/dhcpd-conf-to-ldap
|
||||
%{_sbindir}/dhcpd
|
||||
%{_sbindir}/dhcrelay
|
||||
%attr(0644,root,root) %{_mandir}/man1/omshell.1.gz
|
||||
@ -342,6 +395,14 @@ exit 0
|
||||
%{_libdir}/libdhcp4client.so
|
||||
|
||||
%changelog
|
||||
* Sun Apr 01 2007 David Cantrell <dcantrell@redhat.com> - 12:3.0.5-27
|
||||
- Ensure that Perl and Perl modules are not added as dependencies (#234688)
|
||||
- Reorganize patches by feature/bug per packaging guidelines (#225691)
|
||||
- Move the following files from patches to source files:
|
||||
linux.dbus-example, linux, Makefile.dist, dhcp4client.h, libdhcp_control.h
|
||||
- Compile with -fno-strict-aliasing as ISC coding standards generally don't
|
||||
agree well with gcc 4.x.x
|
||||
|
||||
* Wed Mar 21 2007 David Cantrell <dcantrell@redhat.com> - 12:3.0.5-26
|
||||
- Fix formatting problems in dhclient man page (#233076).
|
||||
|
||||
|
25
dhcp4client.h
Normal file
25
dhcp4client.h
Normal file
@ -0,0 +1,25 @@
|
||||
/* dhcp4client.h
|
||||
*
|
||||
* Interface to the ISC dhcp IPv4 client libdhcp4client library.
|
||||
*
|
||||
*
|
||||
* Copyright(C) Jason Vas Dias <jvdias@redhat.com> Red Hat Inc. May 2006
|
||||
*
|
||||
* 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 at
|
||||
* http://www.fsf.org/licensing/licenses/gpl.txt
|
||||
* and included in this software distribution as the "LICENSE" file.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/* include libdhcp_control.h or libdhcp.h for this */
|
||||
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);
|
517
dhcpd-conf-to-ldap
Executable file
517
dhcpd-conf-to-ldap
Executable file
@ -0,0 +1,517 @@
|
||||
#!/usr/bin/perl -w
|
||||
|
||||
# Brian Masney <masneyb@ntelos.net>
|
||||
# To use this script, set your base DN below. Then run
|
||||
# ./dhcpd-conf-to-ldap.pl < /path-to-dhcpd-conf/dhcpd.conf > output-file
|
||||
# The output of this script will generate entries in LDIF format. You can use
|
||||
# the slapadd command to add these entries into your LDAP server. You will
|
||||
# definately want to double check that your LDAP entries are correct before
|
||||
# you load them into LDAP.
|
||||
|
||||
# This script does not do much error checking. Make sure before you run this
|
||||
# that the DHCP server doesn't give any errors about your config file
|
||||
|
||||
use Sys::Hostname;
|
||||
|
||||
my $basedn = "dc=ntelos, dc=net";
|
||||
|
||||
sub next_token
|
||||
{
|
||||
local ($lowercase) = @_;
|
||||
local ($token, $newline);
|
||||
|
||||
do
|
||||
{
|
||||
if (!defined ($line) || length ($line) == 0)
|
||||
{
|
||||
$line = <>;
|
||||
return undef if !defined ($line);
|
||||
chop $line;
|
||||
$line_number++;
|
||||
$token_number = 0;
|
||||
}
|
||||
|
||||
$line =~ s/#.*//;
|
||||
$line =~ s/^\s+//;
|
||||
$line =~ s/\s+$//;
|
||||
}
|
||||
while (length ($line) == 0);
|
||||
|
||||
if (($token, $newline) = $line =~ /^(.*?)\s+(.*)/)
|
||||
{
|
||||
$line = $newline;
|
||||
}
|
||||
else
|
||||
{
|
||||
$token = $line;
|
||||
$line = '';
|
||||
}
|
||||
$token_number++;
|
||||
|
||||
$token =~ y/[A-Z]/[a-z]/ if $lowercase;
|
||||
|
||||
return ($token);
|
||||
}
|
||||
|
||||
|
||||
sub remaining_line
|
||||
{
|
||||
local ($tmp, $str);
|
||||
|
||||
$str = "";
|
||||
while (($tmp = next_token (0)))
|
||||
{
|
||||
$str .= ' ' if !($str eq "");
|
||||
$str .= $tmp;
|
||||
last if $tmp =~ /;\s*$/;
|
||||
}
|
||||
|
||||
$str =~ s/;$//;
|
||||
return ($str);
|
||||
}
|
||||
|
||||
|
||||
sub
|
||||
add_dn_to_stack
|
||||
{
|
||||
local ($dn) = @_;
|
||||
|
||||
$current_dn = "$dn, $current_dn";
|
||||
}
|
||||
|
||||
|
||||
sub
|
||||
remove_dn_from_stack
|
||||
{
|
||||
$current_dn =~ s/^.*?,\s*//;
|
||||
}
|
||||
|
||||
|
||||
sub
|
||||
parse_error
|
||||
{
|
||||
print "Parse error on line number $line_number at token number $token_number\n";
|
||||
exit (1);
|
||||
}
|
||||
|
||||
|
||||
sub
|
||||
print_entry
|
||||
{
|
||||
return if (scalar keys %curentry == 0);
|
||||
|
||||
if (!defined ($curentry{'type'}))
|
||||
{
|
||||
$host = hostname ();
|
||||
$hostdn = "cn=$host, $basedn";
|
||||
print "dn: $hostdn\n";
|
||||
print "objectClass: top\n";
|
||||
print "objectClass: dhcpServer\n";
|
||||
print "cn: $host\n";
|
||||
print "dhcpServiceDN: $current_dn\n\n";
|
||||
|
||||
print "dn: $current_dn\n";
|
||||
print "cn: DHCP Config\n";
|
||||
print "objectClass: top\n";
|
||||
print "objectClass: dhcpService\n";
|
||||
if (defined ($curentry{'options'}))
|
||||
{
|
||||
print "objectClass: dhcpOptions\n";
|
||||
}
|
||||
print "dhcpPrimaryDN: $hostdn\n";
|
||||
}
|
||||
elsif ($curentry{'type'} eq 'subnet')
|
||||
{
|
||||
print "dn: $current_dn\n";
|
||||
print "cn: " . $curentry{'ip'} . "\n";
|
||||
print "objectClass: top\n";
|
||||
print "objectClass: dhcpSubnet\n";
|
||||
if (defined ($curentry{'options'}))
|
||||
{
|
||||
print "objectClass: dhcpOptions\n";
|
||||
}
|
||||
|
||||
print "dhcpNetMask: " . $curentry{'netmask'} . "\n";
|
||||
if (defined ($curentry{'range'}))
|
||||
{
|
||||
print "dhcpRange: " . $curentry{'range'} . "\n";
|
||||
}
|
||||
}
|
||||
elsif ($curentry{'type'} eq 'shared-network')
|
||||
{
|
||||
print "dn: $current_dn\n";
|
||||
print "cn: " . $curentry{'descr'} . "\n";
|
||||
print "objectClass: top\n";
|
||||
print "objectClass: dhcpSharedNetwork\n";
|
||||
if (defined ($curentry{'options'}))
|
||||
{
|
||||
print "objectClass: dhcpOptions\n";
|
||||
}
|
||||
}
|
||||
elsif ($curentry{'type'} eq 'group')
|
||||
{
|
||||
print "dn: $current_dn\n";
|
||||
print "cn: group\n";
|
||||
print "objectClass: top\n";
|
||||
print "objectClass: dhcpGroup\n";
|
||||
if (defined ($curentry{'options'}))
|
||||
{
|
||||
print "objectClass: dhcpOptions\n";
|
||||
}
|
||||
}
|
||||
elsif ($curentry{'type'} eq 'host')
|
||||
{
|
||||
print "dn: $current_dn\n";
|
||||
print "cn: " . $curentry{'host'} . "\n";
|
||||
print "objectClass: top\n";
|
||||
print "objectClass: dhcpHost\n";
|
||||
if (defined ($curentry{'options'}))
|
||||
{
|
||||
print "objectClass: dhcpOptions\n";
|
||||
}
|
||||
|
||||
if (defined ($curentry{'hwaddress'}))
|
||||
{
|
||||
print "dhcpHWAddress: " . $curentry{'hwaddress'} . "\n";
|
||||
}
|
||||
}
|
||||
elsif ($curentry{'type'} eq 'pool')
|
||||
{
|
||||
print "dn: $current_dn\n";
|
||||
print "cn: pool\n";
|
||||
print "objectClass: top\n";
|
||||
print "objectClass: dhcpPool\n";
|
||||
if (defined ($curentry{'options'}))
|
||||
{
|
||||
print "objectClass: dhcpOptions\n";
|
||||
}
|
||||
|
||||
if (defined ($curentry{'range'}))
|
||||
{
|
||||
print "dhcpRange: " . $curentry{'range'} . "\n";
|
||||
}
|
||||
}
|
||||
elsif ($curentry{'type'} eq 'class')
|
||||
{
|
||||
print "dn: $current_dn\n";
|
||||
print "cn: " . $curentry{'class'} . "\n";
|
||||
print "objectClass: top\n";
|
||||
print "objectClass: dhcpClass\n";
|
||||
if (defined ($curentry{'options'}))
|
||||
{
|
||||
print "objectClass: dhcpOptions\n";
|
||||
}
|
||||
}
|
||||
elsif ($curentry{'type'} eq 'subclass')
|
||||
{
|
||||
print "dn: $current_dn\n";
|
||||
print "cn: " . $curentry{'subclass'} . "\n";
|
||||
print "objectClass: top\n";
|
||||
print "objectClass: dhcpSubClass\n";
|
||||
if (defined ($curentry{'options'}))
|
||||
{
|
||||
print "objectClass: dhcpOptions\n";
|
||||
}
|
||||
print "dhcpClassData: " . $curentry{'class'} . "\n";
|
||||
}
|
||||
|
||||
if (defined ($curentry{'statements'}))
|
||||
{
|
||||
foreach $statement (@{$curentry{'statements'}})
|
||||
{
|
||||
print "dhcpStatements: $statement\n";
|
||||
}
|
||||
}
|
||||
|
||||
if (defined ($curentry{'options'}))
|
||||
{
|
||||
foreach $statement (@{$curentry{'options'}})
|
||||
{
|
||||
print "dhcpOption: $statement\n";
|
||||
}
|
||||
}
|
||||
|
||||
print "\n";
|
||||
undef (%curentry);
|
||||
}
|
||||
|
||||
|
||||
sub parse_netmask
|
||||
{
|
||||
local ($netmask) = @_;
|
||||
local ($i);
|
||||
|
||||
if ((($a, $b, $c, $d) = $netmask =~ /^(\d+)\.(\d+)\.(\d+)\.(\d+)$/) != 4)
|
||||
{
|
||||
parse_error ();
|
||||
}
|
||||
|
||||
$num = (($a & 0xff) << 24) |
|
||||
(($b & 0xff) << 16) |
|
||||
(($c & 0xff) << 8) |
|
||||
($d & 0xff);
|
||||
|
||||
for ($i=1; $i<=32 && $num & (1 << (32 - $i)); $i++)
|
||||
{
|
||||
}
|
||||
$i--;
|
||||
|
||||
return ($i);
|
||||
}
|
||||
|
||||
|
||||
sub parse_subnet
|
||||
{
|
||||
local ($ip, $tmp, $netmask);
|
||||
|
||||
print_entry () if %curentry;
|
||||
|
||||
$ip = next_token (0);
|
||||
parse_error () if !defined ($ip);
|
||||
|
||||
$tmp = next_token (1);
|
||||
parse_error () if !defined ($tmp);
|
||||
parse_error () if !($tmp eq 'netmask');
|
||||
|
||||
$tmp = next_token (0);
|
||||
parse_error () if !defined ($tmp);
|
||||
$netmask = parse_netmask ($tmp);
|
||||
|
||||
$tmp = next_token (0);
|
||||
parse_error () if !defined ($tmp);
|
||||
parse_error () if !($tmp eq '{');
|
||||
|
||||
add_dn_to_stack ("cn=$ip");
|
||||
$curentry{'type'} = 'subnet';
|
||||
$curentry{'ip'} = $ip;
|
||||
$curentry{'netmask'} = $netmask;
|
||||
}
|
||||
|
||||
|
||||
sub parse_shared_network
|
||||
{
|
||||
local ($descr, $tmp);
|
||||
|
||||
print_entry () if %curentry;
|
||||
|
||||
$descr = next_token (0);
|
||||
parse_error () if !defined ($descr);
|
||||
|
||||
$tmp = next_token (0);
|
||||
parse_error () if !defined ($tmp);
|
||||
parse_error () if !($tmp eq '{');
|
||||
|
||||
add_dn_to_stack ("cn=$descr");
|
||||
$curentry{'type'} = 'shared-network';
|
||||
$curentry{'descr'} = $descr;
|
||||
}
|
||||
|
||||
|
||||
sub parse_host
|
||||
{
|
||||
local ($descr, $tmp);
|
||||
|
||||
print_entry () if %curentry;
|
||||
|
||||
$host = next_token (0);
|
||||
parse_error () if !defined ($host);
|
||||
|
||||
$tmp = next_token (0);
|
||||
parse_error () if !defined ($tmp);
|
||||
parse_error () if !($tmp eq '{');
|
||||
|
||||
add_dn_to_stack ("cn=$host");
|
||||
$curentry{'type'} = 'host';
|
||||
$curentry{'host'} = $host;
|
||||
}
|
||||
|
||||
|
||||
sub parse_group
|
||||
{
|
||||
local ($descr, $tmp);
|
||||
|
||||
print_entry () if %curentry;
|
||||
|
||||
$tmp = next_token (0);
|
||||
parse_error () if !defined ($tmp);
|
||||
parse_error () if !($tmp eq '{');
|
||||
|
||||
add_dn_to_stack ("cn=group");
|
||||
$curentry{'type'} = 'group';
|
||||
}
|
||||
|
||||
|
||||
sub parse_pool
|
||||
{
|
||||
local ($descr, $tmp);
|
||||
|
||||
print_entry () if %curentry;
|
||||
|
||||
$tmp = next_token (0);
|
||||
parse_error () if !defined ($tmp);
|
||||
parse_error () if !($tmp eq '{');
|
||||
|
||||
add_dn_to_stack ("cn=pool");
|
||||
$curentry{'type'} = 'pool';
|
||||
}
|
||||
|
||||
|
||||
sub parse_class
|
||||
{
|
||||
local ($descr, $tmp);
|
||||
|
||||
print_entry () if %curentry;
|
||||
|
||||
$class = next_token (0);
|
||||
parse_error () if !defined ($class);
|
||||
|
||||
$tmp = next_token (0);
|
||||
parse_error () if !defined ($tmp);
|
||||
parse_error () if !($tmp eq '{');
|
||||
|
||||
$class =~ s/\"//g;
|
||||
add_dn_to_stack ("cn=$class");
|
||||
$curentry{'type'} = 'class';
|
||||
$curentry{'class'} = $class;
|
||||
}
|
||||
|
||||
|
||||
sub parse_subclass
|
||||
{
|
||||
local ($descr, $tmp);
|
||||
|
||||
print_entry () if %curentry;
|
||||
|
||||
$class = next_token (0);
|
||||
parse_error () if !defined ($class);
|
||||
|
||||
$subclass = next_token (0);
|
||||
parse_error () if !defined ($subclass);
|
||||
|
||||
$tmp = next_token (0);
|
||||
parse_error () if !defined ($tmp);
|
||||
parse_error () if !($tmp eq '{');
|
||||
|
||||
add_dn_to_stack ("cn=$subclass");
|
||||
$curentry{'type'} = 'subclass';
|
||||
$curentry{'class'} = $class;
|
||||
$curentry{'subclass'} = $subclass;
|
||||
}
|
||||
|
||||
|
||||
sub parse_hwaddress
|
||||
{
|
||||
local ($type, $hw, $tmp);
|
||||
|
||||
$type = next_token (0);
|
||||
parse_error () if !defined ($type);
|
||||
|
||||
$hw = next_token (0);
|
||||
parse_error () if !defined ($hw);
|
||||
$hw =~ s/;$//;
|
||||
|
||||
$curentry{'hwaddress'} = "$type $hw";
|
||||
}
|
||||
|
||||
|
||||
sub parse_range
|
||||
{
|
||||
local ($tmp, $str);
|
||||
|
||||
$str = remaining_line ();
|
||||
|
||||
if (!($str eq ''))
|
||||
{
|
||||
$str =~ s/;$//;
|
||||
$curentry{'range'} = $str;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
sub parse_statement
|
||||
{
|
||||
local ($token) = shift;
|
||||
local ($str);
|
||||
|
||||
if ($token eq 'option')
|
||||
{
|
||||
$str = remaining_line ();
|
||||
push (@{$curentry{'options'}}, $str);
|
||||
}
|
||||
else
|
||||
{
|
||||
$str = $token . " " . remaining_line ();
|
||||
push (@{$curentry{'statements'}}, $str);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
my $token;
|
||||
my $token_number = 0;
|
||||
my $line_number = 0;
|
||||
my %curentry;
|
||||
|
||||
$current_dn = "cn=DHCP Config, $basedn";
|
||||
$curentry{'descr'} = 'DHCP Config';
|
||||
$line = '';
|
||||
|
||||
while (($token = next_token (1)))
|
||||
{
|
||||
if ($token eq '}')
|
||||
{
|
||||
print_entry () if %curentry;
|
||||
remove_dn_from_stack ();
|
||||
}
|
||||
elsif ($token eq 'subnet')
|
||||
{
|
||||
parse_subnet ();
|
||||
next;
|
||||
}
|
||||
elsif ($token eq 'shared-network')
|
||||
{
|
||||
parse_shared_network ();
|
||||
next;
|
||||
}
|
||||
elsif ($token eq 'class')
|
||||
{
|
||||
parse_class ();
|
||||
next;
|
||||
}
|
||||
elsif ($token eq 'subclass')
|
||||
{
|
||||
parse_subclass ();
|
||||
next;
|
||||
}
|
||||
elsif ($token eq 'pool')
|
||||
{
|
||||
parse_pool ();
|
||||
next;
|
||||
}
|
||||
elsif ($token eq 'group')
|
||||
{
|
||||
parse_group ();
|
||||
next;
|
||||
}
|
||||
elsif ($token eq 'host')
|
||||
{
|
||||
parse_host ();
|
||||
next;
|
||||
}
|
||||
elsif ($token eq 'hardware')
|
||||
{
|
||||
parse_hwaddress ();
|
||||
next;
|
||||
}
|
||||
elsif ($token eq 'range')
|
||||
{
|
||||
parse_range ();
|
||||
next;
|
||||
}
|
||||
else
|
||||
{
|
||||
parse_statement ($token);
|
||||
next;
|
||||
}
|
||||
}
|
||||
|
||||
|
124
libdhcp_control.h
Normal file
124
libdhcp_control.h
Normal file
@ -0,0 +1,124 @@
|
||||
/* 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) Jason Vas Dias <jvdias@redhat.com> Red Hat Inc. May 2006
|
||||
*
|
||||
* 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 at
|
||||
* http://www.fsf.org/licensing/licenses/gpl.txt
|
||||
* and included in this software distribution as the "LICENSE" file.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
#ifndef LIBDHCP_CONTROL_H
|
||||
#define LIBDHCP_CONTROL_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
|
566
linux
Executable file
566
linux
Executable file
@ -0,0 +1,566 @@
|
||||
#!/bin/bash
|
||||
# dhclient-script for Linux. Dan Halbert, March, 1997.
|
||||
# Updated for Linux 2.[12] by Brian J. Murrell, January 1999.
|
||||
# No guarantees about this. I'm a novice at the details of Linux
|
||||
# networking.
|
||||
|
||||
# Notes:
|
||||
|
||||
# 0. This script is based on the netbsd script supplied with dhcp-970306.
|
||||
|
||||
# 1. ifconfig down apparently deletes all relevant routes and flushes
|
||||
# the arp cache, so this doesn't need to be done explicitly.
|
||||
|
||||
# 2. The alias address handling here has not been tested AT ALL.
|
||||
# I'm just going by the doc of modern Linux ip aliasing, which uses
|
||||
# notations like eth0:0, eth0:1, for each alias.
|
||||
|
||||
# 3. I have to calculate the network address, and calculate the broadcast
|
||||
# address if it is not supplied. This might be much more easily done
|
||||
# by the dhclient C code, and passed on.
|
||||
|
||||
if [ -n "${dhc_dbus}" ]; then
|
||||
/bin/dbus-send \
|
||||
--system \
|
||||
--dest=com.redhat.dhcp \
|
||||
--type=method_call \
|
||||
/com/redhat/dhcp/$interface \
|
||||
com.redhat.dhcp.set \
|
||||
'string:'"`env | /bin/egrep -v '^(PATH|SHLVL|_|PWD|dhc_dbus)\='`";
|
||||
if (( ( dhc_dbus & 31 ) == 31 )); then
|
||||
exit 0;
|
||||
fi;
|
||||
fi;
|
||||
|
||||
function save_previous() {
|
||||
if [ -e $1 ]; then
|
||||
/bin/mv $1 $1.predhclient
|
||||
else
|
||||
echo ''> $1.predhclient
|
||||
fi
|
||||
}
|
||||
|
||||
make_resolv_conf() {
|
||||
if [ "${PEERDNS}" == "no" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
if [ x$reason == xRENEW ] &&
|
||||
[ "$new_domain_name" == "$old_domain_name" ] &&
|
||||
[ "$new_domain_name_servers" == "$old_domain_name_servers" ]; then
|
||||
return;
|
||||
fi
|
||||
|
||||
if [ -n "$new_domain_name" ] || [ -n "$new_domain_name_servers" ]; then
|
||||
cp -fp /etc/resolv.conf /etc/resolv.conf.predhclient
|
||||
rscf=`mktemp /tmp/XXXXXX`;
|
||||
echo '; generated by /sbin/dhclient-script' > $rscf
|
||||
if [ -n "$SEARCH" ]; then
|
||||
echo search $SEARCH >> $rscf
|
||||
else
|
||||
if [ -n "$new_domain_name" ]; then
|
||||
echo search $new_domain_name >> $rscf
|
||||
fi
|
||||
fi
|
||||
for nameserver in $new_domain_name_servers; do
|
||||
echo nameserver $nameserver >> $rscf
|
||||
done
|
||||
change_resolv_conf $rscf
|
||||
rm -f $rscf
|
||||
fi
|
||||
}
|
||||
|
||||
# Must be used on exit. Invokes the local dhcp client exit hooks, if any.
|
||||
exit_with_hooks() {
|
||||
exit_status=$1
|
||||
if [ -f /etc/dhclient-exit-hooks ]; then
|
||||
. /etc/dhclient-exit-hooks
|
||||
fi
|
||||
# probably should do something with exit status of the local script
|
||||
exit $exit_status
|
||||
}
|
||||
|
||||
# Invoke the local dhcp client enter hooks, if they exist.
|
||||
if [ -f /etc/dhclient-enter-hooks ]; then
|
||||
exit_status=0
|
||||
. /etc/dhclient-enter-hooks
|
||||
# allow the local script to abort processing of this state
|
||||
# local script must set exit_status variable to nonzero.
|
||||
if [ $exit_status -ne 0 ]; then
|
||||
exit $exit_status
|
||||
fi
|
||||
fi
|
||||
|
||||
# Import Red Hat Linux configuration
|
||||
cd /etc/sysconfig/network-scripts;
|
||||
. /etc/sysconfig/network-scripts/network-functions
|
||||
. /etc/rc.d/init.d/functions
|
||||
|
||||
[ -f ../network ] && . ../network
|
||||
[ -f ../networking/network ] && . ../networking/network
|
||||
|
||||
CONFIG=$interface
|
||||
|
||||
need_config ${CONFIG}
|
||||
|
||||
if [ -f "${CONFIG}" ]; then
|
||||
source_config
|
||||
else
|
||||
echo $"$0: configuration for $interface not found. Continuing with defaults." >&2
|
||||
fi
|
||||
|
||||
source_config
|
||||
|
||||
release=`uname -r`
|
||||
relmajor=`echo $release |/bin/cut -f1 -d'.'`
|
||||
relminor=`echo $release |/bin/cut -f2 -d'.'`
|
||||
|
||||
# simple IP arithmetic functions:
|
||||
|
||||
function quad2num()
|
||||
{
|
||||
if [ $# -eq 4 ]; then
|
||||
let n="$1<<24|$2<<16|$3<<8|$4"
|
||||
echo $n;
|
||||
return 0;
|
||||
fi
|
||||
echo '0';
|
||||
return 1;
|
||||
}
|
||||
|
||||
function ip2num()
|
||||
{
|
||||
IFS='.' quad2num $1;
|
||||
}
|
||||
|
||||
function num2ip()
|
||||
{
|
||||
let n="$1";
|
||||
let o1='(n>>24)&0xff';
|
||||
let o2='(n>>16)&0xff';
|
||||
let o3='(n>>8)&0xff';
|
||||
let o4='n & 0xff';
|
||||
echo $o1.$o2.$o3.$o4;
|
||||
}
|
||||
|
||||
function mask()
|
||||
{
|
||||
ip=$1
|
||||
m=$2
|
||||
let ip=`IFS='.' ip2num $ip`;
|
||||
let m=`IFS='.' ip2num $m`;
|
||||
let n='ip&m';
|
||||
num2ip $n;
|
||||
}
|
||||
|
||||
function mask_bits()
|
||||
{
|
||||
ip=$1
|
||||
let ip=`IFS='.' ip2num $ip`;
|
||||
let bits=0
|
||||
for ((bit=1; '((ip&bit)==0) && (bits < 32)'; 'bit<<=1')) do
|
||||
let bits+=1
|
||||
done
|
||||
let n_bits=32-bits
|
||||
echo $n_bits
|
||||
}
|
||||
|
||||
function class_bits()
|
||||
{
|
||||
let ip=`IFS='.' ip2num $1`;
|
||||
let bits=32
|
||||
let mask='255';
|
||||
for ((i=0; i <= 3; i++, 'mask<<=8')); do
|
||||
let v='ip&mask';
|
||||
if [ "$v" -eq 0 ] ; then
|
||||
let bits-=8;
|
||||
else
|
||||
break;
|
||||
fi;
|
||||
done;
|
||||
echo $bits;
|
||||
}
|
||||
|
||||
function routerReachable()
|
||||
{ # Handle silly DHCP servers that give us a router not on our subnet:
|
||||
router=$1
|
||||
routerSubnet=`mask $router $new_subnet_mask`
|
||||
mySubnet=`mask $new_ip_address $new_subnet_mask`
|
||||
unreachable=0
|
||||
if [ "$routerSubnet" != "$mySubnet" ]; then
|
||||
unreachable=1
|
||||
if /sbin/arping -f -q -I $interface -w2 $router; then
|
||||
/sbin/ip route add ${router}/32 dev $interface
|
||||
if [ $? -eq 0 ]; then
|
||||
unreachable=0
|
||||
else
|
||||
/usr/bin/logger -p local7.notice -t "NET" "dhclient: failed to create host route for unreachable router $router not on subnet $mySubnet";
|
||||
fi
|
||||
else
|
||||
unreachable=1
|
||||
if [ -x /usr/bin/logger ]; then
|
||||
/usr/bin/logger -p local7.notice -t "NET" "dhclient: DHCP router $router is unreachable on DHCP subnet $mySubnet router subnet $routerSubnet";
|
||||
fi;
|
||||
fi;
|
||||
fi;
|
||||
return $unreachable;
|
||||
}
|
||||
|
||||
function add_default_gateway()
|
||||
{
|
||||
router=$1
|
||||
metric=''
|
||||
if [ $# -gt 1 ] && [ "$2" -gt 0 ]; then
|
||||
metric="metric $2";
|
||||
fi;
|
||||
if routerReachable $router ; then
|
||||
/sbin/ip route replace default via $router dev $interface $metric;
|
||||
if [ $? -ne 0 ]; then
|
||||
/usr/bin/logger -p local7.notice -t "NET" 'dhclient: failed to create default route: '$router dev $interface $metric;
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
fi;
|
||||
fi;
|
||||
return 1;
|
||||
}
|
||||
|
||||
function dhconfig()
|
||||
{
|
||||
if [ -z "${dhc_dbus}" ] || (( ( dhc_dbus & 2 ) != 2 )); then
|
||||
if [ x$old_ip_address != x ] && [ x$alias_ip_address != x ] && \
|
||||
[ x$alias_ip_address != x$old_ip_address ]; then
|
||||
# Possible new alias. Remove old alias.
|
||||
ifconfig $interface:0- inet 0
|
||||
fi
|
||||
|
||||
if [ x$old_ip_address != x ] && [ x$old_ip_address != x$new_ip_address ]; then
|
||||
# IP address changed. Bringing down the interface will delete all routes,
|
||||
# and clear the ARP cache.
|
||||
ifconfig $interface inet 0 down
|
||||
fi
|
||||
fi
|
||||
if [ x$reason = xBOUND ] || [ x$reason = xREBOOT ] ||
|
||||
[ x$old_ip_address != x$new_ip_address ] ||
|
||||
[ x$old_subnet_mask != x$new_subnet_mask ] ||
|
||||
[ x$new_network_number != x$new_network_number ] ||
|
||||
[ x$old_broadcast_address != x$new_broadcast_address ] ||
|
||||
[ "x$old_routers" != "x$new_routers" ] ||
|
||||
[ x$old_interface_mtu != x$new_interface_mtu ] ; then
|
||||
if [ -z "${dhc_dbus}" ] || (( ( dhc_dbus & 2 ) != 2 )); then
|
||||
ifconfig $interface inet $new_ip_address $new_subnet_arg \
|
||||
$new_broadcast_arg
|
||||
if [ -n "$new_interface_mtu" ]; then
|
||||
/sbin/ip link set $interface mtu $new_interface_mtu;
|
||||
fi;
|
||||
if [ -x /etc/dhclient-${interface}-up-hooks ]; then
|
||||
. /etc/dhclient-${interface}-up-hooks;
|
||||
elif [ -x /etc/dhclient-up-hooks ]; then
|
||||
. /etc/dhclient-up-hooks;
|
||||
fi;
|
||||
fi;
|
||||
|
||||
if [ -z "${dhc_dbus}" ] || (( ( dhc_dbus & 4 ) != 4 )); then
|
||||
prefix_bits=`mask_bits $new_subnet_mask`
|
||||
# Add a network route to the computed network address.
|
||||
if [ $relmajor -lt 2 ] || \
|
||||
( [ $relmajor -eq 2 ] && [ $relminor -eq 0 ] ); then
|
||||
/sbin/ip route replace ${new_network_number}/${prefix_bits} dev $interface
|
||||
if [ $added_old_broadcast_route -eq 1 ]; then
|
||||
/sbin/ip route del default;
|
||||
fi;
|
||||
fi;
|
||||
if [[ ( ( -z "$GATEWAYDEV" ) || ( "$GATEWAYDEV" = "$interface" ) ) && ( ( -z "$GATEWAY" ) || ( ( -n "$DHCLIENT_IGNORE_GATEWAY" ) && ( "$DHCLIENT_IGNORE_GATEWAY" = [Yy]* ) ) ) ]]; then
|
||||
metric=${METRIC:-''};
|
||||
let i=${METRIC:-0};
|
||||
default_routers=()
|
||||
for router in $new_routers; do
|
||||
added_router=0
|
||||
for r in ${default_routers[@]}; do
|
||||
if [ "$r" == "$router" ]; then
|
||||
added_router=1;
|
||||
fi;
|
||||
done
|
||||
if [ -z "$router" ] || [ "$added_router" -eq 1 ] || [ `IFS=. ip2num $router` -le 0 ] || [[ ( "$router" = "$new_broadcast_address" ) && ( "$new_subnet_mask" != "255.255.255.255" ) ]]; then
|
||||
continue;
|
||||
fi;
|
||||
default_routers=(${default_routers[@]} $router)
|
||||
add_default_gateway $router $metric;
|
||||
let i=i+1;
|
||||
metric=$i;
|
||||
done
|
||||
elif [[ ( ( -z "$GATEWAYDEV" ) || ( "$GATEWAYDEV" = "$interface" ) ) && ( -n "$GATEWAY" ) ]]; then
|
||||
routerSubnet=`mask $GATEWAY $new_subnet_mask`
|
||||
mySubnet=`mask $new_ip_address $new_subnet_mask`
|
||||
if [ "$routerSubnet" = "$mySubnet" ]; then
|
||||
/sbin/ip route replace default via $GATEWAY dev $interface
|
||||
fi;
|
||||
fi;
|
||||
# static routes
|
||||
if [ "x$new_static_routes" != x ]; then
|
||||
IFS=', ' static_routes=($new_static_routes)
|
||||
route_targets=()
|
||||
for((i=0; i<${#static_routes[@]}; i+=2)); do
|
||||
target=${static_routes[$i]}
|
||||
gateway=${static_routes[$i+1]}
|
||||
metric=''
|
||||
for t in ${route_targets[@]}; do
|
||||
if [ $t == $target ]; then
|
||||
if [ -z "$metric" ]; then
|
||||
metric=1;
|
||||
else
|
||||
((metric=metric+1));
|
||||
fi;
|
||||
fi;
|
||||
done;
|
||||
if [ -n "$metric" ]; then
|
||||
metric="metric $metric";
|
||||
fi;
|
||||
if routerReachable $gateway; then
|
||||
/sbin/ip route replace ${target}/`class_bits $target` via ${gateway} dev $interface ${metric}
|
||||
if [ $? -ne 0 ]; then
|
||||
/usr/bin/logger -p local7.notice -t 'NET' 'dhclient: failed to create static route:' ${target}/`class_bits $target` via ${gateway} dev $interface ${metric};
|
||||
else
|
||||
route_targets=(${route_targets[@]} $target);
|
||||
fi;
|
||||
fi;
|
||||
done
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
if [ -z "${dhc_dbus}" ] || (( ( dhc_dbus & 2 ) != 2 )); then
|
||||
if [ x$new_ip_address != x$alias_ip_address ] && [ x$alias_ip_address != x ];
|
||||
then
|
||||
ifconfig $interface:0- inet 0
|
||||
ifconfig $interface:0 inet $alias_ip_address $alias_subnet_arg
|
||||
/sbin/ip route replace ${alias_ip_address}/32 dev $interface:0
|
||||
fi
|
||||
fi
|
||||
if [ -z "${dhc_dbus}" ] || (( ( dhc_dbus & 1 ) != 1 )); then
|
||||
make_resolv_conf
|
||||
|
||||
if [ -n "$new_host_name" ] && need_hostname; then
|
||||
hostname $new_host_name
|
||||
fi
|
||||
fi;
|
||||
if [ -z "${dhc_dbus}" ] || (( ( dhc_dbus & 8 ) != 8 )); then
|
||||
if [ "${PEERNIS}" = no ]; then
|
||||
:
|
||||
elif [ -n "$new_nis_domain" ]; then
|
||||
domainname "$new_nis_domain"
|
||||
save_previous /etc/yp.conf
|
||||
let contents=0
|
||||
echo '# generated by /sbin/dhclient-script' > /etc/yp.conf
|
||||
if [ -n "$new_nis_servers" ]; then
|
||||
for I in $new_nis_servers; do
|
||||
echo "domain $new_nis_domain server $I" >> /etc/yp.conf
|
||||
let contents=contents+1
|
||||
done
|
||||
else
|
||||
echo "domain $new_nis_domain broadcast" >> /etc/yp.conf
|
||||
let contents=contents+1
|
||||
fi
|
||||
level=`/sbin/runlevel`
|
||||
level=${level##*\ }
|
||||
if [ "$level" = "unknown" ]; then
|
||||
level=1;
|
||||
fi
|
||||
if [ $contents -gt 0 ] && [[ "$level" = [0-6] ]] && /sbin/chkconfig --level=$level ypbind >/dev/null 2>&1 && [ -r /var/run/ypbind.pid ] && yppid=`cat /var/run/ypbind.pid` && [ -d /proc/${yppid} ] && [ "`if [ -x /sbin/busybox ]; then /sbin/busybox readlink /proc/${yppid}/exe; else echo /sbin/ypbind; fi`" = "/sbin/ypbind" ]; then
|
||||
kill -HUP $yppid;
|
||||
fi
|
||||
elif [ -n "$new_nis_servers" ]; then
|
||||
save_previous /etc/yp.conf
|
||||
echo '# generated by /sbin/dhclient-script' > /etc/yp.conf
|
||||
let contents=0
|
||||
for I in $new_nis_servers; do
|
||||
echo "ypserver $I" >> /etc/yp.conf
|
||||
let contents=contents+1
|
||||
done
|
||||
level=`/sbin/runlevel`
|
||||
level=${level##*\ }
|
||||
if [ "$level" = "unknown" ]; then
|
||||
level=1;
|
||||
fi
|
||||
if [ $contents -gt 0 ] && [[ "$level" = [0-6] ]] && /sbin/chkconfig --level=$level ypbind >/dev/null 2>&1 && [ -r /var/run/ypbind.pid ] && yppid=`cat /var/run/ypbind.pid` && [ -d /proc/${yppid} ] && [ "`if [ -x /sbin/busybox ]; then /sbin/busybox readlink /proc/${yppid}/exe; else echo /sbin/ypbind; fi`" = "/sbin/ypbind" ] ; then
|
||||
kill -HUP $yppid;
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
if [ -z "${dhc_dbus}" ] || (( ( dhc_dbus & 16 ) != 16 )); then
|
||||
if [ -n "$DHCP_TIME_OFFSET_SETS_TIMEZONE" ] && [[ "$DHCP_TIME_OFFSET_SETS_TIMEZONE" = [yY1]* ]]; then
|
||||
if [ -n "$new_time_offset" ]; then
|
||||
# DHCP option "time-offset" is requested by default and should be handled.
|
||||
# The geographical zone abbreviation cannot be determined from the GMT offset,
|
||||
# but the $ZONEINFO/Etc/GMT$offset file can be used - note: this disables DST.
|
||||
((z=new_time_offset/3600));
|
||||
((hoursWest=`printf '%+d' $z`))
|
||||
if (( $hoursWest < 0 )); then
|
||||
# tzdata treats negative 'hours west' as positive 'gmtoff' !
|
||||
((hoursWest*=-1));
|
||||
fi
|
||||
tzfile=/usr/share/zoneinfo/Etc/GMT`printf '%+d' $hoursWest`;
|
||||
if [ -e $tzfile ]; then
|
||||
/bin/mv -f /etc/localtime /etc/localtime.predhclient;
|
||||
/bin/cp -fp $tzfile /etc/localtime;
|
||||
/bin/touch /etc/localtime;
|
||||
fi;
|
||||
fi;
|
||||
fi;
|
||||
if [ "${PEERNTP}" = no ]; then
|
||||
:
|
||||
elif [ -n "$new_ntp_servers" ] && [ -e /etc/ntp.conf ]; then
|
||||
save_previous /etc/ntp.conf
|
||||
/bin/egrep -v '(^[\ \ ]*(server|fudge))|(generated by /sbin/dhclient-script)'< /etc/ntp.conf.predhclient > /etc/ntp.conf
|
||||
echo '# servers generated by /sbin/dhclient-script' >> /etc/ntp.conf
|
||||
localClocks=(`/bin/egrep '^[\ \ ]*server[\ \ ]+127\.127' /etc/ntp.conf.predhclient | while read s addr rest; do echo $addr; done`)
|
||||
localClockFudge="`/bin/egrep '^[\ \ ]*fudge[\ \ ]+127\.127' /etc/ntp.conf.predhclient`";
|
||||
for s in $new_ntp_servers ${localClocks[@]};
|
||||
do
|
||||
echo 'server '$s >> /etc/ntp.conf;
|
||||
done
|
||||
echo "$localClockFudge" >> /etc/ntp.conf;
|
||||
if [ -x /usr/bin/diff ] && /usr/bin/diff -q /etc/ntp.conf /etc/ntp.conf.predhclient >/dev/null 2>&1; then
|
||||
: ;
|
||||
else
|
||||
/sbin/service ntpd condrestart >/dev/null 2>&1
|
||||
fi;
|
||||
fi
|
||||
fi;
|
||||
}
|
||||
|
||||
if [ x$new_broadcast_address != x ] && [ x$new_subnet_mask != x ] && [ "$new_subnet_mask" != "255.255.255.255" ]; then
|
||||
new_broadcast_arg="broadcast $new_broadcast_address"
|
||||
fi
|
||||
if [ x$old_broadcast_address != x ]; then
|
||||
old_broadcast_arg="broadcast $old_broadcast_address"
|
||||
fi
|
||||
if [ x$new_subnet_mask != x ]; then
|
||||
new_subnet_arg="netmask $new_subnet_mask"
|
||||
fi
|
||||
if [ x$old_subnet_mask != x ]; then
|
||||
old_subnet_arg="netmask $old_subnet_mask"
|
||||
fi
|
||||
if [ x$alias_subnet_mask != x ]; then
|
||||
alias_subnet_arg="netmask $alias_subnet_mask"
|
||||
fi
|
||||
|
||||
if [ x$reason = xMEDIUM ]; then
|
||||
# Linux doesn't do mediums (ok, ok, media).
|
||||
exit_with_hooks 0
|
||||
fi
|
||||
|
||||
added_old_broadcast_route=0;
|
||||
if [ x$reason = xPREINIT ]; then
|
||||
if [ -z "${dhc_dbus}" ] || (( ( dhc_dbus & 2 ) != 2 )); then
|
||||
if [ x$alias_ip_address != x ]; then
|
||||
# Bring down alias interface. Its routes will disappear too.
|
||||
ifconfig $interface:0- inet 0
|
||||
fi
|
||||
if [ x$keep_old_ip = xyes ]; then
|
||||
ifconfig $interface up
|
||||
elif [ $relmajor -lt 2 ] || ( [ $relmajor -eq 2 ] && [ $relminor -eq 0 ] ) then
|
||||
ifconfig $interface inet 0.0.0.0 netmask 0.0.0.0 \
|
||||
broadcast 255.255.255.255 up
|
||||
# Add route to make broadcast work. Do not omit netmask.
|
||||
/sbin/ip route replace default dev $interface && added_old_broadcast_route=1;
|
||||
else
|
||||
ifconfig $interface 0 up
|
||||
fi
|
||||
|
||||
# We need to give the kernel some time to get the interface up.
|
||||
# sleep 1
|
||||
# I don't think this is necessary with modern kernels - no problems found during testing -
|
||||
# JVD, 2005-06-17
|
||||
# but just in case:
|
||||
if [ -n "$DHCLIENT_DELAY" ] && [ "$DHCLIENT_DELAY" -gt 0 ] ; then
|
||||
sleep $DHCLIENT_DELAY;
|
||||
fi;
|
||||
exit_with_hooks 0
|
||||
fi;
|
||||
fi
|
||||
|
||||
if [ x$reason = xARPCHECK ] || [ x$reason = xARPSEND ]; then
|
||||
if [ -z "$new_ip_address" ] || [ -z "$interface" ] || /sbin/arping -q -f -c 2 -w 3 -D -I ${interface} ${new_ip_address}; then
|
||||
exit_with_hooks 0
|
||||
else
|
||||
exit_with_hooks 1
|
||||
fi;
|
||||
fi
|
||||
|
||||
if [ x$reason = xBOUND ] || [ x$reason = xRENEW ] || \
|
||||
[ x$reason = xREBIND ] || [ x$reason = xREBOOT ]; then
|
||||
dhconfig ;
|
||||
exit_with_hooks 0
|
||||
fi
|
||||
|
||||
if [ x$reason = xEXPIRE ] || [ x$reason = xFAIL ] || [ x$reason = xRELEASE ] \
|
||||
|| [ x$reason = xSTOP ]; then
|
||||
if [ -f /etc/resolv.conf.predhclient ]; then
|
||||
change_resolv_conf /etc/resolv.conf.predhclient
|
||||
rm -f /etc/resolv.conf.predhclient
|
||||
fi
|
||||
if [ -n "$DHCP_TIME_OFFSET_SETS_TIMEZONE" ] && [[ "$DHCP_TIME_OFFSET_SETS_TIMEZONE" = [yY1]* ]]; then
|
||||
if [ -e /etc/localtime.predhclient ]; then
|
||||
/bin/rm -f /etc/localtime
|
||||
/bin/mv -f /etc/localtime.predhclient /etc/localtime;
|
||||
/bin/touch /etc/localtime;
|
||||
fi;
|
||||
fi;
|
||||
if [ -f /etc/ntp.conf.predhclient ]; then
|
||||
/bin/rm -f /etc/ntp.conf
|
||||
/bin/mv -f /etc/ntp.conf.predhclient /etc/ntp.conf
|
||||
service ntpd condrestart >/dev/null 2>&1
|
||||
fi
|
||||
if [ -f /etc/yp.conf.predhclient ]; then
|
||||
/bin/rm -f /etc/yp.conf
|
||||
/bin/mv -f /etc/yp.conf.predhclient /etc/yp.conf
|
||||
level=`/sbin/runlevel`
|
||||
level=${level##*\ }
|
||||
if [ "$level" = "unknown" ]; then
|
||||
level=1;
|
||||
fi
|
||||
if [[ "$level" = [0-6] ]] && /sbin/chkconfig --level=$level ypbind >/dev/null 2>&1 && [ -r /var/run/ypbind.pid ] && yppid=`cat /var/run/ypbind.pid` && [ -d /proc/${yppid} ] && [ "`if [ -x /sbin/busybox ]; then /sbin/busybox readlink /proc/${yppid}/exe; else echo /sbin/ypbind; fi`" = "/sbin/ypbind" ] ; then
|
||||
kill -HUP $yppid;
|
||||
fi
|
||||
fi
|
||||
if [ -x /etc/dhclient-${interface}-down-hooks ]; then
|
||||
. /etc/dhclient-${interface}-down-hooks;
|
||||
elif [ -x /etc/dhclient-down-hooks ]; then
|
||||
. /etc/dhclient-down-hooks;
|
||||
fi;
|
||||
if [ x$alias_ip_address != x ]; then
|
||||
# Turn off alias interface.
|
||||
ifconfig $interface:0- inet 0
|
||||
fi
|
||||
if [ x$old_ip_address != x ]; then
|
||||
# Shut down interface, which will delete routes and clear arp cache.
|
||||
ifconfig $interface inet 0 down
|
||||
fi
|
||||
if [ x$alias_ip_address != x ]; then
|
||||
ifconfig $interface:0 inet $alias_ip_address $alias_subnet_arg
|
||||
/sbin/ip route replace ${alias_ip_address}/32 $interface:0
|
||||
fi
|
||||
exit_with_hooks 0
|
||||
fi
|
||||
|
||||
if [ x$reason = xTIMEOUT ] && [ "x$new_routers" != 'x' ]; then
|
||||
if [ -z "${dhc_dbus}" ] || (( ( dhc_dbus & 2 ) != 2 )); then
|
||||
if [ x$alias_ip_address != x ]; then
|
||||
ifconfig $interface:0- inet 0
|
||||
fi
|
||||
ifconfig $interface inet $new_ip_address $new_subnet_arg \
|
||||
$new_broadcast_arg
|
||||
fi;
|
||||
set $new_routers
|
||||
if ping -q -c 1 -w 10 -I $interface $1; then
|
||||
dhconfig ;
|
||||
exit_with_hooks 0
|
||||
fi
|
||||
if [ -z "${dhc_dbus}" ] || (( ( dhc_dbus & 2 ) != 2 )); then
|
||||
ifconfig $interface inet 0 down
|
||||
fi;
|
||||
exit_with_hooks 1
|
||||
elif [ x$reason = xTIMEOUT ]; then
|
||||
exit_with_hooks 1
|
||||
fi
|
||||
exit_with_hooks 0
|
Loading…
Reference in New Issue
Block a user