Automatic import for version 4.2.3

This commit is contained in:
Rosa 2012-02-01 18:09:36 +04:00
parent a782778d60
commit 20c82f51a1
21 changed files with 842 additions and 442 deletions

View file

@ -1,3 +1,3 @@
sources:
"dhcp-4.2.1-P1.tar.gz": 7767019313b4128357054a1eb053c66799831dd6
"dhcp-4.2.3-P2.tar.gz": 6ce113d8e6301343b66d4d71be59a3c34805378d
"dhcp-dynamic-dns-examples.tar.bz2": d33980aad3e0380fc89f8346ab37786d39157696

View file

@ -1,51 +0,0 @@
diff -p -up dhcp-4.1.1/common/discover.c.ipv6_not_fatal dhcp-4.1.1/common/discover.c
--- dhcp-4.1.1/common/discover.c.ipv6_not_fatal 2009-09-29 16:44:49.000000000 -0300
+++ dhcp-4.1.1/common/discover.c 2010-02-25 11:35:34.000000000 -0300
@@ -444,15 +444,19 @@ begin_iface_scan(struct iface_conf_list
#ifdef DHCPv6
if (local_family == AF_INET6) {
- ifaces->fp6 = fopen("/proc/net/if_inet6", "r");
- if (ifaces->fp6 == NULL) {
- log_error("Error opening '/proc/net/if_inet6' to "
- "list IPv6 interfaces; %m");
- close(ifaces->sock);
- ifaces->sock = -1;
- fclose(ifaces->fp);
- ifaces->fp = NULL;
- return 0;
+ if (!access("/proc/net/if_inet6", R_OK)) {
+ ifaces->fp6 = fopen("/proc/net/if_inet6", "r");
+ if (ifaces->fp6 == NULL) {
+ log_error("Error opening '/proc/net/if_inet6' to "
+ "list IPv6 interfaces; %m");
+ close(ifaces->sock);
+ ifaces->sock = -1;
+ fclose(ifaces->fp);
+ ifaces->fp = NULL;
+ return 0;
+ }
+ } else {
+ ifaces->fp6 = NULL;
}
}
#endif
@@ -721,7 +725,7 @@ next_iface(struct iface_info *info, int
return 1;
}
#ifdef DHCPv6
- if (!(*err)) {
+ if (!(*err) && ifaces->fp6) {
if (local_family == AF_INET6)
return next_iface6(info, err, ifaces);
}
@@ -740,7 +744,8 @@ end_iface_scan(struct iface_conf_list *i
ifaces->sock = -1;
#ifdef DHCPv6
if (local_family == AF_INET6) {
- fclose(ifaces->fp6);
+ if (ifaces->fp6)
+ fclose(ifaces->fp6);
ifaces->fp6 = NULL;
}
#endif

View file

@ -1,17 +0,0 @@
--- client/dhclient.c 2010/04/28 19:13:43 1.1
+++ client/dhclient.c 2010/04/28 19:17:01
@@ -594,9 +594,12 @@
else {
client->state = S_INIT;
/* Set up a timeout to start the
- * initialization process.
+ * initialization process,
+ * _immediately_, as agreed but never
+ * applied by the ISC upstream
+ https://lists.isc.org/mailman/htdig/dhcp-users/2006-June/thread.html#928
*/
- tv.tv_sec = cur_time + random() % 5;
+ tv.tv_sec = cur_time - 1;
tv.tv_usec = 0;
add_timeout(&tv, state_reboot,
client, 0, 0);

View file

@ -0,0 +1,14 @@
diff -up dhcp-4.2.0/common/dispatch.c.dracut dhcp-4.2.0/common/dispatch.c
--- dhcp-4.2.0/common/dispatch.c.dracut 2010-06-01 19:29:59.000000000 +0200
+++ dhcp-4.2.0/common/dispatch.c 2010-07-21 16:10:09.000000000 +0200
@@ -189,6 +189,10 @@ void add_timeout (when, where, what, ref
isc_interval_t interval;
isc_time_t expires;
+ if (when == NULL) {
+ return;
+ }
+
/* See if this timeout supersedes an existing timeout. */
t = (struct timeout *)0;
for (q = timeouts; q; q = q->next) {

View file

@ -0,0 +1,94 @@
diff -up dhcp-4.2.1b1/common/dispatch.c.64-bit_lease_parse dhcp-4.2.1b1/common/dispatch.c
diff -up dhcp-4.2.1b1/common/parse.c.64-bit_lease_parse dhcp-4.2.1b1/common/parse.c
--- dhcp-4.2.1b1/common/parse.c.64-bit_lease_parse 2010-12-30 00:01:42.000000000 +0100
+++ dhcp-4.2.1b1/common/parse.c 2011-01-28 08:01:10.000000000 +0100
@@ -909,8 +909,8 @@ TIME
parse_date_core(cfile)
struct parse *cfile;
{
- int guess;
- int tzoff, wday, year, mon, mday, hour, min, sec;
+ TIME guess;
+ long int tzoff, wday, year, mon, mday, hour, min, sec;
const char *val;
enum dhcp_token token;
static int months[11] = { 31, 59, 90, 120, 151, 181,
@@ -936,7 +936,7 @@ parse_date_core(cfile)
}
token = next_token(&val, NULL, cfile); /* consume number */
- guess = atoi(val);
+ guess = atol(val);
return((TIME)guess);
}
@@ -948,7 +948,7 @@ parse_date_core(cfile)
return((TIME)0);
}
token = next_token(&val, NULL, cfile); /* consume day of week */
- wday = atoi(val);
+ wday = atol(val);
/* Year... */
token = peek_token(&val, NULL, cfile);
@@ -964,7 +964,7 @@ parse_date_core(cfile)
somebody invents a time machine, I think we can safely disregard
it. This actually works around a stupid Y2K bug that was present
in a very early beta release of dhcpd. */
- year = atoi(val);
+ year = atol(val);
if (year > 1900)
year -= 1900;
@@ -988,7 +988,7 @@ parse_date_core(cfile)
return((TIME)0);
}
token = next_token(&val, NULL, cfile); /* consume month */
- mon = atoi(val) - 1;
+ mon = atol(val) - 1;
/* Slash separating month from day... */
token = peek_token(&val, NULL, cfile);
@@ -1010,7 +1010,7 @@ parse_date_core(cfile)
return((TIME)0);
}
token = next_token(&val, NULL, cfile); /* consume day of month */
- mday = atoi(val);
+ mday = atol(val);
/* Hour... */
token = peek_token(&val, NULL, cfile);
@@ -1021,7 +1021,7 @@ parse_date_core(cfile)
return((TIME)0);
}
token = next_token(&val, NULL, cfile); /* consume hour */
- hour = atoi(val);
+ hour = atol(val);
/* Colon separating hour from minute... */
token = peek_token(&val, NULL, cfile);
@@ -1043,7 +1043,7 @@ parse_date_core(cfile)
return((TIME)0);
}
token = next_token(&val, NULL, cfile); /* consume minute */
- min = atoi(val);
+ min = atol(val);
/* Colon separating minute from second... */
token = peek_token(&val, NULL, cfile);
@@ -1065,13 +1065,13 @@ parse_date_core(cfile)
return((TIME)0);
}
token = next_token(&val, NULL, cfile); /* consume second */
- sec = atoi(val);
+ sec = atol(val);
tzoff = 0;
token = peek_token(&val, NULL, cfile);
if (token == NUMBER) {
token = next_token(&val, NULL, cfile); /* consume tzoff */
- tzoff = atoi(val);
+ tzoff = atol(val);
} else if (token != SEMI) {
token = next_token(&val, NULL, cfile);
parse_warn(cfile,

View file

@ -1,59 +0,0 @@
diff -Naurp dhcp-4.2.1-P1/common/discover.c dhcp-4.2.1-P1.oden/common/discover.c
--- dhcp-4.2.1-P1/common/discover.c 2011-08-18 12:58:40.883411562 +0200
+++ dhcp-4.2.1-P1.oden/common/discover.c 2011-08-18 12:55:47.002338724 +0200
@@ -1391,12 +1391,16 @@ isc_result_t got_one (h)
if (result == 0)
return ISC_R_UNEXPECTED;
- /* If we didn't at least get the fixed portion of the BOOTP
- packet, drop the packet. We're allowing packets with no
- sname or filename, because we're aware of at least one
- client that sends such packets, but this definitely falls
- into the category of being forgiving. */
- if (result < DHCP_FIXED_NON_UDP - DHCP_SNAME_LEN - DHCP_FILE_LEN)
+ /*
+ * If we didn't at least get the fixed portion of the BOOTP
+ * packet, drop the packet.
+ * Previously we allowed packets with no sname or filename
+ * as we were aware of at least one client that did. But
+ * a bug caused short packets to not work and nobody has
+ * complained, it seems rational to tighten up that
+ * restriction.
+ */
+ if (result < DHCP_FIXED_NON_UDP)
return ISC_R_UNEXPECTED;
if (bootp_packet_handler) {
diff -Naurp dhcp-4.2.1-P1/common/options.c dhcp-4.2.1-P1.oden/common/options.c
--- dhcp-4.2.1-P1/common/options.c 2011-03-24 22:57:13.000000000 +0100
+++ dhcp-4.2.1-P1.oden/common/options.c 2011-08-18 12:55:47.003338734 +0200
@@ -592,8 +592,8 @@ cons_options(struct packet *inpacket, st
} else if (bootpp) {
mb_size = 64;
if (inpacket != NULL &&
- (inpacket->packet_length - DHCP_FIXED_LEN >= 64))
- mb_size = inpacket->packet_length - DHCP_FIXED_LEN;
+ (inpacket->packet_length >= 64 + DHCP_FIXED_NON_UDP))
+ mb_size = inpacket->packet_length - DHCP_FIXED_NON_UDP;
} else
mb_size = DHCP_MIN_OPTION_LEN;
diff -Naurp dhcp-4.2.1-P1/server/dhcp.c dhcp-4.2.1-P1.oden/server/dhcp.c
--- dhcp-4.2.1-P1/server/dhcp.c 2010-09-09 08:52:37.000000000 +0200
+++ dhcp-4.2.1-P1.oden/server/dhcp.c 2011-08-18 12:57:53.156117387 +0200
@@ -2336,6 +2336,7 @@ void ack_lease (packet, lease, offer, wh
* giaddr.
*/
if (!packet->agent_options_stashed &&
+ (packet->options != NULL) &&
packet->options->universe_count > agent_universe.index &&
packet->options->universes[agent_universe.index] != NULL) {
oc = lookup_option (&server_universe, state -> options,
@@ -4429,6 +4430,7 @@ maybe_return_agent_options(struct packet
* by the user into the new state, not just give up.
*/
if (!packet->agent_options_stashed &&
+ (packet->options != NULL) &&
packet->options->universe_count > agent_universe.index &&
packet->options->universes[agent_universe.index] != NULL &&
(options->universe_count <= agent_universe.index ||

View file

@ -1,11 +0,0 @@
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (GNU/Linux)
iQEVAwUATZoM/dgRtT8Le64AAQoHqQf/dRI18soyGYHZwP868cMk4mZsTThTPCul
8WRfxQNjC93fRSrCeANdBeUOEjKnGbDyeAMS4gJHP4MnRywWDKvlKNjEhFNvoD4B
bKRAXTsvYjR19IwMmbjwexI7XAUbD208FiNvynvvjfKbnkiDnb4bJMzea2y/RGYO
RfNJm4SR4P4u4csuY9uG4CaD4z+3CZkCKX00l3oN3SHlkLfntPm/VUbpILtt77wQ
KH/nYaiglyt+SkFEevDMjvW6+04ZQ//tDYuSIOK0LZJBrkspAOMW8lWProZPl2oX
fOI+OLQHAavei1qber2A1Tqj1JC3BRftX6stuMbfTWGj4RYZmhHMNw==
=cijx
-----END PGP SIGNATURE-----

View file

@ -1,7 +1,7 @@
diff -p -up dhcp-4.1.1/client/dhclient.c.not_a_string dhcp-4.1.1/client/dhclient.c
--- dhcp-4.1.1/client/dhclient.c.not_a_string 2010-01-07 19:47:40.000000000 -0200
+++ dhcp-4.1.1/client/dhclient.c 2010-02-25 11:30:19.000000000 -0300
@@ -381,9 +381,9 @@ main(int argc, char **argv) {
diff -Naur -x '*.orig' dhcp-4.2.2/client/dhclient.c dhcp-4.2.2-fix-format-errors/client/dhclient.c
--- dhcp-4.2.2/client/dhclient.c 2011-07-01 13:58:53.000000000 +0200
+++ dhcp-4.2.2-fix-format-errors/client/dhclient.c 2011-08-29 19:08:55.560183457 +0200
@@ -420,9 +420,9 @@
if (!quiet) {
log_info("%s %s", message, PACKAGE_VERSION);
@ -14,7 +14,7 @@ diff -p -up dhcp-4.1.1/client/dhclient.c.not_a_string dhcp-4.1.1/client/dhclient
log_info("%s", "");
} else {
log_perror = 0;
@@ -647,9 +647,9 @@ main(int argc, char **argv) {
@@ -701,9 +701,9 @@
static void usage()
{
log_info("%s %s", message, PACKAGE_VERSION);
@ -25,12 +25,12 @@ diff -p -up dhcp-4.1.1/client/dhclient.c.not_a_string dhcp-4.1.1/client/dhclient
+ log_info("%s", arr);
+ log_info("%s", url);
log_error("Usage: dhclient %s %s",
#ifdef DHCPv6
diff -p -up dhcp-4.1.1/relay/dhcrelay.c.not_a_string dhcp-4.1.1/relay/dhcrelay.c
--- dhcp-4.1.1/relay/dhcrelay.c.not_a_string 2010-01-07 19:48:02.000000000 -0200
+++ dhcp-4.1.1/relay/dhcrelay.c 2010-02-25 11:30:22.000000000 -0300
@@ -403,9 +403,9 @@ main(int argc, char **argv) {
log_fatal("Usage: dhclient "
diff -Naur -x '*.orig' dhcp-4.2.2/relay/dhcrelay.c dhcp-4.2.2-fix-format-errors/relay/dhcrelay.c
--- dhcp-4.2.2/relay/dhcrelay.c 2011-05-10 15:07:37.000000000 +0200
+++ dhcp-4.2.2-fix-format-errors/relay/dhcrelay.c 2011-08-29 19:08:55.561183444 +0200
@@ -428,9 +428,9 @@
if (!quiet) {
log_info("%s %s", message, PACKAGE_VERSION);
@ -43,10 +43,10 @@ diff -p -up dhcp-4.1.1/relay/dhcrelay.c.not_a_string dhcp-4.1.1/relay/dhcrelay.c
} else {
quiet = 0;
log_perror = 0;
diff -p -up dhcp-4.1.1/server/dhcpd.c.not_a_string dhcp-4.1.1/server/dhcpd.c
--- dhcp-4.1.1/server/dhcpd.c.not_a_string 2010-02-25 11:29:56.000000000 -0300
+++ dhcp-4.1.1/server/dhcpd.c 2010-02-25 11:30:22.000000000 -0300
@@ -459,9 +459,9 @@ main(int argc, char **argv) {
diff -Naur -x '*.orig' dhcp-4.2.2/server/dhcpd.c dhcp-4.2.2-fix-format-errors/server/dhcpd.c
--- dhcp-4.2.2/server/dhcpd.c 2011-04-21 16:08:15.000000000 +0200
+++ dhcp-4.2.2-fix-format-errors/server/dhcpd.c 2011-08-29 19:08:55.563183419 +0200
@@ -474,9 +474,9 @@
if (!quiet) {
log_info("%s %s", message, PACKAGE_VERSION);
@ -59,7 +59,7 @@ diff -p -up dhcp-4.1.1/server/dhcpd.c.not_a_string dhcp-4.1.1/server/dhcpd.c
} else {
quiet = 0;
log_perror = 0;
@@ -1061,9 +1061,9 @@ void postconf_initialization (int quiet)
@@ -1096,9 +1096,9 @@
log_perror = 0;
log_info("%s %s",
message, PACKAGE_VERSION);
@ -72,7 +72,7 @@ diff -p -up dhcp-4.1.1/server/dhcpd.c.not_a_string dhcp-4.1.1/server/dhcpd.c
log_perror = tmp;
}
} else
@@ -1170,8 +1170,8 @@ void postdb_startup (void)
@@ -1205,8 +1205,8 @@
static void
usage(void) {
log_info("%s %s", message, PACKAGE_VERSION);

View file

@ -1,6 +1,6 @@
diff -p -up dhcp-4.1.1/client/scripts/linux.ifup dhcp-4.1.1/client/scripts/linux
--- dhcp-4.1.1/client/scripts/linux.ifup 2009-04-21 11:21:09.000000000 -0300
+++ dhcp-4.1.1/client/scripts/linux 2010-02-25 11:26:32.000000000 -0300
diff -Naur -x '*~' -x '*.orig' -x '*.rej' dhcp-4.2.2/client/scripts/linux dhcp-4.2.2-ifup/client/scripts/linux
--- dhcp-4.2.2/client/scripts/linux 2011-05-18 22:01:54.000000000 +0200
+++ dhcp-4.2.2-ifup/client/scripts/linux 2011-08-29 19:07:58.722894019 +0200
@@ -1,8 +1,11 @@
#!/bin/bash
-# dhclient-script for Linux. Dan Halbert, March, 1997.
@ -17,7 +17,7 @@ diff -p -up dhcp-4.1.1/client/scripts/linux.ifup dhcp-4.1.1/client/scripts/linux
# Notes:
@@ -26,35 +29,46 @@
@@ -26,28 +29,35 @@
ip=/sbin/ip
make_resolv_conf() {
@ -54,7 +54,7 @@ diff -p -up dhcp-4.1.1/client/scripts/linux.ifup dhcp-4.1.1/client/scripts/linux
elif [ "x${new_dhcp6_name_servers}" != x ] ; then
- cat /dev/null > /etc/resolv.conf.dhclient6
- chmod 644 /etc/resolv.conf.dhclient6
-
- if [ "x${new_dhcp6_domain_search}" != x ] ; then
- echo search ${new_dhcp6_domain_search} >> /etc/resolv.conf.dhclient6
+ if [ -n "$DOMAIN" ]; then
@ -63,21 +63,25 @@ diff -p -up dhcp-4.1.1/client/scripts/linux.ifup dhcp-4.1.1/client/scripts/linux
+ elif [ "x${new_dhcp6_domain_search}" != x ] ; then
+ d="search ${new_dhcp6_domain_search}"
fi
shopt -s nocasematch
for nameserver in ${new_dhcp6_name_servers} ; do
- echo nameserver ${nameserver} >> /etc/resolv.conf.dhclient6
+ ns="$ns"$'\n'"nameserver ${nameserver}"
@@ -59,11 +69,13 @@
else
zone_id=
fi
- echo nameserver ${nameserver}$zone_id >> /etc/resolv.conf.dhclient6
+ ns="$ns"$'\n'"nameserver ${nameserver}$zone_id"
done
shopt -u nocasematch
+ fi
- mv /etc/resolv.conf.dhclient6 /etc/resolv.conf
+ if [ -n "$d" -o -n "$ns" ]; then
+ change_resolv_conf "$d" "$ns"
fi
+
}
# Must be used on exit. Invokes the local dhcp client exit hooks, if any.
@@ -78,6 +92,25 @@ if [ -f /etc/dhclient-enter-hooks ]; the
@@ -88,6 +100,25 @@
fi
fi
@ -103,7 +107,7 @@ diff -p -up dhcp-4.1.1/client/scripts/linux.ifup dhcp-4.1.1/client/scripts/linux
###
### DHCPv4 Handlers
###
@@ -128,15 +161,6 @@ fi
@@ -138,15 +169,6 @@
if [ x$reason = xBOUND ] || [ x$reason = xRENEW ] || \
[ x$reason = xREBIND ] || [ x$reason = xREBOOT ]; then
@ -119,7 +123,7 @@ diff -p -up dhcp-4.1.1/client/scripts/linux.ifup dhcp-4.1.1/client/scripts/linux
if [ x$old_ip_address != x ] && [ x$alias_ip_address != x ] && \
[ x$alias_ip_address != x$old_ip_address ]; then
@@ -155,12 +179,14 @@ if [ x$reason = xBOUND ] || [ x$reason =
@@ -165,12 +187,14 @@
ifconfig $interface inet $new_ip_address $new_subnet_arg \
$new_broadcast_arg $mtu_arg
# Add a network route to the computed network address.
@ -131,10 +135,10 @@ diff -p -up dhcp-4.1.1/client/scripts/linux.ifup dhcp-4.1.1/client/scripts/linux
route add default gw $router $metric_arg dev $interface
done
+ fi
fi
if [ x$new_ip_address != x$alias_ip_address ] && [ x$alias_ip_address != x ];
then
@@ -168,7 +194,25 @@ if [ x$reason = xBOUND ] || [ x$reason =
else
# we haven't changed the address, have we changed other options
# that we wish to update?
@@ -193,7 +217,25 @@
ifconfig $interface:0 inet $alias_ip_address $alias_subnet_arg
route add -host $alias_ip_address $interface:0
fi
@ -161,7 +165,7 @@ diff -p -up dhcp-4.1.1/client/scripts/linux.ifup dhcp-4.1.1/client/scripts/linux
exit_with_hooks 0
fi
@@ -202,13 +246,17 @@ if [ x$reason = xTIMEOUT ]; then
@@ -227,13 +269,17 @@
ifconfig $interface:0 inet $alias_ip_address $alias_subnet_arg
route add -host $alias_ip_address dev $interface:0
fi

View file

@ -0,0 +1,40 @@
diff -Naur -x '*~' -x '*.rej' -x '*.orig' dhcp-4.2.2/common/discover.c dhcp-4.2.2-missing-ipv6-not-fatal/common/discover.c
--- dhcp-4.2.2/common/discover.c 2011-07-20 00:22:48.000000000 +0200
+++ dhcp-4.2.2-missing-ipv6-not-fatal/common/discover.c 2011-09-12 13:33:04.300509236 +0200
@@ -455,7 +455,7 @@
}
#ifdef DHCPv6
- if (local_family == AF_INET6) {
+ if ((local_family == AF_INET6) && !access("/proc/net/if_inet6", R_OK)) {
ifaces->fp6 = fopen("/proc/net/if_inet6", "r");
if (ifaces->fp6 == NULL) {
log_error("Error opening '/proc/net/if_inet6' to "
@@ -466,6 +466,8 @@
ifaces->fp = NULL;
return 0;
}
+ } else {
+ ifaces->fp6 = NULL;
}
#endif
@@ -733,7 +735,7 @@
return 1;
}
#ifdef DHCPv6
- if (!(*err)) {
+ if (!(*err) && ifaces->fp6) {
if (local_family == AF_INET6)
return next_iface6(info, err, ifaces);
}
@@ -752,7 +754,8 @@
ifaces->sock = -1;
#ifdef DHCPv6
if (local_family == AF_INET6) {
- fclose(ifaces->fp6);
+ if (ifaces->fp6)
+ fclose(ifaces->fp6);
ifaces->fp6 = NULL;
}
#endif

View file

@ -0,0 +1,249 @@
diff -up dhcp-4.2.2b1/common/bpf.c.xen dhcp-4.2.2b1/common/bpf.c
--- dhcp-4.2.2b1/common/bpf.c.xen 2009-11-20 02:48:59.000000000 +0100
+++ dhcp-4.2.2b1/common/bpf.c 2011-07-01 14:00:16.936959001 +0200
@@ -485,7 +485,7 @@ ssize_t receive_packet (interface, buf,
offset = decode_udp_ip_header (interface,
interface -> rbuf,
interface -> rbuf_offset,
- from, hdr.bh_caplen, &paylen);
+ from, hdr.bh_caplen, &paylen, 0);
/* If the IP or UDP checksum was bad, skip the packet... */
if (offset < 0) {
diff -up dhcp-4.2.2b1/common/dlpi.c.xen dhcp-4.2.2b1/common/dlpi.c
--- dhcp-4.2.2b1/common/dlpi.c.xen 2011-05-11 16:20:59.000000000 +0200
+++ dhcp-4.2.2b1/common/dlpi.c 2011-07-01 14:00:16.937958997 +0200
@@ -693,7 +693,7 @@ ssize_t receive_packet (interface, buf,
length -= offset;
#endif
offset = decode_udp_ip_header (interface, dbuf, bufix,
- from, length, &paylen);
+ from, length, &paylen, 0);
/*
* If the IP or UDP checksum was bad, skip the packet...
diff -up dhcp-4.2.2b1/common/lpf.c.xen dhcp-4.2.2b1/common/lpf.c
--- dhcp-4.2.2b1/common/lpf.c.xen 2011-05-10 16:38:58.000000000 +0200
+++ dhcp-4.2.2b1/common/lpf.c 2011-07-01 14:11:24.725748028 +0200
@@ -29,19 +29,33 @@
#include "dhcpd.h"
#if defined (USE_LPF_SEND) || defined (USE_LPF_RECEIVE)
#include <sys/ioctl.h>
+#include <sys/socket.h>
#include <sys/uio.h>
#include <errno.h>
#include <asm/types.h>
#include <linux/filter.h>
#include <linux/if_ether.h>
+#include <linux/if_packet.h>
#include <netinet/in_systm.h>
-#include <net/if_packet.h>
#include "includes/netinet/ip.h"
#include "includes/netinet/udp.h"
#include "includes/netinet/if_ether.h"
#include <net/if.h>
+#ifndef PACKET_AUXDATA
+#define PACKET_AUXDATA 8
+
+struct tpacket_auxdata
+{
+ __u32 tp_status;
+ __u32 tp_len;
+ __u32 tp_snaplen;
+ __u16 tp_mac;
+ __u16 tp_net;
+};
+#endif
+
/* Reinitializes the specified interface after an address change. This
is not required for packet-filter APIs. */
@@ -67,10 +81,14 @@ int if_register_lpf (info)
struct interface_info *info;
{
int sock;
- struct sockaddr sa;
+ union {
+ struct sockaddr_ll ll;
+ struct sockaddr common;
+ } sa;
+ struct ifreq ifr;
/* Make an LPF socket. */
- if ((sock = socket(PF_PACKET, SOCK_PACKET,
+ if ((sock = socket(PF_PACKET, SOCK_RAW,
htons((short)ETH_P_ALL))) < 0) {
if (errno == ENOPROTOOPT || errno == EPROTONOSUPPORT ||
errno == ESOCKTNOSUPPORT || errno == EPFNOSUPPORT ||
@@ -85,11 +103,17 @@ int if_register_lpf (info)
log_fatal ("Open a socket for LPF: %m");
}
+ memset (&ifr, 0, sizeof ifr);
+ strncpy (ifr.ifr_name, (const char *)info -> ifp, sizeof ifr.ifr_name);
+ ifr.ifr_name[IFNAMSIZ-1] = '\0';
+ 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) {
@@ -171,9 +195,18 @@ static void lpf_gen_filter_setup (struct
void if_register_receive (info)
struct interface_info *info;
{
+ int val;
+
/* Open a LPF device and hang it on this interface... */
info -> rfdesc = if_register_lpf (info);
+ val = 1;
+ if (setsockopt (info -> rfdesc, SOL_PACKET, PACKET_AUXDATA, &val,
+ sizeof val) < 0) {
+ if (errno != ENOPROTOOPT)
+ log_fatal ("Failed to set auxiliary packet data: %m");
+ }
+
#if defined (HAVE_TR_SUPPORT)
if (info -> hw_address.hbuf [0] == HTYPE_IEEE802)
lpf_tr_filter_setup (info);
@@ -295,7 +328,6 @@ ssize_t send_packet (interface, packet,
double hh [16];
double ih [1536 / sizeof (double)];
unsigned char *buf = (unsigned char *)ih;
- struct sockaddr_pkt sa;
int result;
int fudge;
@@ -316,17 +348,7 @@ ssize_t send_packet (interface, packet,
(unsigned char *)raw, len);
memcpy (buf + ibufp, raw, len);
- /* For some reason, SOCK_PACKET sockets can't be connected,
- so we have to do a sentdo every time. */
- memset (&sa, 0, sizeof sa);
- sa.spkt_family = AF_PACKET;
- strncpy ((char *)sa.spkt_device,
- (const char *)interface -> ifp, sizeof sa.spkt_device);
- sa.spkt_protocol = htons(ETH_P_IP);
-
- result = sendto (interface -> wfdesc,
- buf + fudge, ibufp + len - fudge, 0,
- (const struct sockaddr *)&sa, sizeof sa);
+ result = write (interface -> wfdesc, buf + fudge, ibufp + len - fudge);
if (result < 0)
log_error ("send_packet: %m");
return result;
@@ -343,14 +365,35 @@ ssize_t receive_packet (interface, buf,
{
int length = 0;
int offset = 0;
+ int nocsum = 0;
unsigned char ibuf [1536];
unsigned bufix = 0;
unsigned paylen;
+ 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;
+ 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);
@@ -367,7 +410,7 @@ ssize_t receive_packet (interface, buf,
/* Decode the IP and UDP headers... */
offset = decode_udp_ip_header (interface, ibuf, bufix, from,
- (unsigned)length, &paylen);
+ (unsigned)length, &paylen, nocsum);
/* If the IP or UDP checksum was bad, skip the packet... */
if (offset < 0)
diff -up dhcp-4.2.2b1/common/nit.c.xen dhcp-4.2.2b1/common/nit.c
--- dhcp-4.2.2b1/common/nit.c.xen 2009-11-20 02:49:01.000000000 +0100
+++ dhcp-4.2.2b1/common/nit.c 2011-07-01 14:00:16.939958989 +0200
@@ -369,7 +369,7 @@ ssize_t receive_packet (interface, buf,
/* Decode the IP and UDP headers... */
offset = decode_udp_ip_header (interface, ibuf, bufix,
- from, length, &paylen);
+ from, length, &paylen, 0);
/* If the IP or UDP checksum was bad, skip the packet... */
if (offset < 0)
diff -up dhcp-4.2.2b1/common/packet.c.xen dhcp-4.2.2b1/common/packet.c
--- dhcp-4.2.2b1/common/packet.c.xen 2009-07-23 20:52:20.000000000 +0200
+++ dhcp-4.2.2b1/common/packet.c 2011-07-01 14:00:16.939958989 +0200
@@ -211,7 +211,7 @@ ssize_t
decode_udp_ip_header(struct interface_info *interface,
unsigned char *buf, unsigned bufix,
struct sockaddr_in *from, unsigned buflen,
- unsigned *rbuflen)
+ unsigned *rbuflen, int nocsum)
{
unsigned char *data;
struct ip ip;
@@ -322,7 +322,7 @@ decode_udp_ip_header(struct interface_in
8, IPPROTO_UDP + ulen))));
udp_packets_seen++;
- if (usum && usum != sum) {
+ if (!nocsum && usum && usum != sum) {
udp_packets_bad_checksum++;
if (udp_packets_seen > 4 &&
(udp_packets_seen / udp_packets_bad_checksum) < 2) {
diff -up dhcp-4.2.2b1/common/upf.c.xen dhcp-4.2.2b1/common/upf.c
--- dhcp-4.2.2b1/common/upf.c.xen 2009-11-20 02:49:01.000000000 +0100
+++ dhcp-4.2.2b1/common/upf.c 2011-07-01 14:00:16.940958986 +0200
@@ -320,7 +320,7 @@ ssize_t receive_packet (interface, buf,
/* Decode the IP and UDP headers... */
offset = decode_udp_ip_header (interface, ibuf, bufix,
- from, length, &paylen);
+ from, length, &paylen, 0);
/* If the IP or UDP checksum was bad, skip the packet... */
if (offset < 0)
diff -up dhcp-4.2.2b1/includes/dhcpd.h.xen dhcp-4.2.2b1/includes/dhcpd.h
--- dhcp-4.2.2b1/includes/dhcpd.h.xen 2011-07-01 14:00:16.000000000 +0200
+++ dhcp-4.2.2b1/includes/dhcpd.h 2011-07-01 14:12:18.069642470 +0200
@@ -2796,7 +2796,7 @@ ssize_t decode_hw_header (struct interfa
unsigned, struct hardware *);
ssize_t decode_udp_ip_header (struct interface_info *, unsigned char *,
unsigned, struct sockaddr_in *,
- unsigned, unsigned *);
+ unsigned, unsigned *, int);
/* ethernet.c */
void assemble_ethernet_header (struct interface_info *, unsigned char *,

View file

@ -0,0 +1,11 @@
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (GNU/Linux)
iQEVAwUATwzDx6v5WqfJazUKAQoHTwf+M4/AoxtBUDSw8JYVFKJ1coz9wLMm3tTg
PGuxk2mWPTYw2F6QCZ//mgCC/NVUJEdH/6rCsLUM2Ps9vLpvQgeQWEjKc8u5iTpw
8fsO9elkKIy7sle7MoQ/PDz2iOaz3TW9GCrOlh7df4QeJARZOU+tcQdzIyZSWE6p
FssVOQ5Yqm2u6OcSNUXtgkTcNL6GrraQTMiU7kbSUAcybKX1OPixX20Aa5ktT1OB
vJHIqMWaICxVzJhdsPuB/FjftJhE6/pAvm8TT/YB0Jjoz3rRgOSswQRI6XZjJjR5
CQOywkXQ+WfuY6vEkV8KtEYLazOGUQT7/NlcFRhqvUs05baTD07gAQ==
=CLdh
-----END PGP SIGNATURE-----

189
dhcp.spec
View file

@ -1,41 +1,52 @@
%define plevelversion 2
%if %plevelversion < 1
%undefine plevel
%else
%define plevel P%{plevelversion}
%endif
%define _catdir /var/cache/man
%define pver P1
Summary: The ISC DHCP (Dynamic Host Configuration Protocol) server/relay agent/client
Name: dhcp
Epoch: 3
Version: 4.2.1
Release: %mkrel 0.%{pver}.2
Version: 4.2.3
Release: 1.P%{plevelversion}.2
License: Distributable
Group: System/Servers
URL: https://www.isc.org/software/dhcp
Source0: ftp://ftp.isc.org/isc/%{name}/%{name}-%{version}-%{pver}.tar.gz
Source1: ftp://ftp.isc.org/isc/%{name}/%{name}-%{version}-%{pver}.tar.gz.sha512.asc
URL: http://www.isc.org/software/dhcp
Source0: ftp://ftp.isc.org/isc/%{name}/%{name}-%{version}/%{name}-%{version}%{?plevel:-%{plevel}}.tar.gz
Source1: ftp://ftp.isc.org/isc/%{name}/%{name}-%{version}/%{name}-%{version}%{?plevel:-%{plevel}}.tar.gz.sha512.asc
Source2: dhcpd.conf
Source3: dhcpd.init
Source4: dhcp-dynamic-dns-examples.tar.bz2
Source5: dhcrelay.init
Source6: update_dhcp.pl
Source7: dhcpreport.pl
Source8: dhcpd-chroot.sh
# (eugeni) dhclient-exit-hooks script
Source9: dhclient-exit-hooks
Source12: draft-ietf-dhc-ldap-schema-01.txt
# customize ifup script
Patch0: dhcp-4.1.1-ifup.patch
Patch5: dhcp-4.1.1-format_not_a_string_literal_and_no_format_arguments.patch
# (fc) 4.1.0-3mdv no IPv6 is no longer fatal for dhclient
Patch6: dhcp-4.1.1-missing-ipv6-not-fatal.patch
Source10: draft-ietf-dhc-ldap-schema-01.txt
Source11: dhcpd.init
Source12: dhcpd.service
Source13: dhcpd6.init
Source14: dhcpd6.service
Source15: dhcrelay.init
Source16: dhcrelay.service
# mageia patches
Patch100: dhcp-4.2.2-ifup.patch
Patch101: dhcp-4.2.2-fix-format-errors.patch
# prevents needless deassociation, working around mdv bug #43441
Patch7: dhcp-4.1.1-prevent_wireless_deassociation.patch
# redhat bug #587070
Patch9: dhcp-4.1.1-useless-wait.patch
Patch10: dhcp-4.2.1-P1-CVE-2011-2748,2749.diff
BuildRequires: perl groff-for-man
Patch102: dhcp-4.1.1-prevent_wireless_deassociation.patch
# fedora patches
Patch8: dhcp-4.2.2-xen-checksum.patch
Patch15: dhcp-4.2.2-missing-ipv6-not-fatal.patch
Patch17: dhcp-4.2.0-add_timeout_when_NULL.patch
Patch18: dhcp-4.2.1-64_bit_lease_parse.patch
BuildRequires: groff-for-man
BuildRequires: openldap-devel
Provides: dhcpd
Obsoletes: dhcpd < 3.0.6
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
BuildRequires: bind-devel
%if %mdkver >= 201100
BuildRequires: systemd-units
%endif
%description
DHCP (Dynamic Host Configuration Protocol) is a protocol which allows
@ -84,11 +95,12 @@ DHCP server and a DHCP relay agent.
%package server
Summary: The ISC DHCP (Dynamic Host Configuration Protocol) server
Group: System/Servers
Requires: dhcp-common = %{epoch}:%{version}-%{release}
Requires: dhcp-common >= %{epoch}:%{version}-%{release}
Requires(post): rpm-helper
Requires(preun): rpm-helper
Obsoletes: dhcp < 3.0.6
Provides: dhcp
%if %mdkver >= 201100
Requires(post,postun): systemd-units
%endif
%description server
DHCP server is the Internet Software Consortium (ISC) DHCP server for various
@ -101,7 +113,7 @@ network. You will also need to install the base dhcp package.
%package client
Summary: The ISC DHCP (Dynamic Host Configuration Protocol) client
Group: System/Servers
Requires: dhcp-common = %{epoch}:%{version}-%{release}
Requires: dhcp-common >= %{epoch}:%{version}-%{release}
%description client
DHCP client is the Internet Software Consortium (ISC) DHCP client for various
@ -115,7 +127,7 @@ install the base dhcp package.
%package relay
Summary: The ISC DHCP (Dynamic Host Configuration Protocol) relay
Group: System/Servers
Requires: dhcp-common = %{epoch}:%{version}-%{release}
Requires: dhcp-common >= %{epoch}:%{version}-%{release}
Requires(post): rpm-helper
Requires(preun): rpm-helper
@ -131,7 +143,7 @@ starting the server.
%package devel
Summary: Development headers and libraries for the dhcpctl API
Group: Development/Other
Requires: dhcp-common = %{epoch}:%{version}-%{release}
Requires: dhcp-common >= %{epoch}:%{version}-%{release}
%description devel
DHCP devel contains all of the libraries and headers for developing with the
@ -139,18 +151,32 @@ Internet Software Consortium (ISC) dhcpctl API.
%prep
%setup -q -n %{name}-%{version}-%{pver} -a4
%patch0 -p1 -b .ifup
%patch5 -p1 -b .format_not_a_string_literal_and_no_format_arguments
%patch6 -p1 -b .noipv6nonfatal
%patch7 -p1 -b .prevent_wireless_deassociation
%patch9 -p0 -b .useless_wait
%patch10 -p1 -b .CVE-2011-2748,2749
%setup -q -n %{name}-%{version}%{?plevel:-%{plevel}}
install -m0644 %{SOURCE12} doc
%patch100 -p1 -b .ifup
%patch101 -p1 -b .format_not_a_string_literal_and_no_format_arguments
%patch102 -p1 -b .prevent_wireless_deassociation
# Handle Xen partial UDP checksums
%patch8 -p1 -b .xen
# If the ipv6 kernel module is missing, do not segfault
# (Submitted to dhcp-bugs@isc.org - [ISC-Bugs #19367])
%patch15 -p1 -b .noipv6
# Handle cases in add_timeout() where the function is called with a NULL
# value for the 'when' parameter
%patch17 -p1 -b .dracut
# Ensure 64-bit platforms parse lease file dates & times correctly
%patch18 -p1 -b .64-bit_lease_parse
install -m0644 %{SOURCE10} doc
%build
%if %mdkver >= 201200
%serverbuild_hardened
%else
%serverbuild
%endif
%configure2_5x --enable-paranoia --enable-early-chroot \
--with-ldapcrypto \
--with-srv-lease-file=%{_var}/lib/dhcp/dhcpd.leases \
@ -171,6 +197,7 @@ rm -rf %{buildroot}
install -d %{buildroot}%{_bindir}
install -d %{buildroot}%{_sysconfdir}/sysconfig
install -d %{buildroot}%{_initrddir}
install -d %{buildroot}%{_unitdir}/system
install -d %{buildroot}%{_var}/lib/dhcp
install -d %{buildroot}%{_var}/run/dhcpd
@ -181,10 +208,17 @@ install -d %{buildroot}%{_var}/run/dhcpd
%{__mv} %{buildroot}%{_sbindir}/dhclient %{buildroot}/sbin/dhclient
%{__install} -p -m 0755 client/scripts/linux %{buildroot}/sbin/dhclient-script
%if %mdkver >= 201100
install -m 644 %{SOURCE12} %{buildroot}%{_unitdir}/dhcpd.service
install -m 644 %{SOURCE14} %{buildroot}%{_unitdir}/dhcpd6.service
install -m 644 %{SOURCE16} %{buildroot}%{_unitdir}/dhcrelay.service
%else
install -m0755 %{SOURCE11} %{buildroot}%{_initrddir}/dhcpd
install -m0755 %{SOURCE13} %{buildroot}%{_initrddir}/dhcpd6
install -m0755 %{SOURCE15} %{buildroot}%{_initrddir}/dhcrelay
%endif
install -m0755 %{SOURCE3} %{buildroot}%{_initrddir}/dhcpd
install -m0755 %{SOURCE5} %{buildroot}%{_initrddir}/dhcrelay
install -m0755 %{SOURCE6} %{SOURCE7} %{SOURCE8} %{buildroot}%{_sbindir}/
install -m0755 %{SOURCE7} %{SOURCE8} %{buildroot}%{_sbindir}/
install -m0644 %{SOURCE2} %{buildroot}%{_sysconfdir}/
install -m0755 contrib/ldap/dhcpd-conf-to-ldap %{buildroot}%{_sbindir}/
@ -195,14 +229,14 @@ cat > %{buildroot}%{_sysconfdir}/sysconfig/dhcpd <<EOF
# You can set here various option for dhcpd
# Which configuration file to use.
# CONFIGFILE="/etc/dhcpd.conf"
CONFIGFILE="/etc/dhcpd.conf"
# Where to store the lease state information.
# LEASEFILE="/var/lib/dhcp/dhcpd.leases"
LEASEFILE="/var/lib/dhcp/dhcpd.leases"
# Define INTERFACES to limit which network interfaces dhcpd listens on.
# The default null value causes dhcpd to listen on all interfaces.
#INTERFACES=""
INTERFACES=""
# Define OPTIONS with any other options to pass to the dhcpd server.
# See dhcpd(8) for available options and syntax.
@ -234,7 +268,7 @@ rm -rf doc/ja_JP.eucJP
find -size 0 |grep ldap | xargs rm -rf
# remove unwanted file
rm -f $RPM_BUILD_ROOT%{_sysconfdir}/dhclient.conf
rm -f %{buildroot}%{_sysconfdir}/dhclient.conf
%post server
%_post_service dhcpd
@ -243,70 +277,51 @@ if [ ! -f %{_var}/lib/dhcp/dhcpd.leases ]; then
touch %{_var}/lib/dhcp/dhcpd.leases
fi
if [ $1 = 0 ]; then
%{_initrddir}/dhcpd start
fi
#update an eventual installed dhcp-2* server
if [ -f %{_sysconfdir}/dhcpd.conf ]; then
perl %{_sbindir}/update_dhcp.pl
fi
%preun server
%_preun_service dhcpd
%postun server
if [ "$1" -ge "1" ]; then
/sbin/service dhcpd condrestart >/dev/null 2>&1
fi
%post relay
%_post_service dhcrelay
%preun relay
%_preun_service dhcrelay
%postun relay
if [ "$1" -ge "1" ]; then
/sbin/service dhcrelay condrestart >/dev/null 2>&1
fi
%post client
touch /var/lib/dhcp/dhclient.leases
%postun client
rm -rf /var/lib/dhcp/dhclient.leases
%clean
rm -rf %{buildroot}
%files common
%defattr(-,root,root)
%doc README contrib/ldap/README.ldap RELNOTES
%doc contrib/3.0b1-lease-convert
%dir %{_var}/lib/dhcp
%{_mandir}/man5/dhcp-options.5*
%files doc
%defattr(-,root,root)
%doc doc/*
%files server
%defattr(-,root,root)
%doc server/dhcpd.conf tests/failover contrib/ldap/dhcp.schema
%if %mdkver >= 201100
%{_unitdir}/dhcpd.service
%{_unitdir}/dhcpd6.service
%else
%{_initrddir}/dhcpd
%{_initrddir}/dhcpd6
%endif
%config(noreplace) %{_sysconfdir}/dhcpd.conf
%config(noreplace) %{_sysconfdir}/dhclient-exit-hooks
%config(noreplace) %{_sysconfdir}/sysconfig/dhcpd
%config(noreplace) %ghost %{_var}/lib/dhcp/dhcpd.leases
%{_sbindir}/dhcpd
%{_sbindir}/update_dhcp.pl
%{_sbindir}/dhcpreport.pl
%{_sbindir}/dhcpd-conf-to-ldap
%{_sbindir}/dhcpd-chroot.sh
%{_bindir}/omshell
%{_mandir}/man1/omshell.1*
%{_mandir}/man3/omapi.3*
%{_mandir}/man5/dhcpd.conf.5*
%{_mandir}/man5/dhcpd.leases.5*
%{_mandir}/man5/dhcp-eval.5*
@ -314,14 +329,18 @@ rm -rf %{buildroot}
%dir %{_var}/run/dhcpd
%files relay
%defattr(-,root,root)
%if %mdkver >= 201100
%{_unitdir}/dhcrelay.service
%else
%{_initrddir}/dhcrelay
%endif
%config(noreplace) %{_sysconfdir}/sysconfig/dhcrelay
%{_sbindir}/dhcrelay
%{_mandir}/man8/dhcrelay.8*
%files client
%defattr(-,root,root)
%doc client/dhclient.conf
%config(noreplace) %ghost %{_var}/lib/dhcp/dhclient.leases
%attr (0755,root,root) /sbin/dhclient-script
@ -332,14 +351,34 @@ rm -rf %{buildroot}
%{_mandir}/man8/dhclient-script.8*
%files devel
%defattr(-,root,root)
%{_includedir}/*
%{_libdir}/*.a
%{_mandir}/man3/*
%changelog
* Thu Aug 18 2011 Oden Eriksson <oeriksson@mandriva.com> 3:4.2.1-0.P1.2mdv2011.0
* Sun Jan 15 2012 Tomasz Pawel Gajc <tpg@mandriva.org> 3:4.2.3-1.P2.2
+ Revision: 761630
- adjust spec file and services file for systemd
* Sun Jan 15 2012 Tomasz Pawel Gajc <tpg@mandriva.org> 3:4.2.3-1.P2.1
+ Revision: 761129
- update to new version dhcp-4.2.3-P2
- use %%serverbuild_hardened
- add requires(post,preun) on ystemd-units in server subpackage
* Thu Dec 08 2011 Oden Eriksson <oeriksson@mandriva.com> 3:4.2.3-1.P1.1
+ Revision: 739067
- fix volatile rpm5 changes (does it never end?)
- 4.2.3-P1 (fixes CVE-2011-4539)
- added better logic to handle the patch levels, set 0 (zero) for a "fake" -P0 version
- various cleanups
* Sun Nov 20 2011 Oden Eriksson <oeriksson@mandriva.com> 3:4.2.3-0
+ Revision: 732029
- 4.2.3 (slight mageia sync, needs further systemd work though)
* Thu Aug 18 2011 Oden Eriksson <oeriksson@mandriva.com> 3:4.2.1-0.P1.2
+ Revision: 695144
- actually use the correct friggin patch...
- P10: security fix for CVE-2011-2748,2749

0
dhcpd-chroot.sh Executable file → Normal file
View file

View file

@ -1,39 +1,32 @@
#!/bin/bash
#
# dhcpd This shell script takes care of starting and stopping
# dhcpd.
#
# chkconfig: 345 65 35
# description: dhcpd provides the Dynamic Host Configuration Protocol service.
#
# processname: dhcpd
# config: /etc/dhcpd.conf
# pidfile: /var/run/dhcpd/dhcpd.pid
#!/bin/sh
#
### BEGIN INIT INFO
# Provides: dhcpd
# Required-Start: $network
# Default-Start:
# Default-Stop: 0 6
# Should-Start: ldap
# Required-Stop: $network
# Required-Start: $network
# Should-Stop: ldap
# Short-Description: The dhcpd daemon
# Description: dhcpd provides the Dynamic Host Configuration Protocol service.
# Required-Stop:
# Short-Description: Start and stop the DHCP server
# Description: dhcpd provides the Dynamic Host Configuration Protocol (DHCP)
# server.
### END INIT INFO
#
# The fields below are left around for legacy tools (will remove later).
#
# chkconfig: - 65 35
# description: dhcpd provides the Dynamic Host Configuration Protocol (DHCP) \
# server
# processname: dhcpd
# config: /etc/dhcpd.conf
# config: /var/lib/dhcpd/dhcpd.leases
# pidfile: /var/run/dhcpd.pid
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0
[ -x /usr/sbin/dhcpd ] || exit 0
# The following variables should be set in the file
# /etc/sysconfig/dhcpd.
# Which configuration file to use.
CONFIGFILE="/etc/dhcpd.conf"
# Where to store the lease state information.
@ -44,77 +37,82 @@ INTERFACES=""
# Define OPTIONS with any other options to pass to the dhcpd server.
OPTIONS="-q"
# Source dhcpd configuration. Values specified in this file override
# the defaults above.
# Values specified in this file override the defaults above.
[ -f /etc/sysconfig/dhcpd ] && . /etc/sysconfig/dhcpd
# If null values were specified, use defaults so we don't get a syntax
# error below.
[ "${CONFIGFILE}" = "" ] && CONFIGFILE="/etc/dhcpd.conf"
[ "${LEASEFILE}" = "" ] && LEASEFILE="/var/lib/dhcp/dhcpd.leases"
[ -f $CONFIGFILE ] || exit 0
[ -f $LEASEFILE ] || exit 0
RETVAL=0
start() {
# Start daemons.
echo -n "Starting dhcpd: "
if [ -n "${ROOTDIR}" -a "x${ROOTDIR}" != "x/" ]; then
OPTIONS="${OPTIONS} -chroot ${ROOTDIR}"
fi
daemon /usr/sbin/dhcpd -cf $CONFIGFILE -lf $LEASEFILE $OPTIONS $INTERFACES
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/dhcpd
return $RETVAL
echo -n "Starting dhcpd: "
if [ -n "${ROOTDIR}" -a "x${ROOTDIR}" != "x/" ]; then
OPTIONS="${OPTIONS} -chroot ${ROOTDIR}"
fi
daemon /usr/sbin/dhcpd -cf $CONFIGFILE -lf $LEASEFILE $OPTIONS $INTERFACES
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/dhcpd
return $RETVAL
}
stop() {
# Stop daemons.
echo -n "Shutting down dhcpd: "
if [ -r ${ROOTDIR}/var/run/dhcpd/dhcpd.pid ]; then
kill -TERM `cat ${ROOTDIR}/var/run/dhcpd/dhcpd.pid`
RETVAL=$?
[ "$RETVAL" = 0 ] && success "stop" || failure "stop"
else
success "already stopped"
RETVAL=0
fi
[ $RETVAL -eq 0 ] && rm -f ${ROOTDIR}/var/run/dhcpd/dhcpd.pid
[ $RETVAL = 0 ] && rm -f /var/lock/subsys/dhcpd
echo
return $RETVAL
echo -n "Shutting down dhcpd: "
if [ -r ${ROOTDIR}/var/run/dhcpd/dhcpd.pid ]; then
kill -TERM `cat ${ROOTDIR}/var/run/dhcpd/dhcpd.pid`
RETVAL=$?
[ "$RETVAL" = 0 ] && success "stop" || failure "stop"
else
success "already stopped"
RETVAL=0
fi
[ $RETVAL -eq 0 ] && rm -f ${ROOTDIR}/var/run/dhcpd/dhcpd.pid
[ $RETVAL = 0 ] && rm -f /var/lock/subsys/dhcpd
echo
return $RETVAL
}
configtest() {
/usr/sbin/dhcpd -q -t -cf $CONFIGFILE
RETVAL=$?
if [ $RETVAL -eq 1 ]; then
/usr/sbin/dhcpd -t -cf $CONFIGFILE
else
echo "Syntax: OK" >&2
fi
return $RETVAL
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
restart|reload)
stop
start
RETVAL=$?
;;
condrestart)
if [ -f /var/lock/subsys/dhcpd ]; then
stop
start
RETVAL=$?
fi
;;
status)
status dhcpd
RETVAL=$?
;;
*)
echo "Usage: dhcpd {start|stop|restart|condrestart|status}"
exit 1
start)
start
;;
stop)
stop
;;
restart|reload)
stop
start
RETVAL=$?
;;
condrestart)
if [ -f /var/lock/subsys/dhcpd ]; then
stop
start
RETVAL=$?
fi
;;
configtest)
configtest
;;
status)
status dhcpd
RETVAL=$?
;;
*)
echo "Usage: dhcpd {start|stop|restart|condrestart|status}"
exit 1
esac
exit $RETVAL

10
dhcpd.service Normal file
View file

@ -0,0 +1,10 @@
[Unit]
Description=DHCPv4 Server Daemon
After=syslog.target network.target
[Service]
EnvironmentFile=/etc/sysconfig/dhcpd
ExecStart=/usr/sbin/dhcpd -cf $CONFIGFILE -lf $LEASEFILE $INTERFACES
[Install]
WantedBy=multi-user.target

117
dhcpd6.init Normal file
View file

@ -0,0 +1,117 @@
#!/bin/sh
#
### BEGIN INIT INFO
# Provides: dhcpd
# Default-Start:
# Default-Stop:
# Should-Start:
# Required-Start: $network
# Required-Stop:
# Short-Description: Start and stop the DHCPv6 server
# Description: dhcpd provides the Dynamic Host Configuration Protocol (DHCPv6)
# server.
### END INIT INFO
#
# The fields below are left around for legacy tools (will remove later).
#
# chkconfig: - 65 35
# description: dhcpd provides the Dynamic Host Configuration Protocol (DHCPv6) \
# server
# processname: dhcpd
# config: /etc/dhcpd6.conf
# config: /var/lib/dhcpd/dhcpd6.leases
# pidfile: /var/run/dhcpd6.pid
. /etc/rc.d/init.d/functions
[ -x /usr/sbin/dhcpd ] || exit 0
# Which configuration file to use.
CONFIGFILE="/etc/dhcpd6.conf"
# Where to store the lease state information.
LEASEFILE="/var/lib/dhcp/dhcpd6.leases"
# Define INTERFACES to limit which network interfaces dhcpd listens on.
# The default null value causes dhcpd to listen on all interfaces.
INTERFACES=""
# Define OPTIONS with any other options to pass to the dhcpd server.
OPTIONS="-q"
# Values specified in this file override the defaults above.
[ -f /etc/sysconfig/dhcpd6 ] && . /etc/sysconfig/dhcpd6
[ -f $CONFIGFILE ] || exit 0
[ -f $LEASEFILE ] || exit 0
RETVAL=0
start() {
echo -n "Starting dhcpd (DHCPv6): "
if [ -n "${ROOTDIR}" -a "x${ROOTDIR}" != "x/" ]; then
OPTIONS="${OPTIONS} -chroot ${ROOTDIR}"
fi
daemon /usr/sbin/dhcpd -6 -cf $CONFIGFILE -lf $LEASEFILE $OPTIONS $INTERFACES
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/dhcpd6
return $RETVAL
}
stop() {
echo -n "Shutting down dhcpd (DHCPv6): "
if [ -r ${ROOTDIR}/var/run/dhcpd/dhcpd6.pid ]; then
kill -TERM `cat ${ROOTDIR}/var/run/dhcpd/dhcpd6.pid`
RETVAL=$?
[ "$RETVAL" = 0 ] && success "stop" || failure "stop"
else
success "already stopped"
RETVAL=0
fi
[ $RETVAL -eq 0 ] && rm -f ${ROOTDIR}/var/run/dhcpd/dhcpd6.pid
[ $RETVAL = 0 ] && rm -f /var/lock/subsys/dhcpd6
echo
return $RETVAL
}
configtest() {
/usr/sbin/dhcpd -q -t -6 -cf $CONFIGFILE
RETVAL=$?
if [ $RETVAL -eq 1 ]; then
/usr/sbin/dhcpd -t -6 -cf $CONFIGFILE
else
echo "Syntax: OK" >&2
fi
return $RETVAL
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart|reload)
stop
start
RETVAL=$?
;;
condrestart)
if [ -f /var/lock/subsys/dhcpd6 ]; then
stop
start
RETVAL=$?
fi
;;
configtest)
configtest
;;
status)
status dhcpd
RETVAL=$?
;;
*)
echo "Usage: dhcpd6 {start|stop|restart|condrestart|status}"
exit 1
esac
exit $RETVAL

10
dhcpd6.service Normal file
View file

@ -0,0 +1,10 @@
[Unit]
Description=DHCPv6 Server Daemon
After=syslog.target network.target
[Service]
EnvironmentFile=/etc/sysconfig/dhcpd6
ExecStart=/usr/sbin/dhcpd -d 6 -cf $CONFIGFILE -lf $LEASEFILE $INTERFACES
[Install]
WantedBy=multi-user.target

View file

@ -1,49 +1,36 @@
#!/bin/sh
#
# dhcrelay This shell script takes care of starting and stopping
# dhcrelay.
#
# chkconfig: 2345 65 35
# description: dhcrelay provides the DHCP Relay service.
#
# processname: dhcrelay
# pidfile: /var/run/dhcrelay.pid
#
### BEGIN INIT INFO
# Provides: dhcrelay
# Default-Start: 2 3 4 5
# Default-Stop:
# Should-Start:
# Required-Start: $network
# Required-Stop: $network
# Default-Start: 2 3 4 5
# Short-Description: The dhcrelay daemon
# Description: dhcrelay provides the DHCP Relay service.
# Short-Description: Start and stop the DHCP relay server
# Description: dhcrelay provides the Dynamic Host Configuration Protocol (DHCP)
# relay server. This is required when your DHCP server is on
# another network segment from the clients.
### END INIT INFO
#
# The fields below are left around for legacy tools (will remove later).
#
# chkconfig: - 65 35
# description: dhcrelay provides a relay for Dynamic Host Control Protocol.
# processname: dhcrelay
# # pidfile: /var/run/dhcrelay.pid
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0
[ -x /usr/sbin/dhcrelay ] || exit 0
# The following variables can be set in the file
# /etc/sysconfig/dhcrelay.
# Define SERVERS with a list of one or more DHCP servers where
# DHCP packets are to be relayed to and from. This is mandatory.
#SERVERS="10.11.12.13 10.9.8.7"
SERVERS=""
# Define OPTIONS with any other options to pass to the dhcrelay server.
# See dhcrelay(8) for available options and syntax.
#OPTIONS="-q -i eth0 -i eth1"
OPTIONS="-q"
# Source dhcrelay configuration. Values specified in this file override
# the defaults above.
# Values specified in this file override the defaults above.
[ -f /etc/sysconfig/dhcrelay ] && . /etc/sysconfig/dhcrelay
# Check that at least one DHCP server to relay to was specified.
@ -52,52 +39,52 @@ OPTIONS="-q"
RETVAL=0
start() {
# Start daemons.
echo -n "Starting dhcrelay: "
daemon /usr/sbin/dhcrelay $OPTIONS $SERVERS
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/dhcrelay
return $RETVAL
# Start daemons.
echo -n "Starting dhcrelay: "
daemon /usr/sbin/dhcrelay $OPTIONS $SERVERS
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/dhcrelay
return $RETVAL
}
stop() {
# Stop daemons.
echo -n "Shutting down dhcrelay: "
killproc dhcrelay
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/dhcrelay
return $RETVAL
# Stop daemons.
echo -n "Shutting down dhcrelay: "
killproc dhcrelay
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/dhcrelay
return $RETVAL
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
restart|reload)
stop
start
RETVAL=$?
;;
condrestart)
if [ -f /var/lock/subsys/dhcrelay ]; then
stop
start
RETVAL=$?
fi
;;
status)
status dhcrelay
RETVAL=$?
;;
*)
echo "Usage: dhcrelay {start|stop|restart|condrestart|status}"
exit 1
start)
start
;;
stop)
stop
;;
restart|reload)
stop
start
RETVAL=$?
;;
condrestart)
if [ -f /var/lock/subsys/dhcrelay ]; then
stop
start
RETVAL=$?
fi
;;
status)
status dhcrelay
RETVAL=$?
;;
*)
echo "Usage: dhcrelay {start|stop|restart|condrestart|status}"
exit 1
esac
exit $RETVAL

10
dhcrelay.service Normal file
View file

@ -0,0 +1,10 @@
[Unit]
Description=DHCP Relay Agent Daemon
After=syslog.target network.target
[Service]
EnvironmentFile=/etc/sysconfig/dhcrelay
ExecStart=/usr/sbin/dhcrelay -d --no-pid $DHCRELAYARGS
[Install]
WantedBy=multi-user.target

View file

@ -1,45 +0,0 @@
#!/usr/bin/perl -W
#----------------------------------------------------------------------
# copyright (C) 2001 Florin Grad
#
# This is a really silly program that is supposed to allow an update of
# a dhcp-2* server to a dhcp-3* server
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#------------------------------------------------------------------------
#search for a ddns-update-style entry in /etc/dhcpd.conf file
my $conf_file = "/etc/dhcpd.conf"; #$ARGV[0];
my $conf_file_orig = "/etc/dhcpd.conf.orig";
my $i=0;
open (DHCPCONF, "< $conf_file") or die "Can't open the $conf_file file for reading";
while (<DHCPCONF>) {
if (/ddns-update-style/) {
$i++;
};
};
close (DHCPCONF);
if ($i == 0) { #we are on a dhcp-2
rename("$conf_file","$conf_file_orig") || die "Can't rename $conf_file: $!";
open (DHCPCONF, "> $conf_file") or die "Can't open the $conf_file file for writing";
print DHCPCONF "ddns-update-style none;\n";
open (DHCPCONF_ORIG, "< $conf_file_orig") or die "Can't open the $conf_file_orig file for reading";
while (<DHCPCONF_ORIG>) {
print DHCPCONF "$_";
};
close (DHCPCONF_ORIG);
close (DHCPCONF);
}