SHA256
1
0
forked from pool/dhcp

- Update to dhcp-4.3.3 (fate#319067) provinding many bug fixes,

features and obsoletes several patches we were using before.
  For complete list of the changes, please read the RELNOTES
  file shipped along with the package or online:
  https://kb.isc.org/article/AA-01297/82/DHCP-4.3.3-Release-Notes.html
- Removed obsolete patches included upstream now:
  [- 0007-dhcp-4.2.6-ldap-mt01.patch,
   - 0009-dhcp-4.2.6-xen-checksum.patch,
   - 0013-dhcp-4.2.3-P1-dhclient-log-pid.patch,
   - 0015-Ignore-SIGPIPE-to-not-die-in-socket-code.patch,
   - 0016-server-log-DHCPv6-addresses-assigned-to-clients.patch,
   - 0019-dhcp-4.2.x-ldap-debug-write.bnc835818.patch,
   - 0021-dhcp-4.2.4-P2-bnc878846-conf-to-ldap.patch,
   - 0022-dhcp-4.2.x-contrib-conf-to-ldap-reorder.886094.patch,
   - 0023-dhcp-4.2.x-ddns-tsig-hmac-sha-support.890731.patch,
   - 0025-dhcp-4.2.x-dhcpv6-retransmission-until-MRD.872609.patch,
   - 0026-dhcp-4.2.x-disable-unused-ddns-port-in-server.891655.patch]
- Replaced hostname patch with a dhcpv6 and fqdn aware variant:
  [- 0006-dhcp-4.2.5-dhclient-send-hostname-rml.patch,
   + 0006-dhcp-4.3.2-dhclient-send-hostname-or-fqdn.patch]
- Replaced infiniband support patch with fixed variant:
  [- 0017-dhcp-4.2.6-lpf-ip-over-ib-support.patch
   - 0018-dhcp-4.2.6-improved-xid.patch
   - 0027-dhcp-4.2.x-handle-ifa_addr-NULL.909189.patch,
   + 0030-infiniband-support.patch]
- Merged/Adopted patches for the dhcp-4.3.3 sources:
  [* 0004-dhcp-4.1.1-tmpfile.patch,
   * 0011-dhcp-4.2.6-close-on-exec.patch,
   * 0020-dhcp-4.2.x-chown-server-leases.bnc868253.patch]

OBS-URL: https://build.opensuse.org/package/show/network:dhcp/dhcp?expand=0&rev=151
This commit is contained in:
Marius Tomaschewski 2015-09-14 12:11:04 +00:00 committed by Git OBS Bridge
parent 83abf43e55
commit 479a80499b
27 changed files with 1383 additions and 4443 deletions

View File

@ -1,32 +1,25 @@
From 1638d046d2a914164e19c6244df5b4deadaf6938 Mon Sep 17 00:00:00 2001
From 70f2683580a88180238804546dd24a6a41427282 Mon Sep 17 00:00:00 2001
From: Marius Tomaschewski <mt@suse.de>
Date: Thu, 18 Aug 2011 10:06:01 +0200
Subject: [PATCH] dhcp-4.1.1-tmpfile
---
server/db.c | 17 ++++++-----------
1 file changed, 6 insertions(+), 11 deletions(-)
Signed-off-by: Marius Tomaschewski <mt@suse.de>
diff --git a/server/db.c b/server/db.c
index 82f3841..c2630ea 100644
index 5238ed8..0c642ad 100644
--- a/server/db.c
+++ b/server/db.c
@@ -1088,21 +1088,16 @@ int new_lease_file ()
db_validity = lease_file_is_corrupt;
- /* %Audit% Truncated filename causes panic. %2004.06.17,Safe%
- * This should never happen since the path is a configuration
- * variable from build-time or command-line. But if it should,
- * either by malice or ignorance, we panic, since the potential
- * for havoc is high.
- */
@@ -1116,15 +1116,19 @@ int new_lease_file ()
* either by malice or ignorance, we panic, since the potential
* for havoc is high.
*/
- if (snprintf (newfname, sizeof newfname, "%s.%d",
- path_dhcpd_db, (int)t) >= sizeof newfname)
- log_fatal("new_lease_file: lease file path too long");
-
+ if (snprintf (newfname, sizeof newfname, "%s.XXXXXX",
+ path_dhcpd_db) >= sizeof newfname)
log_fatal("new_lease_file: lease file path too long");
- db_fd = open (newfname, O_WRONLY | O_TRUNC | O_CREAT, 0664);
+ snprintf (newfname, sizeof(newfname), "%s.XXXXXX", path_dhcpd_db);
+ db_fd = mkstemp (newfname);
if (db_fd < 0) {
log_error ("Can't create new lease file: %m");
@ -36,9 +29,9 @@ index 82f3841..c2630ea 100644
+ log_error ("Can't fchmod new lease file: %m");
+ goto fail;
+ }
if ((new_db_file = fdopen(db_fd, "w")) == NULL) {
log_error("Can't fdopen new lease file: %m");
close(db_fd);
#if defined (PARANOIA)
/*
--
1.8.4
2.1.4

View File

@ -1,122 +0,0 @@
From 94cff63e89710f5e67944d57d76edaec968fe139 Mon Sep 17 00:00:00 2001
From: Marius Tomaschewski <mt@suse.de>
Date: Thu, 18 Aug 2011 10:49:07 +0200
Subject: [PATCH] dhcp-4.2.5-dhclient-send-hostname-rml
---
client/dhclient.8 | 8 ++++++++
client/dhclient.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++--
2 files changed, 56 insertions(+), 2 deletions(-)
diff --git a/client/dhclient.8 b/client/dhclient.8
index 0aa1119..bc34c6a 100644
--- a/client/dhclient.8
+++ b/client/dhclient.8
@@ -60,6 +60,10 @@ dhclient - Dynamic Host Configuration Protocol Client
.I LL|LLT
]
[
+.B -H
+.I hostname
+]
+[
.B -p
.I port-number
]
@@ -316,6 +320,10 @@ transmits these messages to 255.255.255.255 (the IP limited broadcast
address). Overriding this is mostly useful for debugging purposes. This
feature is not supported in DHCPv6 (\fB-6\fR) mode.
.TP
+.BI \-H \ hostname
+This flag may be used to specify a client hostname that should be sent to
+the DHCP server. Note, that this option is a SUSE/Novell extension.
+.TP
.BI \-g \ relay
.\" mockup relay
Set the giaddr field of all packets to the \fIrelay\fR IP address
diff --git a/client/dhclient.c b/client/dhclient.c
index 203d3d1..b7a14fe 100644
--- a/client/dhclient.c
+++ b/client/dhclient.c
@@ -119,6 +119,7 @@ main(int argc, char **argv) {
int no_dhclient_db = 0;
int no_dhclient_pid = 0;
int no_dhclient_script = 0;
+ char *dhclient_hostname = NULL;
#ifdef DHCPv6
int local_family_set = 0;
#endif /* DHCPv6 */
@@ -231,6 +232,22 @@ main(int argc, char **argv) {
if (++i == argc)
usage();
mockup_relay = argv[i];
+ } else if (!strcmp (argv[i], "-H")) {
+ size_t len;
+ if (++i == argc || !argv[i] || *(argv[i]) == '\0')
+ usage ();
+ len = strlen (argv[i]);
+ if (len > HOST_NAME_MAX) {
+ log_error("-H option host-name string \"%s\" is too long:"
+ "maximum length is %d characters",
+ argv[i], HOST_NAME_MAX);
+ exit(1);
+ } else if(check_domain_name(argv[i], len, 0) != 0) {
+ log_error("suspect host-name in -H \"%s\"",
+ argv[i]);
+ exit(1);
+ }
+ dhclient_hostname = argv [i];
} else if (!strcmp(argv[i], "-nw")) {
nowait = 1;
} else if (!strcmp(argv[i], "-n")) {
@@ -491,6 +508,35 @@ main(int argc, char **argv) {
/* Parse the dhclient.conf file. */
read_client_conf();
+ /* If the user specified a hostname, send it here and now */
+ if ((dhclient_hostname != NULL) && (*dhclient_hostname != '\0') ) {
+ struct parse *cfile = NULL;
+ char buf[HOST_NAME_MAX + 40];
+ int len;
+
+ snprintf (buf, sizeof(buf), "send host-name \"%s\";",
+ dhclient_hostname);
+ len = strlen(buf);
+
+ status = new_parse (&cfile, -1, buf, len,
+ "host-name option", 0);
+ if (status != ISC_R_SUCCESS)
+ log_fatal ("Cannot parse send host-name statement!");
+
+ for (;;) {
+ const char *val = NULL;
+ int token;
+
+ token = peek_token (&val, (unsigned *)0, cfile);
+ if (token == END_OF_FILE)
+ break;
+
+ parse_client_statement (cfile, NULL,
+ &top_level_config);
+ }
+ end_parse (&cfile);
+ }
+
/* Parse the lease database. */
read_client_leases();
@@ -719,9 +765,9 @@ static void usage()
log_fatal("Usage: dhclient "
#ifdef DHCPv6
- "[-4|-6] [-SNTP1dvrx] [-nw] [-p <port>] [-D LL|LLT]\n"
+ "[-4|-6] [-SNTP1dvrx] [-nw] [-H <hostname>] [-p <port>] [-D LL|LLT]\n"
#else /* DHCPv6 */
- "[-1dvrx] [-nw] [-p <port>]\n"
+ "[-1dvrx] [-nw] [-H <hostname>] [-p <port>]\n"
#endif /* DHCPv6 */
" [-s server-addr] [-cf config-file] "
"[-lf lease-file]\n"
--
1.8.4

View File

@ -0,0 +1,131 @@
From ec55fe43e597e5ea0f8dff5b8edef091c0911801 Mon Sep 17 00:00:00 2001
From: Marius Tomaschewski <mt@suse.de>
Date: Thu, 18 Aug 2011 10:49:07 +0200
Subject: [PATCH] dhcp-4.3.2-dhclient-send-hostname-or-fqdn
Signed-off-by: Marius Tomaschewski <mt@suse.de>
diff --git a/client/dhclient.8 b/client/dhclient.8
index 5b05698..d9a26b7 100644
--- a/client/dhclient.8
+++ b/client/dhclient.8
@@ -66,6 +66,10 @@ dhclient - Dynamic Host Configuration Protocol Client
.I LL|LLT
]
[
+.B -H
+.I hostname
+]
+[
.B -p
.I port-number
]
@@ -326,6 +330,11 @@ transmits these messages to 255.255.255.255 (the IP limited broadcast
address). Overriding this is mostly useful for debugging purposes. This
feature is not supported in DHCPv6 (\fB-6\fR) mode.
.TP
+.BI \-H \ hostname
+This flag may be used to specify a client hostname that should be sent to
+the DHCP server as host-name (ipv4 only) or fqdn to perform dns update.
+Note, that this option is a SUSE/Novell extension.
+.TP
.BI \-g \ relay
.\" mockup relay
Set the giaddr field of all packets to the \fIrelay\fR IP address
diff --git a/client/dhclient.c b/client/dhclient.c
index cf612d1..0e39161 100644
--- a/client/dhclient.c
+++ b/client/dhclient.c
@@ -124,6 +124,7 @@ main(int argc, char **argv) {
int no_dhclient_db = 0;
int no_dhclient_pid = 0;
int no_dhclient_script = 0;
+ char *dhclient_hostname = NULL;
#ifdef DHCPv6
int local_family_set = 0;
#endif /* DHCPv6 */
@@ -241,6 +242,24 @@ main(int argc, char **argv) {
if (++i == argc)
usage();
mockup_relay = argv[i];
+ } else if (!strcmp (argv[i], "-H")) {
+ size_t len;
+ if (++i == argc || !argv[i] || *(argv[i]) == '\0')
+ usage ();
+ len = strlen (argv[i]);
+ if (len > HOST_NAME_MAX) {
+ log_error("-H option hostname string \"%s\" is too long:"
+ "maximum length is %d characters",
+ argv[i], HOST_NAME_MAX);
+ exit(1);
+ } else if(check_domain_name(argv[i], len,
+ local_family == AF_INET6 ? 1 : 0) != 0) {
+ log_error("suspect %s in -H option: \"%s\"",
+ local_family == AF_INET6 ? "fqdn" : "hostname",
+ argv[i]);
+ exit(1);
+ }
+ dhclient_hostname = argv [i];
} else if (!strcmp(argv[i], "-nw")) {
nowait = 1;
} else if (!strcmp(argv[i], "-n")) {
@@ -510,6 +529,48 @@ main(int argc, char **argv) {
/* Parse the dhclient.conf file. */
read_client_conf();
+ /* If the user specified a hostname, send it here and now */
+ if ((dhclient_hostname != NULL) && (*dhclient_hostname != '\0') ) {
+ struct parse *cfile = NULL;
+ char buf[1024] = {'\0'};
+ int len;
+
+ if (strchr(dhclient_hostname, '.')) {
+ len = strlen(dhclient_hostname);
+ snprintf (buf, sizeof(buf),
+ "send fqdn.fqdn \"%s%s\";\n"
+ "send fqdn.encoded on;\n"
+ "send fqdn.server-update on;\n"
+ "also request %s;\n",
+ dhclient_hostname,
+ dhclient_hostname[len - 1] == '.' ? "" : ".",
+ local_family == AF_INET6 ? "dhcp6.fqdn" : "fqdn");
+ } else if (local_family == AF_INET) {
+ snprintf (buf, sizeof(buf),
+ "send host-name \"%s\";",
+ dhclient_hostname);
+ }
+ if ((len = strlen(buf))) {
+ status = new_parse (&cfile, -1, buf, len,
+ "hostname update options", 0);
+ if (status != ISC_R_SUCCESS)
+ log_fatal ("Cannot parse send host-name statement!");
+
+ for (;;) {
+ const char *val = NULL;
+ int token;
+
+ token = peek_token (&val, (unsigned *)0, cfile);
+ if (token == END_OF_FILE)
+ break;
+
+ parse_client_statement (cfile, NULL,
+ &top_level_config);
+ }
+ end_parse (&cfile);
+ }
+ }
+
/* Parse the lease database. */
read_client_leases();
@@ -756,6 +817,7 @@ static void usage()
#else /* DHCPv6 */
"[-I1dvrxi] [-nw] [-p <port>] [-D LL|LLT] \n"
#endif /* DHCPv6 */
+ " [-H hostname]\n"
" [-s server-addr] [-cf config-file]\n"
" [-df duid-file] [-lf lease-file]\n"
" [-pf pid-file] [--no-pid] [-e VAR=val]\n"
--
2.1.4

File diff suppressed because it is too large Load Diff

View File

@ -1,274 +0,0 @@
From 16e50fd8fbd606ba04ac814f9fff883ecb9e110c Mon Sep 17 00:00:00 2001
From: Marius Tomaschewski <mt@suse.de>
Date: Fri, 18 Feb 2011 13:18:32 +0100
Subject: [PATCH] dhcp-4.2.6-xen-checksum
---
common/bpf.c | 2 +-
common/dlpi.c | 2 +-
common/lpf.c | 84 ++++++++++++++++++++++++++++++++++++++++++--------------
common/nit.c | 2 +-
common/packet.c | 4 +--
common/upf.c | 2 +-
includes/dhcpd.h | 2 +-
7 files changed, 70 insertions(+), 28 deletions(-)
diff --git a/common/bpf.c b/common/bpf.c
index d6d6013..559b414 100644
--- a/common/bpf.c
+++ b/common/bpf.c
@@ -480,7 +480,7 @@ ssize_t receive_packet (interface, buf, len, from, hfrom)
/* Decode the IP and UDP headers... */
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 --git a/common/dlpi.c b/common/dlpi.c
index 391fb91..14e95d2 100644
--- a/common/dlpi.c
+++ b/common/dlpi.c
@@ -691,7 +691,7 @@ ssize_t receive_packet (interface, buf, len, from, hfrom)
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 --git a/common/lpf.c b/common/lpf.c
index 82c8b76..6639809 100644
--- a/common/lpf.c
+++ b/common/lpf.c
@@ -30,19 +30,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. */
@@ -68,10 +82,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 ||
@@ -86,11 +104,16 @@ 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);
+ 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) {
@@ -172,9 +195,18 @@ static void lpf_gen_filter_setup (struct interface_info *);
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);
@@ -296,7 +328,6 @@ ssize_t send_packet (interface, packet, raw, len, from, to, hto)
double hh [16];
double ih [1536 / sizeof (double)];
unsigned char *buf = (unsigned char *)ih;
- struct sockaddr_pkt sa;
int result;
int fudge;
@@ -317,17 +348,7 @@ ssize_t send_packet (interface, packet, raw, len, from, to, hto)
(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;
@@ -344,14 +365,35 @@ ssize_t receive_packet (interface, buf, len, from, hfrom)
{
int length = 0;
int offset = 0;
+ int nocsum = 0;
unsigned char ibuf [1536];
unsigned bufix = 0;
unsigned paylen;
-
- length = read (interface -> rfdesc, ibuf, sizeof ibuf);
+ 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 = 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);
@@ -368,7 +410,7 @@ ssize_t receive_packet (interface, buf, len, from, hfrom)
/* 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 --git a/common/nit.c b/common/nit.c
index a43bcf3..3fdef1d 100644
--- a/common/nit.c
+++ b/common/nit.c
@@ -363,7 +363,7 @@ ssize_t receive_packet (interface, buf, len, from, hfrom)
/* 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 --git a/common/packet.c b/common/packet.c
index 45e96e8..73e786d 100644
--- a/common/packet.c
+++ b/common/packet.c
@@ -226,7 +226,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;
@@ -337,7 +337,7 @@ decode_udp_ip_header(struct interface_info *interface,
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 --git a/common/upf.c b/common/upf.c
index de2129e..6a02077 100644
--- a/common/upf.c
+++ b/common/upf.c
@@ -314,7 +314,7 @@ ssize_t receive_packet (interface, buf, len, from, hfrom)
/* 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 --git a/includes/dhcpd.h b/includes/dhcpd.h
index 63d58e5..68262e9 100644
--- a/includes/dhcpd.h
+++ b/includes/dhcpd.h
@@ -2788,7 +2788,7 @@ ssize_t decode_hw_header (struct interface_info *, unsigned char *,
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 *,
--
1.8.4

View File

@ -1,29 +1,15 @@
From 0ae45af28ebda5770465f84ac0f69f28ed6b7b07 Mon Sep 17 00:00:00 2001
From ecb183516cf0b51ebf0a02f3b46248479fa51e43 Mon Sep 17 00:00:00 2001
From: Marius Tomaschewski <mt@suse.de>
Date: Thu, 18 Aug 2011 14:09:06 +0200
Subject: [PATCH] dhcp-4.2.6-close-on-exec
---
client/clparse.c | 4 ++--
client/dhclient.c | 10 +++++-----
common/bpf.c | 2 +-
common/discover.c | 4 ++--
common/dlpi.c | 2 +-
common/nit.c | 2 +-
common/resolv.c | 2 +-
common/upf.c | 2 +-
dst/dst_api.c | 8 ++++----
dst/prandom.c | 4 ++--
omapip/trace.c | 6 +++---
relay/dhcrelay.c | 5 +++--
server/confpars.c | 2 +-
server/db.c | 6 +++---
server/dhcpd.c | 4 ++--
server/ldap.c | 2 +-
16 files changed, 33 insertions(+), 32 deletions(-)
Merged fixed close-on-exec patch (bnc#732910)
References: bnc#732910
Signed-off-by: Marius Tomaschewski <mt@suse.de>
diff --git a/client/clparse.c b/client/clparse.c
index 646229f..3e9f9b1 100644
index 320c42f..b7e4251 100644
--- a/client/clparse.c
+++ b/client/clparse.c
@@ -221,7 +221,7 @@ int read_client_conf_file (const char *name, struct interface_info *ip,
@ -35,7 +21,7 @@ index 646229f..3e9f9b1 100644
return uerr2isc (errno);
cfile = NULL;
@@ -258,7 +258,7 @@ void read_client_leases ()
@@ -297,7 +297,7 @@ void read_client_leases ()
/* Open the lease file. If we can't open it, just return -
we can safely trust the server to remember our state. */
@ -45,10 +31,10 @@ index 646229f..3e9f9b1 100644
cfile = NULL;
diff --git a/client/dhclient.c b/client/dhclient.c
index 19a527b..dbc6f38 100644
index a077b48..ac36e3d 100644
--- a/client/dhclient.c
+++ b/client/dhclient.c
@@ -422,7 +422,7 @@ main(int argc, char **argv) {
@@ -438,7 +438,7 @@ main(int argc, char **argv) {
long temp;
int e;
@ -57,7 +43,7 @@ index 19a527b..dbc6f38 100644
e = fscanf(pidfd, "%ld\n", &temp);
oldpid = (pid_t)temp;
@@ -2728,7 +2728,7 @@ void rewrite_client_leases ()
@@ -2840,7 +2840,7 @@ void rewrite_client_leases ()
if (leaseFile != NULL)
fclose (leaseFile);
@ -66,7 +52,7 @@ index 19a527b..dbc6f38 100644
if (leaseFile == NULL) {
log_error ("can't create %s: %m", path_dhclient_db);
return;
@@ -2849,7 +2849,7 @@ write_duid(struct data_string *duid)
@@ -3033,7 +3033,7 @@ write_duid(struct data_string *duid)
return DHCP_R_INVALIDARG;
if (leaseFile == NULL) { /* XXX? */
@ -75,7 +61,7 @@ index 19a527b..dbc6f38 100644
if (leaseFile == NULL) {
log_error("can't create %s: %m", path_dhclient_db);
return ISC_R_IOERROR;
@@ -2897,7 +2897,7 @@ write_client6_lease(struct client_state *client, struct dhc6_lease *lease,
@@ -3081,7 +3081,7 @@ write_client6_lease(struct client_state *client, struct dhc6_lease *lease,
return DHCP_R_INVALIDARG;
if (leaseFile == NULL) { /* XXX? */
@ -84,7 +70,7 @@ index 19a527b..dbc6f38 100644
if (leaseFile == NULL) {
log_error("can't create %s: %m", path_dhclient_db);
return ISC_R_IOERROR;
@@ -3029,7 +3029,7 @@ int write_client_lease (client, lease, rewrite, makesure)
@@ -3213,7 +3213,7 @@ int write_client_lease (client, lease, rewrite, makesure)
return 1;
if (leaseFile == NULL) { /* XXX */
@ -94,10 +80,10 @@ index 19a527b..dbc6f38 100644
log_error ("can't create %s: %m", path_dhclient_db);
return 0;
diff --git a/common/bpf.c b/common/bpf.c
index 559b414..076d9bc 100644
index 39d4f45..df9facc 100644
--- a/common/bpf.c
+++ b/common/bpf.c
@@ -94,7 +94,7 @@ int if_register_bpf (info)
@@ -95,7 +95,7 @@ int if_register_bpf (info)
for (b = 0; 1; b++) {
/* %Audit% 31 bytes max. %2004.06.17,Safe% */
sprintf(filename, BPF_FORMAT, b);
@ -107,10 +93,10 @@ index 559b414..076d9bc 100644
if (errno == EBUSY) {
continue;
diff --git a/common/discover.c b/common/discover.c
index 4b40a70..6a0540b 100644
index 3cd64a7..37af780 100644
--- a/common/discover.c
+++ b/common/discover.c
@@ -412,7 +412,7 @@ begin_iface_scan(struct iface_conf_list *ifaces) {
@@ -415,7 +415,7 @@ begin_iface_scan(struct iface_conf_list *ifaces) {
int len;
int i;
@ -119,7 +105,7 @@ index 4b40a70..6a0540b 100644
if (ifaces->fp == NULL) {
log_error("Error opening '/proc/net/dev' to list interfaces");
return 0;
@@ -447,7 +447,7 @@ begin_iface_scan(struct iface_conf_list *ifaces) {
@@ -450,7 +450,7 @@ begin_iface_scan(struct iface_conf_list *ifaces) {
#ifdef DHCPv6
if (local_family == AF_INET6) {
@ -129,7 +115,7 @@ index 4b40a70..6a0540b 100644
log_error("Error opening '/proc/net/if_inet6' to "
"list IPv6 interfaces; %m");
diff --git a/common/dlpi.c b/common/dlpi.c
index 14e95d2..efaba3a 100644
index c34adc3..944f21c 100644
--- a/common/dlpi.c
+++ b/common/dlpi.c
@@ -804,7 +804,7 @@ dlpiopen(const char *ifname) {
@ -142,7 +128,7 @@ index 14e95d2..efaba3a 100644
/*
diff --git a/common/nit.c b/common/nit.c
index 3fdef1d..dc62081 100644
index 316e85f..6aa778b 100644
--- a/common/nit.c
+++ b/common/nit.c
@@ -75,7 +75,7 @@ int if_register_nit (info)
@ -168,7 +154,7 @@ index 526cebf..2ac8d43 100644
return;
}
diff --git a/common/upf.c b/common/upf.c
index 6a02077..e5cafcf 100644
index 34011eb..77d5878 100644
--- a/common/upf.c
+++ b/common/upf.c
@@ -71,7 +71,7 @@ int if_register_upf (info)
@ -180,70 +166,8 @@ index 6a02077..e5cafcf 100644
if (sock < 0) {
if (errno == EBUSY) {
continue;
diff --git a/dst/dst_api.c b/dst/dst_api.c
index 3993b1e..aadcc1f 100644
--- a/dst/dst_api.c
+++ b/dst/dst_api.c
@@ -437,7 +437,7 @@ dst_s_write_private_key(const DST_KEY *key)
PRIVATE_KEY, PATH_MAX);
/* Do not overwrite an existing file */
- if ((fp = dst_s_fopen(file, "w", 0600)) != NULL) {
+ if ((fp = dst_s_fopen(file, "we", 0600)) != NULL) {
int nn;
if ((nn = fwrite(encoded_block, 1, len, fp)) != len) {
EREPORT(("dst_write_private_key(): Write failure on %s %d != %d errno=%d\n",
@@ -495,7 +495,7 @@ dst_s_read_public_key(const char *in_name, const unsigned in_id, int in_alg)
* flags, proto, alg stored as decimal (or hex numbers FIXME).
* (FIXME: handle parentheses for line continuation.)
*/
- if ((fp = dst_s_fopen(name, "r", 0)) == NULL) {
+ if ((fp = dst_s_fopen(name, "re", 0)) == NULL) {
EREPORT(("dst_read_public_key(): Public Key not found %s\n",
name));
return (NULL);
@@ -621,7 +621,7 @@ dst_s_write_public_key(const DST_KEY *key)
return (0);
}
/* create public key file */
- if ((fp = dst_s_fopen(filename, "w+", 0644)) == NULL) {
+ if ((fp = dst_s_fopen(filename, "w+e", 0644)) == NULL) {
EREPORT(("DST_write_public_key: open of file:%s failed (errno=%d)\n",
filename, errno));
return (0);
@@ -855,7 +855,7 @@ dst_s_read_private_key_file(char *name, DST_KEY *pk_key, unsigned in_id,
return (0);
}
/* first check if we can find the key file */
- if ((fp = dst_s_fopen(filename, "r", 0)) == NULL) {
+ if ((fp = dst_s_fopen(filename, "re", 0)) == NULL) {
EREPORT(("dst_s_read_private_key_file: Could not open file %s in directory %s\n",
filename, dst_path[0] ? dst_path :
(char *) getcwd(NULL, PATH_MAX - 1)));
diff --git a/dst/prandom.c b/dst/prandom.c
index d207993..775cb23 100644
--- a/dst/prandom.c
+++ b/dst/prandom.c
@@ -270,7 +270,7 @@ get_dev_random(u_char *output, unsigned size)
s = stat("/dev/random", &st);
if (s == 0 && S_ISCHR(st.st_mode)) {
- if ((fd = open("/dev/random", O_RDONLY | O_NONBLOCK)) != -1) {
+ if ((fd = open("/dev/random", O_RDONLY | O_NONBLOCK | O_CLOEXEC)) != -1) {
if ((n = read(fd, output, size)) < 0)
n = 0;
close(fd);
@@ -480,7 +480,7 @@ digest_file(dst_work *work)
work->file_digest = dst_free_key(work->file_digest);
return (0);
}
- if ((fp = fopen(name, "r")) == NULL)
+ if ((fp = fopen(name, "re")) == NULL)
return (0);
for (no = 0; (i = fread(buf, sizeof(*buf), sizeof(buf), fp)) > 0;
no += i)
diff --git a/omapip/trace.c b/omapip/trace.c
index 23e4e50..846b42b 100644
index f4115c1..4410c35 100644
--- a/omapip/trace.c
+++ b/omapip/trace.c
@@ -138,10 +138,10 @@ isc_result_t trace_begin (const char *filename,
@ -269,10 +193,10 @@ index 23e4e50..846b42b 100644
log_error("Can't open tracefile %s: %m", filename);
return;
diff --git a/relay/dhcrelay.c b/relay/dhcrelay.c
index 6f42927..4ef6737 100644
index 15b4997..9d39fae 100644
--- a/relay/dhcrelay.c
+++ b/relay/dhcrelay.c
@@ -539,13 +539,14 @@ main(int argc, char **argv) {
@@ -558,13 +558,14 @@ main(int argc, char **argv) {
if (no_pid_file == ISC_FALSE) {
pfdesc = open(path_dhcrelay_pid,
@ -290,10 +214,10 @@ index 6f42927..4ef6737 100644
log_error("Can't fdopen %s: %m",
path_dhcrelay_pid);
diff --git a/server/confpars.c b/server/confpars.c
index 684f9c1..3b5a840 100644
index 4b2907d..6aa5b3f 100644
--- a/server/confpars.c
+++ b/server/confpars.c
@@ -110,7 +110,7 @@ isc_result_t read_conf_file (const char *filename, struct group *group,
@@ -111,7 +111,7 @@ isc_result_t read_conf_file (const char *filename, struct group *group,
}
#endif
@ -303,10 +227,10 @@ index 684f9c1..3b5a840 100644
log_error ("Can't open lease database %s: %m --",
path_dhcpd_db);
diff --git a/server/db.c b/server/db.c
index c2630ea..59e96dd 100644
index 0c642ad..e9a38fe 100644
--- a/server/db.c
+++ b/server/db.c
@@ -1050,7 +1050,7 @@ void db_startup (testp)
@@ -1072,7 +1072,7 @@ void db_startup (testp)
}
#endif
if (!testp) {
@ -315,51 +239,51 @@ index c2630ea..59e96dd 100644
if (!db_file)
log_fatal ("Can't open %s for append.", path_dhcpd_db);
expire_all_pools ();
@@ -1089,7 +1089,7 @@ int new_lease_file ()
db_validity = lease_file_is_corrupt;
@@ -1120,7 +1120,7 @@ int new_lease_file ()
path_dhcpd_db) >= sizeof newfname)
log_fatal("new_lease_file: lease file path too long");
snprintf (newfname, sizeof(newfname), "%s.XXXXXX", path_dhcpd_db);
- db_fd = mkstemp (newfname);
+ db_fd = mkostemp (newfname, O_CLOEXEC);
if (db_fd < 0) {
log_error ("Can't create new lease file: %m");
return 0;
@@ -1098,7 +1098,7 @@ int new_lease_file ()
log_error ("Can't fchmod new lease file: %m");
goto fail;
@@ -1145,7 +1145,7 @@ int new_lease_file ()
}
#endif /* PARANOIA */
- if ((new_db_file = fdopen(db_fd, "w")) == NULL) {
+ if ((new_db_file = fdopen(db_fd, "we")) == NULL) {
log_error("Can't fdopen new lease file: %m");
close(db_fd);
goto fdfail;
diff --git a/server/dhcpd.c b/server/dhcpd.c
index b4c1bef..41a9efe 100644
index eecc89b..afef390 100644
--- a/server/dhcpd.c
+++ b/server/dhcpd.c
@@ -805,7 +805,7 @@ main(int argc, char **argv) {
@@ -658,7 +658,7 @@ main(int argc, char **argv) {
*/
if ((lftest == 0) && (no_pid_file == ISC_FALSE)) {
/*Read previous pid file. */
- if ((i = open(path_dhcpd_pid, O_RDONLY)) >= 0) {
+ if ((i = open(path_dhcpd_pid, O_RDONLY | O_CLOEXEC)) >= 0) {
status = read(i, pbuf, (sizeof pbuf) - 1);
close(i);
if (status > 0) {
@@ -758,7 +758,7 @@ main(int argc, char **argv) {
* appropriate.
*/
if (no_pid_file == ISC_FALSE) {
/*Read previous pid file. */
- if ((i = open (path_dhcpd_pid, O_RDONLY)) >= 0) {
+ if ((i = open (path_dhcpd_pid, O_RDONLY | O_CLOEXEC)) >= 0) {
status = read(i, pbuf, (sizeof pbuf) - 1);
close (i);
if (status > 0) {
@@ -824,7 +824,7 @@ main(int argc, char **argv) {
}
/* Write new pid file. */
- i = open(path_dhcpd_pid, O_WRONLY|O_CREAT|O_TRUNC, 0644);
+ i = open(path_dhcpd_pid, O_WRONLY|O_CREAT|O_TRUNC|O_CLOEXEC, 0644);
if (i >= 0) {
sprintf(pbuf, "%d\n", (int) getpid());
IGNORE_RET (write(i, pbuf, strlen(pbuf)));
IGNORE_RET(write(i, pbuf, strlen(pbuf)));
diff --git a/server/ldap.c b/server/ldap.c
index 6e7f508..d1cde27 100644
index 2893b82..9530d9d 100644
--- a/server/ldap.c
+++ b/server/ldap.c
@@ -1252,7 +1252,7 @@ ldap_start (void)
@@ -1442,7 +1442,7 @@ ldap_start (void)
if (ldap_debug_file != NULL && ldap_debug_fd == -1)
{
@ -369,5 +293,5 @@ index 6e7f508..d1cde27 100644
log_error ("Error opening debug LDAP log file %s: %s", ldap_debug_file,
strerror (errno));
--
1.8.4
2.1.4

View File

@ -1,25 +0,0 @@
From d571408b5386b9bd72fd123b30298bdca8103b18 Mon Sep 17 00:00:00 2001
From: Marius Tomaschewski <mt@suse.de>
Date: Tue, 12 Jun 2012 10:21:57 +0200
Subject: [PATCH] dhcp-4.2.3-P1-dhclient-log-pid
---
client/dhclient.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/client/dhclient.c b/client/dhclient.c
index 65d9eeb..8af0a42 100644
--- a/client/dhclient.c
+++ b/client/dhclient.c
@@ -141,7 +141,7 @@ main(int argc, char **argv) {
else if (fd != -1)
close(fd);
- openlog("dhclient", LOG_NDELAY, LOG_DAEMON);
+ openlog("dhclient", LOG_NDELAY | LOG_PID, LOG_DAEMON);
#if !(defined(DEBUG) || defined(__CYGWIN32__))
setlogmask(LOG_UPTO(LOG_INFO));
--
1.8.4

View File

@ -1,70 +0,0 @@
From d9b443ef38da92bd325f5118a2a6ddc21fae098e Mon Sep 17 00:00:00 2001
From: Marius Tomaschewski <mt@suse.de>
Date: Thu, 20 Dec 2012 10:25:53 +0100
Subject: [PATCH] Ignore SIGPIPE to not die in socket code
Installed SIG_IGN handler for SIGPIPE to not die before
the errno==EPIPE checks in the socket code are reached.
Unlike isc_app_start(), the isc_app_ctxstart() used by
dhcp, does not set any signal handlers.
Reported upstream as [ISC-Bugs #32222], IMO regression
to [ISC-Bugs #22269] as the SO_NOSIGPIPE socket option
isn't available e.g. on Linux.
---
omapip/isclib.c | 32 +++++++++++++++++++++++++++++++-
1 file changed, 31 insertions(+), 1 deletion(-)
diff --git a/omapip/isclib.c b/omapip/isclib.c
index afab262..9b7ff5f 100644
--- a/omapip/isclib.c
+++ b/omapip/isclib.c
@@ -69,6 +69,23 @@ isclib_cleanup(void)
return;
}
+static isc_result_t
+handle_signal(int sig, void (*handler)(int)) {
+ struct sigaction sa;
+
+ memset(&sa, 0, sizeof(sa));
+ sa.sa_handler = handler;
+
+ if (sigfillset(&sa.sa_mask) != 0 ||
+ sigaction(sig, &sa, NULL) < 0) {
+ log_error("handle_signal() %d setup: %s",
+ sig, strerror(errno));
+ return (ISC_R_UNEXPECTED);
+ }
+
+ return (ISC_R_SUCCESS);
+}
+
isc_result_t
dhcp_context_create(void) {
isc_result_t result;
@@ -106,7 +123,20 @@ dhcp_context_create(void) {
result = isc_app_ctxstart(dhcp_gbl_ctx.actx);
if (result != ISC_R_SUCCESS)
- return (result);
+ goto cleanup;
+
+ /*
+ * Always ignore SIGPIPE.
+ * Otherwise we will die before the errno == EPIPE
+ * checks in the socket code are reached.
+ *
+ * Note: unlike isc_app_start(), isc_app_ctxstart()
+ * does not set any signal handlers.
+ */
+ result = handle_signal(SIGPIPE, SIG_IGN);
+ if (result != ISC_R_SUCCESS)
+ goto cleanup;
+
dhcp_gbl_ctx.actx_started = ISC_TRUE;
result = isc_taskmgr_createinctx(dhcp_gbl_ctx.mctx,
--
1.8.4

View File

@ -1,23 +0,0 @@
From 39c796224826836f0b0d1ab42f93a973545a94b0 Mon Sep 17 00:00:00 2001
From: Marius Tomaschewski <mt@suse.de>
Date: Mon, 10 Feb 2014 15:12:49 +0100
Subject: [PATCH] server: log DHCPv6 addresses assigned to clients
---
includes/site.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/includes/site.h b/includes/site.h
index 3de180c..1b6d0c0 100644
--- a/includes/site.h
+++ b/includes/site.h
@@ -281,5 +281,5 @@
This default to off to avoid changes to what is currently
logged. */
-/* #define LOG_V6_ADDRESSES */
+#define LOG_V6_ADDRESSES
--
1.8.4

View File

@ -1,532 +0,0 @@
From 6bf4a955f815967826994f787d2608d6dadadd91 Mon Sep 17 00:00:00 2001
From: root <root@reg-ovm-036-004.lab.mtl.com>
Date: Tue, 25 Mar 2014 23:15:58 +0200
Subject: [PATCH 1/2] dhcp 4.2.6 lpf ip over ib support
---
client/dhclient.c | 31 +++++++
common/bpf.c | 33 ++++++++
common/lpf.c | 236 +++++++++++++++++++++++++++++++++++++++++++++---------
common/socket.c | 8 +-
includes/dhcpd.h | 3 +-
5 files changed, 266 insertions(+), 45 deletions(-)
diff --git a/client/dhclient.c b/client/dhclient.c
index 8af0a42..f7dfbef 100644
--- a/client/dhclient.c
+++ b/client/dhclient.c
@@ -100,6 +100,29 @@ static int check_domain_name_list(const char *ptr, size_t len, int dots);
static int check_option_values(struct universe *universe, unsigned int opt,
const char *ptr, size_t len);
+static void setup_ib_interface(struct interface_info *ip)
+{
+ struct group *g;
+
+ /* Set the broadcast flag */
+ //ip->client->config->bootp_broadcast_always = 1;
+
+ /*
+ * Find out if a dhcp-client-identifier option was specified either
+ * in the config file or on the command line
+ */
+ for (g = ip->client->config->on_transmission; g != NULL; g = g->next) {
+ if ((g->statements != NULL) &&
+ (strcmp(g->statements->data.option->option->name,
+ "dhcp-client-identifier") == 0)) {
+ return;
+ }
+ }
+
+ /* No client ID specified */
+ log_fatal("dhcp-client-identifier must be specified for InfiniBand");
+}
+
int
main(int argc, char **argv) {
int fd;
@@ -619,6 +642,14 @@ main(int argc, char **argv) {
}
srandom(seed + cur_time + (unsigned)getpid());
+ /* Setup specific Infiniband options */
+ for (ip = interfaces; ip; ip = ip->next) {
+ if (ip->client &&
+ (ip->hw_address.hbuf[0] == HTYPE_INFINIBAND)) {
+ setup_ib_interface(ip);
+ }
+ }
+
/* Start a configuration state machine for each interface. */
#ifdef DHCPv6
if (local_family == AF_INET6) {
diff --git a/common/bpf.c b/common/bpf.c
index 076d9bc..124281b 100644
--- a/common/bpf.c
+++ b/common/bpf.c
@@ -198,11 +198,44 @@ struct bpf_insn dhcp_bpf_filter [] = {
BPF_STMT(BPF_RET+BPF_K, 0),
};
+/* Packet filter program for DHCP over Infiniband.
+ *
+ * XXX
+ * Changes to the filter program may require changes to the constant offsets
+ * used in lpf_gen_filter_setup to patch the port in the BPF program!
+ * XXX
+ */
+struct bpf_insn dhcp_ib_bpf_filter [] = {
+ /* Packet filter for Infiniband */
+ /* Make sure it's a UDP packet... */
+ BPF_STMT(BPF_LD + BPF_B + BPF_ABS, 9),
+ BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, IPPROTO_UDP, 0, 6),
+
+ /* Make sure this isn't a fragment... */
+ BPF_STMT(BPF_LD + BPF_H + BPF_ABS, 6),
+ BPF_JUMP(BPF_JMP + BPF_JSET + BPF_K, 0x1fff, 4, 0),
+
+ /* Get the IP header length... */
+ BPF_STMT(BPF_LDX + BPF_B + BPF_MSH, 0),
+
+ /* Make sure it's to the right port... */
+ BPF_STMT(BPF_LD + BPF_H + BPF_IND, 2),
+ BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, 67, 0, 1),
+
+ /* If we passed all the tests, ask for the whole packet. */
+ BPF_STMT(BPF_RET + BPF_K, (u_int)-1),
+
+ /* Otherwise, drop it. */
+ BPF_STMT(BPF_RET + BPF_K, 0),
+};
+
#if defined (DEC_FDDI)
struct bpf_insn *bpf_fddi_filter;
#endif
int dhcp_bpf_filter_len = sizeof dhcp_bpf_filter / sizeof (struct bpf_insn);
+int dhcp_ib_bpf_filter_len = sizeof dhcp_ib_bpf_filter / sizeof (struct bpf_insn);
+
#if defined (HAVE_TR_SUPPORT)
struct bpf_insn dhcp_bpf_tr_filter [] = {
/* accept all token ring packets due to variable length header */
diff --git a/common/lpf.c b/common/lpf.c
index 6639809..a428870 100644
--- a/common/lpf.c
+++ b/common/lpf.c
@@ -43,6 +43,7 @@
#include "includes/netinet/udp.h"
#include "includes/netinet/if_ether.h"
#include <net/if.h>
+#include <ifaddrs.h>
#ifndef PACKET_AUXDATA
#define PACKET_AUXDATA 8
@@ -60,6 +61,15 @@ struct tpacket_auxdata
/* Reinitializes the specified interface after an address change. This
is not required for packet-filter APIs. */
+/* Default broadcast address for IPoIB */
+static unsigned char default_ib_bcast_addr[20] = {
+ 0x00, 0xff, 0xff, 0xff,
+ 0xff, 0x12, 0x40, 0x1b,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff
+};
+
#ifdef USE_LPF_SEND
void if_reinitialize_send (info)
struct interface_info *info;
@@ -87,10 +97,21 @@ int if_register_lpf (info)
struct sockaddr common;
} sa;
struct ifreq ifr;
+ int type;
+ int protocol;
/* Make an LPF socket. */
- if ((sock = socket(PF_PACKET, SOCK_RAW,
- htons((short)ETH_P_ALL))) < 0) {
+ get_hw_addr(info);
+
+ if (info->hw_address.hbuf[0] == HTYPE_INFINIBAND) {
+ type = SOCK_DGRAM;
+ protocol = ETHERTYPE_IP;
+ } else {
+ type = SOCK_RAW;
+ protocol = ETH_P_ALL;
+ }
+
+ if ((sock = socket(PF_PACKET, type, htons((short)protocol))) < 0) {
if (errno == ENOPROTOOPT || errno == EPROTONOSUPPORT ||
errno == ESOCKTNOSUPPORT || errno == EPFNOSUPPORT ||
errno == EAFNOSUPPORT || errno == EINVAL) {
@@ -112,6 +133,7 @@ int if_register_lpf (info)
/* Bind to the interface name */
memset (&sa, 0, sizeof sa);
sa.ll.sll_family = AF_PACKET;
+ sa.ll.sll_protocol = htons(protocol);
sa.ll.sll_ifindex = ifr.ifr_ifindex;
if (bind (sock, &sa.common, sizeof sa)) {
if (errno == ENOPROTOOPT || errno == EPROTONOSUPPORT ||
@@ -127,8 +149,6 @@ int if_register_lpf (info)
log_fatal ("Bind socket to interface: %m");
}
- get_hw_addr(info->name, &info->hw_address);
-
return sock;
}
#endif /* USE_LPF_SEND || USE_LPF_RECEIVE */
@@ -183,6 +203,8 @@ void if_deregister_send (info)
in bpf includes... */
extern struct sock_filter dhcp_bpf_filter [];
extern int dhcp_bpf_filter_len;
+extern struct sock_filter dhcp_ib_bpf_filter [];
+extern int dhcp_ib_bpf_filter_len;
#if defined (HAVE_TR_SUPPORT)
extern struct sock_filter dhcp_bpf_tr_filter [];
@@ -200,11 +222,13 @@ void if_register_receive (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");
+ if (info->hw_address.hbuf[0] != HTYPE_INFINIBAND) {
+ 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)
@@ -250,15 +274,28 @@ static void lpf_gen_filter_setup (info)
memset(&p, 0, sizeof(p));
- /* Set up the bpf filter program structure. This is defined in
- bpf.c */
- p.len = dhcp_bpf_filter_len;
- p.filter = dhcp_bpf_filter;
-
- /* Patch the server port into the LPF program...
- XXX changes to filter program may require changes
- to the insn number(s) used below! XXX */
- dhcp_bpf_filter [8].k = ntohs ((short)local_port);
+ if (info->hw_address.hbuf[0] == HTYPE_INFINIBAND) {
+ /* Set up the bpf filter program structure. */
+ p.len = dhcp_ib_bpf_filter_len;
+ p.filter = dhcp_ib_bpf_filter;
+
+ /* Patch the server port into the LPF program...
+ XXX
+ changes to filter program may require changes
+ to the insn number(s) used below!
+ XXX */
+ dhcp_ib_bpf_filter[6].k = ntohs ((short)local_port);
+ } else {
+ /* Set up the bpf filter program structure.
+ This is defined in bpf.c */
+ p.len = dhcp_bpf_filter_len;
+ p.filter = dhcp_bpf_filter;
+
+ /* Patch the server port into the LPF program...
+ XXX changes to filter program may require changes
+ to the insn number(s) used below! XXX */
+ dhcp_bpf_filter [8].k = ntohs ((short)local_port);
+ }
if (setsockopt (info -> rfdesc, SOL_SOCKET, SO_ATTACH_FILTER, &p,
sizeof p) < 0) {
@@ -315,6 +352,54 @@ static void lpf_tr_filter_setup (info)
#endif /* USE_LPF_RECEIVE */
#ifdef USE_LPF_SEND
+ssize_t send_packet_ib(interface, packet, raw, len, from, to, hto)
+ struct interface_info *interface;
+ struct packet *packet;
+ struct dhcp_packet *raw;
+ size_t len;
+ struct in_addr from;
+ struct sockaddr_in *to;
+ struct hardware *hto;
+{
+ unsigned ibufp = 0;
+ double ih [1536 / sizeof (double)];
+ unsigned char *buf = (unsigned char *)ih;
+ ssize_t result;
+
+ union sockunion {
+ struct sockaddr sa;
+ struct sockaddr_ll sll;
+ struct sockaddr_storage ss;
+ } su;
+
+ assemble_udp_ip_header (interface, buf, &ibufp, from.s_addr,
+ to->sin_addr.s_addr, to->sin_port,
+ (unsigned char *)raw, len);
+ memcpy (buf + ibufp, raw, len);
+
+ memset(&su, 0, sizeof(su));
+ su.sll.sll_family = AF_PACKET;
+ su.sll.sll_protocol = htons(ETHERTYPE_IP);
+
+ if (!(su.sll.sll_ifindex = if_nametoindex(interface->name))) {
+ errno = ENOENT;
+ log_error ("send_packet_ib: %m - failed to get if index");
+ return -1;
+ }
+
+ su.sll.sll_hatype = htons(HTYPE_INFINIBAND);
+ su.sll.sll_halen = sizeof(interface->bcast_addr);
+ memcpy(&su.sll.sll_addr, interface->bcast_addr, 20);
+
+ result = sendto(interface->wfdesc, buf, ibufp + len, 0,
+ &su.sa, sizeof(su));
+
+ if (result < 0)
+ log_error ("send_packet_ib: %m");
+
+ return result;
+}
+
ssize_t send_packet (interface, packet, raw, len, from, to, hto)
struct interface_info *interface;
struct packet *packet;
@@ -335,6 +420,11 @@ ssize_t send_packet (interface, packet, raw, len, from, to, hto)
return send_fallback (interface, packet, raw,
len, from, to, hto);
+ if (interface->hw_address.hbuf[0] == HTYPE_INFINIBAND) {
+ return send_packet_ib(interface, packet, raw, len, from,
+ to, hto);
+ }
+
if (hto == NULL && interface->anycast_mac_addr.hlen)
hto = &interface->anycast_mac_addr;
@@ -356,6 +446,42 @@ ssize_t send_packet (interface, packet, raw, len, from, to, hto)
#endif /* USE_LPF_SEND */
#ifdef USE_LPF_RECEIVE
+ssize_t receive_packet_ib (interface, buf, len, from, hfrom)
+ struct interface_info *interface;
+ unsigned char *buf;
+ size_t len;
+ struct sockaddr_in *from;
+ struct hardware *hfrom;
+{
+ int length = 0;
+ int offset = 0;
+ unsigned char ibuf [1536];
+ unsigned bufix = 0;
+ unsigned paylen;
+
+ length = read(interface->rfdesc, ibuf, sizeof(ibuf));
+
+ if (length <= 0)
+ return length;
+
+ offset = decode_udp_ip_header(interface, ibuf, bufix, from,
+ (unsigned)length, &paylen, 0);
+
+ if (offset < 0)
+ return 0;
+
+ bufix += offset;
+ length -= offset;
+
+ if (length < paylen)
+ log_fatal("Internal inconsistency at %s:%d.", MDL);
+
+ /* Copy out the data in the packet... */
+ memcpy(buf, &ibuf[bufix], paylen);
+
+ return (ssize_t)paylen;
+}
+
ssize_t receive_packet (interface, buf, len, from, hfrom)
struct interface_info *interface;
unsigned char *buf;
@@ -382,6 +508,10 @@ ssize_t receive_packet (interface, buf, len, from, hfrom)
};
struct cmsghdr *cmsg;
+ if (interface->hw_address.hbuf[0] == HTYPE_INFINIBAND) {
+ return receive_packet_ib(interface, buf, len, from, hfrom);
+ }
+
length = recvmsg (interface -> rfdesc, &msg, 0);
if (length <= 0)
return length;
@@ -462,33 +592,41 @@ void maybe_setup_fallback ()
}
void
-get_hw_addr(const char *name, struct hardware *hw) {
- int sock;
- struct ifreq tmp;
- struct sockaddr *sa;
+get_hw_addr(struct interface_info *info)
+{
+ struct hardware *hw = &info->hw_address;
+ char *name = info->name;
+ struct ifaddrs *ifaddrs;
+ struct ifaddrs *ifa;
+ struct sockaddr_ll *sll = NULL;
- if (strlen(name) >= sizeof(tmp.ifr_name)) {
- log_fatal("Device name too long: \"%s\"", name);
- }
+ if (getifaddrs(&ifaddrs) == -1)
+ log_fatal("Failed to get interfaces");
- sock = socket(AF_INET, SOCK_DGRAM, 0);
- if (sock < 0) {
- log_fatal("Can't create socket for \"%s\": %m", name);
+ for (ifa = ifaddrs; ifa != NULL; ifa = ifa->ifa_next) {
+
+ if (ifa->ifa_addr->sa_family != AF_PACKET)
+ continue;
+
+ if (ifa->ifa_flags & IFF_LOOPBACK)
+ continue;
+
+ if (strcmp(ifa->ifa_name, name) == 0) {
+ sll = (struct sockaddr_ll *)(void *)ifa->ifa_addr;
+ break;
+ }
}
- memset(&tmp, 0, sizeof(tmp));
- strcpy(tmp.ifr_name, name);
- if (ioctl(sock, SIOCGIFHWADDR, &tmp) < 0) {
- log_fatal("Error getting hardware address for \"%s\": %m",
- name);
+ if (sll == NULL) {
+ freeifaddrs(ifaddrs);
+ log_fatal("Failed to get HW address for %s\n", name);
}
- sa = &tmp.ifr_hwaddr;
- switch (sa->sa_family) {
+ switch (sll->sll_hatype) {
case ARPHRD_ETHER:
hw->hlen = 7;
hw->hbuf[0] = HTYPE_ETHER;
- memcpy(&hw->hbuf[1], sa->sa_data, 6);
+ memcpy(&hw->hbuf[1], sll->sll_addr, 6);
break;
case ARPHRD_IEEE802:
#ifdef ARPHRD_IEEE802_TR
@@ -496,18 +634,36 @@ get_hw_addr(const char *name, struct hardware *hw) {
#endif /* ARPHRD_IEEE802_TR */
hw->hlen = 7;
hw->hbuf[0] = HTYPE_IEEE802;
- memcpy(&hw->hbuf[1], sa->sa_data, 6);
+ memcpy(&hw->hbuf[1], sll->sll_addr, 6);
break;
case ARPHRD_FDDI:
hw->hlen = 7;
hw->hbuf[0] = HTYPE_FDDI;
- memcpy(&hw->hbuf[1], sa->sa_data, 6);
+ memcpy(&hw->hbuf[1], sll->sll_addr, 6);
break;
+ case ARPHRD_INFINIBAND:
+ /* For Infiniband, save the broadcast address and store
+ * the port GUID into the hardware address.
+ */
+ if (ifa->ifa_flags & IFF_BROADCAST) {
+ struct sockaddr_ll *bll;
+
+ bll = (struct sockaddr_ll *)ifa->ifa_broadaddr;
+ memcpy(&info->bcast_addr, bll->sll_addr, 20);
+ } else {
+ memcpy(&info->bcast_addr, default_ib_bcast_addr,
+ 20);
+ }
+
+ hw->hlen = 1;
+ hw->hbuf[0] = HTYPE_INFINIBAND;
+ break;
default:
+ freeifaddrs(ifaddrs);
log_fatal("Unsupported device type %ld for \"%s\"",
- (long int)sa->sa_family, name);
+ (long int)sll->sll_family, name);
}
- close(sock);
+ freeifaddrs(ifaddrs);
}
#endif
diff --git a/common/socket.c b/common/socket.c
index e111d82..04c86e3 100644
--- a/common/socket.c
+++ b/common/socket.c
@@ -322,7 +322,7 @@ void if_register_send (info)
info->wfdesc = if_register_socket(info, AF_INET, 0, NULL);
/* If this is a normal IPv4 address, get the hardware address. */
if (strcmp(info->name, "fallback") != 0)
- get_hw_addr(info->name, &info->hw_address);
+ get_hw_addr(info);
#if defined (USE_SOCKET_FALLBACK)
/* Fallback only registers for send, but may need to receive as
well. */
@@ -385,7 +385,7 @@ void if_register_receive (info)
#endif /* IP_PKTINFO... */
/* If this is a normal IPv4 address, get the hardware address. */
if (strcmp(info->name, "fallback") != 0)
- get_hw_addr(info->name, &info->hw_address);
+ get_hw_addr(info);
if (!quiet_interface_discovery)
log_info ("Listening on Socket/%s%s%s",
@@ -499,7 +499,7 @@ if_register6(struct interface_info *info, int do_multicast) {
if (req_multi)
if_register_multicast(info);
- get_hw_addr(info->name, &info->hw_address);
+ get_hw_addr(info);
if (!quiet_interface_discovery) {
if (info->shared_network != NULL) {
@@ -555,7 +555,7 @@ if_register_linklocal6(struct interface_info *info) {
info->rfdesc = sock;
info->wfdesc = sock;
- get_hw_addr(info->name, &info->hw_address);
+ get_hw_addr(info);
if (!quiet_interface_discovery) {
if (info->shared_network != NULL) {
diff --git a/includes/dhcpd.h b/includes/dhcpd.h
index 68262e9..a52992b 100644
--- a/includes/dhcpd.h
+++ b/includes/dhcpd.h
@@ -1217,6 +1217,7 @@ struct interface_info {
struct shared_network *shared_network;
/* Networks connected to this interface. */
struct hardware hw_address; /* Its physical address. */
+ u_int8_t bcast_addr[20]; /* Infiniband broadcast address */
struct in_addr *addresses; /* Addresses associated with this
* interface.
*/
@@ -2346,7 +2347,7 @@ void print_dns_status (int, struct dhcp_ddns_cb *, isc_result_t);
#endif
const char *print_time(TIME);
-void get_hw_addr(const char *name, struct hardware *hw);
+void get_hw_addr(struct interface_info *info);
/* socket.c */
#if defined (USE_SOCKET_SEND) || defined (USE_SOCKET_RECEIVE) \
--
1.7.12.4

View File

@ -1,154 +0,0 @@
From 3a2059b67c3adfccd65f1e10aebf8ba73d51bcd1 Mon Sep 17 00:00:00 2001
From: root <root@reg-ovm-036-004.lab.mtl.com>
Date: Tue, 25 Mar 2014 23:30:18 +0200
Subject: [PATCH 2/2] dhcp 4.2.6 improved xid
---
client/dhclient.c | 70 ++++++++++++++++++++++++++++++++++++++++++++-----------
1 file changed, 56 insertions(+), 14 deletions(-)
diff --git a/client/dhclient.c b/client/dhclient.c
index f7dfbef..bfa99fb 100644
--- a/client/dhclient.c
+++ b/client/dhclient.c
@@ -619,6 +619,26 @@ main(int argc, char **argv) {
}
}
+ /* We create a backup seed before rediscovering interfaces in order to
+ have a seed built using all of the available interfaces
+ It's interesting if required interfaces doesn't let us defined
+ a really unique seed due to a lack of valid HW addr later
+ (this is the case with DHCP over IB)
+ We only use the last device as using a sum could broke the
+ uniqueness of the seed among multiple nodes
+ */
+ unsigned backup_seed = 0;
+ for (ip = interfaces; ip; ip = ip -> next) {
+ int junk;
+ if ( ip -> hw_address.hlen <= sizeof seed )
+ continue;
+ memcpy (&junk,
+ &ip -> hw_address.hbuf [ip -> hw_address.hlen -
+ sizeof seed], sizeof seed);
+ backup_seed = junk;
+ }
+
+
/* At this point, all the interfaces that the script thinks
are relevant should be running, so now we once again call
discover_interfaces(), and this time ask it to actually set
@@ -633,14 +653,36 @@ main(int argc, char **argv) {
Not much entropy, but we're booting, so we're not likely to
find anything better. */
seed = 0;
+ int seed_flag = 0;
for (ip = interfaces; ip; ip = ip->next) {
int junk;
+ if (ip->hw_address.hlen <= sizeof seed)
+ continue;
memcpy(&junk,
&ip->hw_address.hbuf[ip->hw_address.hlen -
sizeof seed], sizeof seed);
seed += junk;
+ seed_flag = 1;
}
- srandom(seed + cur_time + (unsigned)getpid());
+ if ( seed_flag == 0 ) {
+ if ( backup_seed != 0 ) {
+ seed = backup_seed;
+ log_info ("xid: rand init seed (0x%x) built using all"
+ " available interfaces",seed);
+ }
+ else {
+ seed = cur_time^((unsigned) gethostid()) ;
+ log_info ("xid: warning: no netdev with useable HWADDR found"
+ " for seed's uniqueness enforcement");
+ log_info ("xid: rand init seed (0x%x) built using gethostid",
+ seed);
+ }
+ /* we only use seed and no current time as a broadcast reply */
+ /* will certainly be used by the hwaddrless interface */
+ srandom(seed);
+ }
+ else
+ srandom(seed + cur_time + (unsigned)getpid());
/* Setup specific Infiniband options */
for (ip = interfaces; ip; ip = ip->next) {
@@ -1143,7 +1185,7 @@ void dhcpack (packet)
return;
}
- log_info ("DHCPACK from %s", piaddr (packet -> client_addr));
+ log_info ("DHCPACK from %s (xid=0x%x)", piaddr (packet -> client_addr), client -> xid);
lease = packet_to_lease (packet, client);
if (!lease) {
@@ -1861,7 +1903,7 @@ void dhcpnak (packet)
return;
}
- log_info ("DHCPNAK from %s", piaddr (packet -> client_addr));
+ log_info ("DHCPNAK from %s (xid=0x%x)", piaddr (packet -> client_addr), client -> xid);
if (!client -> active) {
#if defined (DEBUG)
@@ -1988,10 +2030,10 @@ void send_discover (cpp)
client -> packet.secs = htons (65535);
client -> secs = client -> packet.secs;
- log_info ("DHCPDISCOVER on %s to %s port %d interval %ld",
- client -> name ? client -> name : client -> interface -> name,
- inet_ntoa (sockaddr_broadcast.sin_addr),
- ntohs (sockaddr_broadcast.sin_port), (long)(client -> interval));
+ log_info ("DHCPDISCOVER on %s to %s port %d interval %ld (xid=0x%x)",
+ client -> name ? client -> name : client -> interface -> name,
+ inet_ntoa (sockaddr_broadcast.sin_addr),
+ ntohs (sockaddr_broadcast.sin_port), (long)(client -> interval), client -> xid);
/* Send out a packet. */
result = send_packet(client->interface, NULL, &client->packet,
@@ -2260,10 +2302,10 @@ void send_request (cpp)
client -> packet.secs = htons (65535);
}
- log_info ("DHCPREQUEST on %s to %s port %d",
+ log_info ("DHCPREQUEST on %s to %s port %d (xid=0x%x)",
client -> name ? client -> name : client -> interface -> name,
inet_ntoa (destination.sin_addr),
- ntohs (destination.sin_port));
+ ntohs (destination.sin_port), client -> xid);
if (destination.sin_addr.s_addr != INADDR_BROADCAST &&
fallback_interface) {
@@ -2303,10 +2345,10 @@ void send_decline (cpp)
int result;
- log_info ("DHCPDECLINE on %s to %s port %d",
- client->name ? client->name : client->interface->name,
+ log_info ("DHCPDECLINE on %s to %s port %d (xid=0x%x)",
+ client->name ? client->name : client->interface->name,
inet_ntoa(sockaddr_broadcast.sin_addr),
- ntohs(sockaddr_broadcast.sin_port));
+ ntohs (sockaddr_broadcast.sin_port), client -> xid);
/* Send out a packet. */
result = send_packet(client->interface, NULL, &client->packet,
@@ -2349,10 +2391,10 @@ void send_release (cpp)
return;
}
- log_info ("DHCPRELEASE on %s to %s port %d",
+ log_info ("DHCPRELEASE on %s to %s port %d (xid=0x%x)",
client -> name ? client -> name : client -> interface -> name,
inet_ntoa (destination.sin_addr),
- ntohs (destination.sin_port));
+ ntohs (destination.sin_port), client -> xid);
if (fallback_interface) {
result = send_packet(fallback_interface, NULL, &client->packet,
--
1.7.12.4

View File

@ -1,13 +0,0 @@
References: bnc#835818
--- dhcp-4.2.x-ldap/server/ldap.c
+++ dhcp-4.2.x-ldap/server/ldap.c 2014/04/15 01:34:59
@@ -2103,6 +2103,8 @@ ldap_read_config (void)
if (x_parser_length(cfile) > 0)
{
+ ldap_write_debug (cfile->inbuf, cfile->buflen);
+
res = conf_file_subparse (cfile, root_group, ROOT_GROUP);
if (res != ISC_R_SUCCESS)
{

View File

@ -1,10 +1,20 @@
References: bnc#868253
From 34e6100717f3de5a32ccb3234a949d017f789fdb Mon Sep 17 00:00:00 2001
From: Marius Tomaschewski <mt@suse.de>
Date: Tue, 10 Jun 2014 02:42:32 +0000
Subject: [PATCH] dhcp-4.2.x-chown-server-leases.bnc868253
--- dhcp-4.2.x/server/dhcpd.c
+++ dhcp-4.2.x/server/dhcpd.c 2014/06/10 01:59:13
@@ -783,8 +783,19 @@ main(int argc, char **argv) {
Fixed dhcp server to chown leases to run user at start
References: bnc#868253
Signed-off-by: Marius Tomaschewski <mt@suse.de>
diff --git a/server/dhcpd.c b/server/dhcpd.c
index afef390..0f5c640 100644
--- a/server/dhcpd.c
+++ b/server/dhcpd.c
@@ -770,8 +770,19 @@ main(int argc, char **argv) {
}
#if defined (PARANOIA)
- /* change uid to the specified one */
+ /* ensure, the leases db is owned by the run user/group */
@ -23,3 +33,6 @@ References: bnc#868253
if (set_gid) {
/* setgroups is done, OK */
if (setgroups (0, (void *)0))
--
2.1.4

View File

@ -1,32 +0,0 @@
Index: dhcp-4.2.4-P2/contrib/ldap/dhcpd-conf-to-ldap
===================================================================
--- dhcp-4.2.4-P2/contrib/ldap/dhcpd-conf-to-ldap
+++ dhcp-4.2.4-P2/contrib/ldap/dhcpd-conf-to-ldap
@@ -486,14 +486,23 @@ sub parse_subclass
$subclass = next_token (0);
parse_error () if !defined ($subclass);
- $tmp = next_token (0);
- parse_error () if !defined ($tmp);
- parse_error () if !($tmp eq '{');
-
+ if (substr($subclass,-1) eq ';') {
+ $tmp = ";";
+ $subclass = substr($subclass,0,-1);
+ } else {
+ $tmp = next_token (0);
+ parse_error () if !defined ($tmp);
+ }
+ parse_error () if !($tmp eq '{' or $tmp eq ';');
add_dn_to_stack ("cn=$subclass");
$curentry{'type'} = 'subclass';
$curentry{'class'} = $class;
$curentry{'subclass'} = $subclass;
+
+ if ($tmp eq ';') {
+ print_entry () if %curentry;
+ remove_dn_from_stack ();
+ }
}

View File

@ -1,250 +0,0 @@
Author: Ales Novak <alnovak@suse.com>
Subject: reorder config entries for ldap tree
References: bsc#886094, ISC-Bugs#37876
Upstream: sent
Reorder config to add all global options or option declarations
to the dhcpService object instead to create new service object,
e.g.:
option opt-one code 1 = text;
class "class-one" {
option opt-one "...";
};
option opt-two code 2 = text;
class "class-two" {
option opt-two "...";
};
has to contain both options (declarations) in the dhcpService,
followed by other objects as the dhcpClass objects under the
service in the ldap tree.
--- dhcp-4.2.4-P2/contrib/ldap/dhcpd-conf-to-ldap
+++ dhcp-4.2.4-P2/contrib/ldap/dhcpd-conf-to-ldap
@@ -137,6 +137,7 @@ add_dn_to_stack
local ($dn) = @_;
$current_dn = "$dn, $current_dn";
+ $curentry{'current_dn'} = $current_dn;
}
@@ -154,6 +155,26 @@ parse_error
exit (1);
}
+sub
+new_entry
+{
+ if (%curentry) {
+ $curentry{'current_dn'} = $current_dn;
+ push(@entrystack, {%curentry});
+ undef(%curentry);
+ }
+}
+
+sub
+pop_entry
+{
+ if (%curentry) {
+ push(@outputlist, {%curentry});
+ }
+ $rentry = pop(@entrystack);
+ %curentry = %$rentry if $rentry;
+}
+
sub
print_entry
@@ -167,7 +188,7 @@ print_entry
print "cn: $server\n";
print "objectClass: top\n";
print "objectClass: dhcpServer\n";
- print "dhcpServiceDN: $current_dn\n";
+ print "dhcpServiceDN: $curentry{'current_dn'}\n";
if(grep(/FaIlOvEr/i, @use))
{
foreach my $fo_peer (keys %failover)
@@ -179,7 +200,7 @@ print_entry
}
print "\n";
- print "dn: $current_dn\n";
+ print "dn: $curentry{'current_dn'}\n";
print "cn: $dhcpcn\n";
print "objectClass: top\n";
print "objectClass: dhcpService\n";
@@ -195,7 +216,7 @@ print_entry
}
elsif ($curentry{'type'} eq 'subnet')
{
- print "dn: $current_dn\n";
+ print "dn: $curentry{'current_dn'}\n";
print "cn: " . $curentry{'ip'} . "\n";
print "objectClass: top\n";
print "objectClass: dhcpSubnet\n";
@@ -215,7 +236,7 @@ print_entry
}
elsif ($curentry{'type'} eq 'shared-network')
{
- print "dn: $current_dn\n";
+ print "dn: $curentry{'current_dn'}\n";
print "cn: " . $curentry{'descr'} . "\n";
print "objectClass: top\n";
print "objectClass: dhcpSharedNetwork\n";
@@ -226,7 +247,7 @@ print_entry
}
elsif ($curentry{'type'} eq 'group')
{
- print "dn: $current_dn\n";
+ print "dn: $curentry{'current_dn'}\n";
print "cn: group", $curentry{'idx'}, "\n";
print "objectClass: top\n";
print "objectClass: dhcpGroup\n";
@@ -237,7 +258,7 @@ print_entry
}
elsif ($curentry{'type'} eq 'host')
{
- print "dn: $current_dn\n";
+ print "dn: $curentry{'current_dn'}\n";
print "cn: " . $curentry{'host'} . "\n";
print "objectClass: top\n";
print "objectClass: dhcpHost\n";
@@ -254,7 +275,7 @@ print_entry
}
elsif ($curentry{'type'} eq 'pool')
{
- print "dn: $current_dn\n";
+ print "dn: $curentry{'current_dn'}\n";
print "cn: pool", $curentry{'idx'}, "\n";
print "objectClass: top\n";
print "objectClass: dhcpPool\n";
@@ -273,7 +294,7 @@ print_entry
}
elsif ($curentry{'type'} eq 'class')
{
- print "dn: $current_dn\n";
+ print "dn: $curentry{'current_dn'}\n";
print "cn: " . $curentry{'class'} . "\n";
print "objectClass: top\n";
print "objectClass: dhcpClass\n";
@@ -284,7 +305,7 @@ print_entry
}
elsif ($curentry{'type'} eq 'subclass')
{
- print "dn: $current_dn\n";
+ print "dn: $curentry{'current_dn'}\n";
print "cn: " . $curentry{'subclass'} . "\n";
print "objectClass: top\n";
print "objectClass: dhcpSubClass\n";
@@ -344,7 +365,7 @@ sub parse_subnet
{
local ($ip, $tmp, $netmask);
- print_entry () if %curentry;
+ new_entry ();
$ip = next_token (0);
parse_error () if !defined ($ip);
@@ -374,7 +395,7 @@ sub parse_shared_network
{
local ($descr, $tmp);
- print_entry () if %curentry;
+ new_entry ();
$descr = next_token (0);
parse_error () if !defined ($descr);
@@ -393,7 +414,7 @@ sub parse_host
{
local ($descr, $tmp);
- print_entry () if %curentry;
+ new_entry ();
$host = next_token (0);
parse_error () if !defined ($host);
@@ -412,7 +433,7 @@ sub parse_group
{
local ($descr, $tmp);
- print_entry () if %curentry;
+ new_entry ();
$tmp = next_token (0);
parse_error () if !defined ($tmp);
@@ -435,7 +456,7 @@ sub parse_pool
{
local ($descr, $tmp);
- print_entry () if %curentry;
+ new_entry ();
$tmp = next_token (0);
parse_error () if !defined ($tmp);
@@ -458,7 +479,7 @@ sub parse_class
{
local ($descr, $tmp);
- print_entry () if %curentry;
+ new_entry ();
$class = next_token (0);
parse_error () if !defined ($class);
@@ -478,7 +499,7 @@ sub parse_subclass
{
local ($descr, $tmp);
- print_entry () if %curentry;
+ new_entry ();
$class = next_token (0);
parse_error () if !defined ($class);
@@ -500,7 +521,7 @@ sub parse_subclass
$curentry{'subclass'} = $subclass;
if ($tmp eq ';') {
- print_entry () if %curentry;
+ pop_entry ();
remove_dn_from_stack ();
}
}
@@ -691,11 +712,11 @@ print STDERR "\n";
my $token;
my $token_number = 0;
my $line_number = 0;
-my %curentry;
my $cursubnet = '';
my %curcounter = ( '' => { pool => 0, group => 0 } );
$current_dn = "$dhcpdn";
+$curentry{'current_dn'} = $current_dn;
$curentry{'descr'} = $dhcpcn;
$line = '';
%failover = ();
@@ -704,7 +725,7 @@ while (($token = next_token (1)))
{
if ($token eq '}')
{
- print_entry () if %curentry;
+ pop_entry ();
if($current_dn =~ /.+?,\s*${dhcpdn}$/) {
# don't go below dhcpdn ...
remove_dn_from_stack ();
@@ -762,6 +783,16 @@ while (($token = next_token (1)))
}
}
+pop_entry ();
+
+while ($#outputlist >= 0) {
+ $rentry = pop(@outputlist);
+ if ($rentry) {
+ %curentry = %$rentry;
+ print_entry ();
+ }
+}
+
close(STDIN) if($i_conf);
close(STDOUT) if($o_ldif);

View File

@ -1,92 +0,0 @@
Author: Thomas Markwalder <tmark@isc.org>
Subject: Addes addtional HMAC TSIG algorithms to DDNS
References: bsc#890731, ISC-Bugs#36947
Upstream: yes
TSIG-authenticated dynamic DNS updates now support the use of these
additional algorithms: hmac-sha1, hmac_sha224, hmac_sha256, hmac_sha384,
and hmac_sha512. [ISC-Bugs #36947]
RFC4635 updates RFC2845 and mandates hmac-sha1 and hmac-sha256 support.
diff --git a/includes/omapip/isclib.h b/includes/omapip/isclib.h
index fc45ef3..a9df110 100644
--- a/includes/omapip/isclib.h
+++ b/includes/omapip/isclib.h
@@ -104,6 +104,11 @@ extern dhcp_context_t dhcp_gbl_ctx;
#define DHCP_MAXDNS_WIRE 256
#define DHCP_MAXNS 3
#define DHCP_HMAC_MD5_NAME "HMAC-MD5.SIG-ALG.REG.INT."
+#define DHCP_HMAC_SHA1_NAME "HMAC-SHA1.SIG-ALG.REG.INT."
+#define DHCP_HMAC_SHA224_NAME "HMAC-SHA224.SIG-ALG.REG.INT."
+#define DHCP_HMAC_SHA256_NAME "HMAC-SHA256.SIG-ALG.REG.INT."
+#define DHCP_HMAC_SHA384_NAME "HMAC-SHA384.SIG-ALG.REG.INT."
+#define DHCP_HMAC_SHA512_NAME "HMAC-SHA512.SIG-ALG.REG.INT."
isc_result_t dhcp_isc_name(unsigned char *namestr,
dns_fixedname_t *namefix,
diff --git a/omapip/isclib.c b/omapip/isclib.c
index 9b7ff5f..e9cb321 100644
--- a/omapip/isclib.c
+++ b/omapip/isclib.c
@@ -230,12 +230,24 @@ isclib_make_dst_key(char *inname,
dns_name_t *name;
dns_fixedname_t name0;
isc_buffer_t b;
+ unsigned int algorithm_code;
isc_buffer_init(&b, secret, length);
isc_buffer_add(&b, length);
- /* We only support HMAC_MD5 currently */
- if (strcasecmp(algorithm, DHCP_HMAC_MD5_NAME) != 0) {
+ if (strcasecmp(algorithm, DHCP_HMAC_MD5_NAME) == 0) {
+ algorithm_code = DST_ALG_HMACMD5;
+ } else if (strcasecmp(algorithm, DHCP_HMAC_SHA1_NAME) == 0) {
+ algorithm_code = DST_ALG_HMACSHA1;
+ } else if (strcasecmp(algorithm, DHCP_HMAC_SHA224_NAME) == 0) {
+ algorithm_code = DST_ALG_HMACSHA224;
+ } else if (strcasecmp(algorithm, DHCP_HMAC_SHA256_NAME) == 0) {
+ algorithm_code = DST_ALG_HMACSHA256;
+ } else if (strcasecmp(algorithm, DHCP_HMAC_SHA384_NAME) == 0) {
+ algorithm_code = DST_ALG_HMACSHA384;
+ } else if (strcasecmp(algorithm, DHCP_HMAC_SHA512_NAME) == 0) {
+ algorithm_code = DST_ALG_HMACSHA512;
+ } else {
return(DHCP_R_INVALIDARG);
}
@@ -244,7 +256,7 @@ isclib_make_dst_key(char *inname,
return(result);
}
- return(dst_key_frombuffer(name, DST_ALG_HMACMD5, DNS_KEYOWNER_ENTITY,
+ return(dst_key_frombuffer(name, algorithm_code, DNS_KEYOWNER_ENTITY,
DNS_KEYPROTO_DNSSEC, dns_rdataclass_in,
&b, dhcp_gbl_ctx.mctx, dstkey));
}
diff --git a/server/dhcpd.conf.5 b/server/dhcpd.conf.5
index e639db6..def7bec 100644
--- a/server/dhcpd.conf.5
+++ b/server/dhcpd.conf.5
@@ -1388,11 +1388,16 @@ dnssec-keygen, the above key would be created as follows:
dnssec-keygen -a HMAC-MD5 -b 128 -n USER DHCP_UPDATER
.fi
.PP
-If you are using the BIND 8 dnskeygen program, the following command will
-generate a key as seen above:
-.PP
+The key name, algorithm, and secret must match that being used by the DNS
+server. The DHCP server currently supports the following algorithms:
.nf
- dnskeygen -H 128 -u -c -n DHCP_UPDATER
+
+ HMAC-MD5
+ HMAC-SHA1
+ HMAC-SHA224
+ HMAC-SHA256
+ HMAC-SHA384
+ HMAC-SHA512
.fi
.PP
You may wish to enable logging of DNS updates on your DNS server.

View File

@ -1,57 +0,0 @@
Author: Jiri Popelka <jpopelka@redhat.com>
References: bsc#872609, ISC-Bugs#21238
Upstream: yes
In client initiated message exchanges stop retransmission upon
reaching the MRD rather than at some point after it (#559153)
(Submitted to dhcp-bugs@isc.org - [ISC-Bugs #21238])
diff --git a/client/dhc6.c b/client/dhc6.c
index f8ad25d..63cbb65 100644
--- a/client/dhc6.c
+++ b/client/dhc6.c
@@ -365,7 +365,7 @@ dhc6_retrans_init(struct client_state *client)
static void
dhc6_retrans_advance(struct client_state *client)
{
- struct timeval elapsed;
+ struct timeval elapsed, elapsed_after_RT;
/* elapsed = cur - start */
elapsed.tv_sec = cur_tv.tv_sec - client->start_time.tv_sec;
@@ -382,6 +382,8 @@ dhc6_retrans_advance(struct client_state *client)
elapsed.tv_sec += 1;
elapsed.tv_usec -= 1000000;
}
+ elapsed_after_RT.tv_sec = elapsed.tv_sec;
+ elapsed_after_RT.tv_usec = elapsed.tv_usec;
/*
* RT for each subsequent message transmission is based on the previous
@@ -419,13 +421,10 @@ dhc6_retrans_advance(struct client_state *client)
elapsed.tv_usec -= 1000000;
}
if (elapsed.tv_sec >= client->MRD) {
- /*
- * wake at RT + cur = start + MRD
- */
- client->RT = client->MRD +
- (client->start_time.tv_sec - cur_tv.tv_sec);
- client->RT = client->RT * 100 +
- (client->start_time.tv_usec - cur_tv.tv_usec) / 10000;
+ client->RT = client->MRD - elapsed_after_RT.tv_sec;
+ client->RT = client->RT * 100 - elapsed_after_RT.tv_usec / 10000;
+ if (client->RT < 0)
+ client->RT = 0;
}
client->txcount++;
}
@@ -1502,7 +1501,7 @@ check_timing6 (struct client_state *client, u_int8_t msg_type,
}
/* Check if finished (-1 argument). */
- if ((client->MRD != 0) && (elapsed.tv_sec > client->MRD)) {
+ if ((client->MRD != 0) && (elapsed.tv_sec >= client->MRD)) {
log_info("Max retransmission duration exceeded.");
return(CHK_TIM_MRD_EXCEEDED);
}

View File

@ -1,292 +0,0 @@
Author: William Preston <wpreston@suse.com>
Subject: do not bind ddns socket in server when ddns-update-style is none
References: bsc#891655
Upstream: yes
backported from commit 61ef216b8dc05bc4245b61eee812038757d12ffe
by Shawn Routhier <sar@isc.org> with changes.
diff --git a/client/dhclient.c b/client/dhclient.c
index bfa99fb..93f1dfc 100644
--- a/client/dhclient.c
+++ b/client/dhclient.c
@@ -171,7 +171,7 @@ main(int argc, char **argv) {
#endif
/* Set up the isc and dns library managers */
- status = dhcp_context_create();
+ status = dhcp_context_create(DHCP_CONTEXT_PRE_DB | DHCP_CONTEXT_POST_DB);
if (status != ISC_R_SUCCESS)
log_fatal("Can't initialize context: %s",
isc_result_totext(status));
diff --git a/dhcpctl/dhcpctl.c b/dhcpctl/dhcpctl.c
index a4aee7f..2217956 100644
--- a/dhcpctl/dhcpctl.c
+++ b/dhcpctl/dhcpctl.c
@@ -43,7 +43,7 @@ dhcpctl_status dhcpctl_initialize ()
isc_result_t status;
/* Set up the isc and dns library managers */
- status = dhcp_context_create();
+ status = dhcp_context_create(DHCP_CONTEXT_PRE_DB | DHCP_CONTEXT_POST_DB);
if (status != ISC_R_SUCCESS)
return status;
diff --git a/includes/omapip/isclib.h b/includes/omapip/isclib.h
index a9df110..05a18f1 100644
--- a/includes/omapip/isclib.h
+++ b/includes/omapip/isclib.h
@@ -121,7 +121,9 @@ isclib_make_dst_key(char *inname,
int length,
dst_key_t **dstkey);
-isc_result_t dhcp_context_create(void);
+#define DHCP_CONTEXT_PRE_DB 1
+#define DHCP_CONTEXT_POST_DB 2
+isc_result_t dhcp_context_create(int flags);
void isclib_cleanup(void);
void dhcp_signal_handler(int signal);
diff --git a/omapip/isclib.c b/omapip/isclib.c
index e9cb321..d833bc9 100644
--- a/omapip/isclib.c
+++ b/omapip/isclib.c
@@ -87,98 +87,102 @@ handle_signal(int sig, void (*handler)(int)) {
}
isc_result_t
-dhcp_context_create(void) {
+dhcp_context_create(int flags) {
isc_result_t result;
- /*
- * Set up the error messages, this isn't the right place
- * for this call but it is convienent for now.
- */
- result = dhcp_result_register();
- if (result != ISC_R_SUCCESS) {
- log_fatal("register_table() %s: %u", "failed", result);
- }
-
- memset(&dhcp_gbl_ctx, 0, sizeof (dhcp_gbl_ctx));
+ if ((flags & DHCP_CONTEXT_PRE_DB) != 0) {
+ /*
+ * Set up the error messages, this isn't the right place
+ * for this call but it is convienent for now.
+ */
+ result = dhcp_result_register();
+ if (result != ISC_R_SUCCESS) {
+ log_fatal("register_table() %s: %u", "failed", result);
+ }
+
+ memset(&dhcp_gbl_ctx, 0, sizeof (dhcp_gbl_ctx));
- isc_lib_register();
+ isc_lib_register();
- /* get the current time for use as the random seed */
- gettimeofday(&cur_tv, (struct timezone *)0);
- isc_random_seed(cur_tv.tv_sec);
+ /* get the current time for use as the random seed */
+ gettimeofday(&cur_tv, (struct timezone *)0);
+ isc_random_seed(cur_tv.tv_sec);
#if defined (NSUPDATE)
- result = dns_lib_init();
- if (result != ISC_R_SUCCESS)
- goto cleanup;
+ result = dns_lib_init();
+ if (result != ISC_R_SUCCESS)
+ goto cleanup;
+#else
+ /* The dst library is inited as part of dns_lib_init, we don't
+ * need it if NSUPDATE is enabled */
+ result = dst_lib_init(dhcp_gbl_ctx.mctx, NULL, 0);
+ if (result != ISC_R_SUCCESS)
+ goto cleanup;
#endif
- result = isc_mem_create(0, 0, &dhcp_gbl_ctx.mctx);
- if (result != ISC_R_SUCCESS)
- goto cleanup;
-
- result = isc_appctx_create(dhcp_gbl_ctx.mctx, &dhcp_gbl_ctx.actx);
- if (result != ISC_R_SUCCESS)
- goto cleanup;
-
- result = isc_app_ctxstart(dhcp_gbl_ctx.actx);
- if (result != ISC_R_SUCCESS)
- goto cleanup;
-
- /*
- * Always ignore SIGPIPE.
- * Otherwise we will die before the errno == EPIPE
- * checks in the socket code are reached.
- *
- * Note: unlike isc_app_start(), isc_app_ctxstart()
- * does not set any signal handlers.
- */
- result = handle_signal(SIGPIPE, SIG_IGN);
- if (result != ISC_R_SUCCESS)
- goto cleanup;
-
- dhcp_gbl_ctx.actx_started = ISC_TRUE;
-
- result = isc_taskmgr_createinctx(dhcp_gbl_ctx.mctx,
- dhcp_gbl_ctx.actx,
- 1, 0,
- &dhcp_gbl_ctx.taskmgr);
- if (result != ISC_R_SUCCESS)
- goto cleanup;
-
- result = isc_socketmgr_createinctx(dhcp_gbl_ctx.mctx,
- dhcp_gbl_ctx.actx,
- &dhcp_gbl_ctx.socketmgr);
- if (result != ISC_R_SUCCESS)
- goto cleanup;
-
- result = isc_timermgr_createinctx(dhcp_gbl_ctx.mctx,
- dhcp_gbl_ctx.actx,
- &dhcp_gbl_ctx.timermgr);
- if (result != ISC_R_SUCCESS)
- goto cleanup;
-
- result = isc_task_create(dhcp_gbl_ctx.taskmgr, 0, &dhcp_gbl_ctx.task);
- if (result != ISC_R_SUCCESS)
- goto cleanup;
+ result = isc_mem_create(0, 0, &dhcp_gbl_ctx.mctx);
+ if (result != ISC_R_SUCCESS)
+ goto cleanup;
+
+ result = isc_appctx_create(dhcp_gbl_ctx.mctx, &dhcp_gbl_ctx.actx);
+ if (result != ISC_R_SUCCESS)
+ goto cleanup;
+
+ result = isc_app_ctxstart(dhcp_gbl_ctx.actx);
+ if (result != ISC_R_SUCCESS)
+ goto cleanup;
+
+ /*
+ * Always ignore SIGPIPE.
+ * Otherwise we will die before the errno == EPIPE
+ * checks in the socket code are reached.
+ *
+ * Note: unlike isc_app_start(), isc_app_ctxstart()
+ * does not set any signal handlers.
+ */
+ result = handle_signal(SIGPIPE, SIG_IGN);
+ if (result != ISC_R_SUCCESS)
+ goto cleanup;
+
+ dhcp_gbl_ctx.actx_started = ISC_TRUE;
+
+ result = isc_taskmgr_createinctx(dhcp_gbl_ctx.mctx,
+ dhcp_gbl_ctx.actx,
+ 1, 0,
+ &dhcp_gbl_ctx.taskmgr);
+ if (result != ISC_R_SUCCESS)
+ goto cleanup;
+
+ result = isc_socketmgr_createinctx(dhcp_gbl_ctx.mctx,
+ dhcp_gbl_ctx.actx,
+ &dhcp_gbl_ctx.socketmgr);
+ if (result != ISC_R_SUCCESS)
+ goto cleanup;
+
+ result = isc_timermgr_createinctx(dhcp_gbl_ctx.mctx,
+ dhcp_gbl_ctx.actx,
+ &dhcp_gbl_ctx.timermgr);
+ if (result != ISC_R_SUCCESS)
+ goto cleanup;
+
+ result = isc_task_create(dhcp_gbl_ctx.taskmgr, 0, &dhcp_gbl_ctx.task);
+ if (result != ISC_R_SUCCESS)
+ goto cleanup;
+ }
#if defined (NSUPDATE)
- result = dns_client_createx(dhcp_gbl_ctx.mctx,
- dhcp_gbl_ctx.actx,
- dhcp_gbl_ctx.taskmgr,
- dhcp_gbl_ctx.socketmgr,
- dhcp_gbl_ctx.timermgr,
- 0,
- &dhcp_gbl_ctx.dnsclient);
- if (result != ISC_R_SUCCESS)
- goto cleanup;
-#else
- /* The dst library is inited as part of dns_lib_init, we don't
- * need it if NSUPDATE is enabled */
- result = dst_lib_init(dhcp_gbl_ctx.mctx, NULL, 0);
- if (result != ISC_R_SUCCESS)
- goto cleanup;
-
+ if ((flags & DHCP_CONTEXT_POST_DB) != 0) {
+
+ result = dns_client_createx(dhcp_gbl_ctx.mctx,
+ dhcp_gbl_ctx.actx,
+ dhcp_gbl_ctx.taskmgr,
+ dhcp_gbl_ctx.socketmgr,
+ dhcp_gbl_ctx.timermgr,
+ 0,
+ &dhcp_gbl_ctx.dnsclient);
+ if (result != ISC_R_SUCCESS)
+ goto cleanup;
+ }
#endif
return(ISC_R_SUCCESS);
diff --git a/omapip/test.c b/omapip/test.c
index e97a61f..2735716 100644
--- a/omapip/test.c
+++ b/omapip/test.c
@@ -45,7 +45,7 @@ int main (int argc, char **argv)
omapi_object_t *connection = (omapi_object_t*)0;
isc_result_t status;
- status = dhcp_context_create();
+ status = dhcp_context_create(DHCP_CONTEXT_PRE_DB | DHCP_CONTEXT_POST_DB);
if (status != ISC_R_SUCCESS) {
fprintf(stderr, "Can't initialize context: %s\n",
isc_result_totext(status));
diff --git a/relay/dhcrelay.c b/relay/dhcrelay.c
index 4ef6737..15e5c46 100644
--- a/relay/dhcrelay.c
+++ b/relay/dhcrelay.c
@@ -195,7 +195,7 @@ main(int argc, char **argv) {
#endif
/* Set up the isc and dns library managers */
- status = dhcp_context_create();
+ status = dhcp_context_create(DHCP_CONTEXT_PRE_DB | DHCP_CONTEXT_POST_DB);
if (status != ISC_R_SUCCESS)
log_fatal("Can't initialize context: %s",
isc_result_totext(status));
diff --git a/server/dhcpd.c b/server/dhcpd.c
index b28c34c..434db00 100644
--- a/server/dhcpd.c
+++ b/server/dhcpd.c
@@ -281,7 +281,7 @@ main(int argc, char **argv) {
close(fd);
/* Set up the isc and dns library managers */
- status = dhcp_context_create();
+ status = dhcp_context_create(DHCP_CONTEXT_PRE_DB);
if (status != ISC_R_SUCCESS)
log_fatal("Can't initialize context: %s",
isc_result_totext(status));
@@ -1100,6 +1100,11 @@ void postconf_initialization (int quiet)
if (ddns_update_style == DDNS_UPDATE_STYLE_AD_HOC) {
log_fatal("ddns-update-style ad_hoc no longer supported");
}
+
+ if (ddns_update_style != DDNS_UPDATE_STYLE_NONE && dhcp_context_create(DHCP_CONTEXT_POST_DB)
+ != ISC_R_SUCCESS)
+ log_fatal("Unable to complete ddns initialization");
+
#else
/* If we don't have support for updates compiled in tell the user */
if (ddns_update_style != DDNS_UPDATE_STYLE_NONE) {
--
2.1.2

View File

@ -1,28 +0,0 @@
From 17e0eabe7700d02b48ed8b0a923427caad3b7b4b Mon Sep 17 00:00:00 2001
From: Jiri Slaby <jslaby@suse.cz>
Date: Wed, 10 Dec 2014 13:48:03 +0100
Subject: [PATCH] dhcp-4.2.x-handle-ifa_addr-NULL.909189
References: bsc#909189,bnc#870535
Fix to not crash in interface discovery when the interface
address is NULL. Bug has been introduced by the infiniband
support patch (bsc#870535).
diff --git a/common/lpf.c b/common/lpf.c
index 9dc6053..892ccce 100644
--- a/common/lpf.c
+++ b/common/lpf.c
@@ -605,6 +605,9 @@ get_hw_addr(struct interface_info *info)
for (ifa = ifaddrs; ifa != NULL; ifa = ifa->ifa_next) {
+ if (!ifa->ifa_addr)
+ continue;
+
if (ifa->ifa_addr->sa_family != AF_PACKET)
continue;
--
2.2.0

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:ab3aaab3c938a1c0e44fd75ee4d51682d35eb8328e991006cc6ee17514bfe291
size 8935311

View File

@ -1,11 +0,0 @@
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (NetBSD)
iQEcBAABAgAGBQJS79gLAAoJEEWseFcYnNvFa08H+wRSA6dSHI6I86Qth7rDLvUX
JpGUILrypagAadb6a+UzpvEluhP8hg8Lex/PnskgOHDhkBqqiQLKp38B+2/LqxhU
Tx+yh9TikCLEf/I5vj6CWhZT7nip3WqfhXv+Z0EeIxsjgXPw6VEgGPpj/M6F8qqM
dmGmuzBWeXSnMEIwDGGW03dijN0ngfWl+9Be9A3l7dzfUAUVM6PwtLt72GA60K98
/X8ZOgsRy6vOI9Nc7R6JPPD9lxx7Qp6meN0y3OtXjSZ1tvdeEjk2HGNJaNh4P/oZ
vzwi1yxAVA7JY8XPPJsBydruFfTB2Qx5M/Kn57bQOZnlWwSgXds2pEbv2JfgpYU=
=sDT9
-----END PGP SIGNATURE-----

3
dhcp-4.3.3.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:553c4945b09b1c1b904c4780f34f72aaefa2fc8c6556715de0bc9d4e3d255ede
size 9205539

11
dhcp-4.3.3.tar.gz.asc Normal file
View File

@ -0,0 +1,11 @@
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
iQEcBAABAgAGBQJV5YwhAAoJEG+m68mRGkwC0yYH/2qvlrVxE9odY8mooEWL3Mw4
h7KycYZC5js2rY+u2DT7UHE3UnD671NzZQyGVYZaHYfFo3daW0OIt+CXV+H14jOt
Ai2OXU+6HiKNhT3WhCeoA4YFU1wflnxVeT0Cx7J40AUDewjkuAthZrF1jXrh8djQ
1VJ1Dq6HtkX5P1X+L84ugsMosXRoqMWmnUITE6GdzKqK29VQ8Y3jnCF1PJE1BwFJ
kYC3iwPjLKfPElEPROuK7bFUej1mr8agTM8lBcipMCtYx6R4DJoyviZ81tI+TzOm
PvPySKcM59o89XOqdgJ9xM2onlWCZHFLuw8ngY7MnyGFWLD92wFktAK6K6H2gWQ=
=Ezci
-----END PGP SIGNATURE-----

View File

@ -1,3 +1,36 @@
-------------------------------------------------------------------
Mon Sep 14 11:02:45 UTC 2015 - mt@suse.de
- Update to dhcp-4.3.3 (fate#319067) provinding many bug fixes,
features and obsoletes several patches we were using before.
For complete list of the changes, please read the RELNOTES
file shipped along with the package or online:
https://kb.isc.org/article/AA-01297/82/DHCP-4.3.3-Release-Notes.html
- Removed obsolete patches included upstream now:
[- 0007-dhcp-4.2.6-ldap-mt01.patch,
- 0009-dhcp-4.2.6-xen-checksum.patch,
- 0013-dhcp-4.2.3-P1-dhclient-log-pid.patch,
- 0015-Ignore-SIGPIPE-to-not-die-in-socket-code.patch,
- 0016-server-log-DHCPv6-addresses-assigned-to-clients.patch,
- 0019-dhcp-4.2.x-ldap-debug-write.bnc835818.patch,
- 0021-dhcp-4.2.4-P2-bnc878846-conf-to-ldap.patch,
- 0022-dhcp-4.2.x-contrib-conf-to-ldap-reorder.886094.patch,
- 0023-dhcp-4.2.x-ddns-tsig-hmac-sha-support.890731.patch,
- 0025-dhcp-4.2.x-dhcpv6-retransmission-until-MRD.872609.patch,
- 0026-dhcp-4.2.x-disable-unused-ddns-port-in-server.891655.patch]
- Replaced hostname patch with a dhcpv6 and fqdn aware variant:
[- 0006-dhcp-4.2.5-dhclient-send-hostname-rml.patch,
+ 0006-dhcp-4.3.2-dhclient-send-hostname-or-fqdn.patch]
- Replaced infiniband support patch with fixed variant:
[- 0017-dhcp-4.2.6-lpf-ip-over-ib-support.patch
- 0018-dhcp-4.2.6-improved-xid.patch
- 0027-dhcp-4.2.x-handle-ifa_addr-NULL.909189.patch,
+ 0030-infiniband-support.patch]
- Merged/Adopted patches for the dhcp-4.3.3 sources:
[* 0004-dhcp-4.1.1-tmpfile.patch,
* 0011-dhcp-4.2.6-close-on-exec.patch,
* 0020-dhcp-4.2.x-chown-server-leases.bnc868253.patch]
-------------------------------------------------------------------
Tue Feb 3 18:37:59 UTC 2015 - coolo@suse.com

View File

@ -1,33 +1,36 @@
pub 2048R/189CDBC5 2013-01-31 Internet Systems Consortium, Inc. (Signing key, 2013) <codesign@isc.org>
sub 2048R/7F3D1D53 2013-01-31 [expires: 2015-01-31]
pub 2048R/911A4C02 2014-12-02 [verfällt: 2017-01-31]
uid Internet Systems Consortium, Inc. (Signing key, 2015-2016) <codesign@isc.org>
sig 911A4C02 2014-12-02 [selfsig]
sub 2048R/1BD14881 2014-12-02 [verfällt: 2017-01-31]
sig 911A4C02 2014-12-02 [keybind]
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.4.12 (NetBSD)
Version: GnuPG v1.4.11 (GNU/Linux)
mQENBFEKeFYBCADaN83gsb0VDjlGZkYra0PPlHz/eczKBU+/6I/VBq/FcsFEc27/
O8IE05rIID10rXLjZ0k8y4ydvhI40eVZfxwaFvQEX/StVtU1ie3F7TS02ZuJ1yal
YRtU29hhnZ5icDdiJ98gcZSH2WKhIWLRpmc60Lja/sTsO0lkLPJe9x2MDuzkQu9M
Z7hlMgqZxZ1I/mQ/KsjT3oUt8euwyntg8/w/cpY8H0EVjyBnZWV2yejsLnbCo947
hbjvUMSluGs7AZP0d+yqpGNsgRQ9iHy0NiL3ELdBqD22cqGRGTkX76KcLoXvqLVY
450bBtXsI2uUXy5iL/eUkUP2JgWQybjju/M3ABEBAAG0SEludGVybmV0IFN5c3Rl
bXMgQ29uc29ydGl1bSwgSW5jLiAoU2lnbmluZyBrZXksIDIwMTMpIDxjb2Rlc2ln
bkBpc2Mub3JnPokBPgQTAQIAKAUCUQp4VgIbAwUJA8JnAAYLCQgHAwIGFQgCCQoL
BBYCAwECHgECF4AACgkQRax4Vxic28XzIQf6AwLblJ98KI6l8gWqKVHMErYgl9+Q
RiIxrqJtyn4OjeZHX9diVjv2HlsRjnTpNl5MiSB9tXvq+GX696w6dtpoqYjZEQoP
ZCwE2USR6XO71eYO3rxLBnc0ymRvQm4zB2YKqworQDym0+wE8xiGBO8LyyVDfS5G
aGWXl0YJkfNYXzhEp6toIiLwRE0uP0TarHcHCo2CboVBgODvDZqwSBfT+i6dT+Gy
6nVEh3j7XnqgjCQ25cGev9sHR3hobT/fxG0F2YZ7sMwpWj9q0Y/dOlY7SV/ZGSs+
ubKQ55BWsTjJRrNqyDX8QLb8oVic5q/yQkV+RTs1sP5s6JSs0KqQdyR3ZbkBDQRR
CnhWAQgApxtu688JKcr6NXWOneWXn1Pti2jRhdVKNlNkGgLJ76vQTVdMmmTDwEty
YQM6C9qjIXj8cEwz+LGRUXoCXOX9Yokf5oOjNpQutn4KVS+IRvWMYaK0qsTaa/c0
FaIiFWvswyGucXAX/q9H5IoK8uYKXv5ww7+x3l1etg9/QdDQ/CANyMQbjBn38Wfn
Fy/zoUl+mMZLfqs+3NwT5C+m/4M99SoyC7XQLaZt3PBO4rVjUnMkCgiXsNdDIZnv
0XgUKyzSgrdPZcqKEG3yj8v5aTOC2k60Ffw1/ytA3hyfxLmdxxsyGyNQ4ZY8ZxmB
Z6AyUWVK95bL4oQqUCqfzSscHpWokQARAQABiQElBBgBAgAPBQJRCnhWAhsMBQkD
wmcAAAoJEEWseFcYnNvF4JAH/0MlU+Iwu5k6II3KufE2agMsRD2hk1VkpZcC08qi
LfHxX/4HrCZd7jcViLpFeK+I5JaDM2G21Co9jBMoPh+EUDnalG3eglXgeNEbUfAZ
pM7c9UejTNVmrw6crcgeUhKS2l0oBu9gRRlcSJEYY8XngfKJHBscCrsafp3RMVkO
m4Ti4CcxOot3uQ10U8GojjtWp7bgqIaFBF8aV8vugXJLl9IHqgVEtvo9miM+0Tfi
evOzuZMrgVY4zI2ZiLcrVM1KuIeZ2nIKbNWkJpDH2ZwUfsIx/KTxjpqld+NStzGQ
B9v1wazIBDHQU4hq5ddOlk0lrLDAmMJzHbavlduWmFRkuv4=
=bGLP
mQENBFR9szQBCADAwiKoEyFh32NHLc+c1vGgZ2lDKvXd7MoZZAOM2NUJkaDqt+Xy
537ycGmZRqukpGUsa0fDeqjOq+l4paX3QnW1DEs8ypnWi5Zme4lYHysmNeG33ihe
SMeGRbnZi+9VTho3NGv3iM9gtRMDXTB5wi7OCu0XNypUtR2afP9F9EgRs4nJ5iMz
o5c1y0wH4y+lJ33NCHZDj8ditl64yMbuVlZOD3UxoQqw/8E6T4rHly64g9s6Ld7o
YybSN/hKIXFZRqrTebEd2LwZqGhPQIgYDUdumwvtw6jfrosbMOx0tan3esnxlptl
fbkmOsoi8pPJqlo2VtLBx9XN53ZFMqc/Pj3tABEBAAG0TUludGVybmV0IFN5c3Rl
bXMgQ29uc29ydGl1bSwgSW5jLiAoU2lnbmluZyBrZXksIDIwMTUtMjAxNikgPGNv
ZGVzaWduQGlzYy5vcmc+iQE9BBMBAgAoBQJUfbM0AhsDBQkEEtKABgsJCAcDAgYV
CAIJCgsEFgIDAQIeAQIXgAAKCRBvpuvJkRpMAhD3B/ip18kQSE4//Yt8VMF6kciD
bcCQAOwy45/1frZaX9wS5ri/pdHxB0vw4SwrpJgJEkLGG0sEzRwS87QeFCtGDhIw
J/+5JX6in0cJ+hr2G7DJUpVgKp3Y8lEZ3ch+gAZ3k45uzzoOTT4tm6uXWlkOnlPJ
jUb1s9bVzL9zUsJ7XaV5x4aR3Bw53/izJEIaxWHj1CEjAzRC7wPQpo/EK+fWzFBf
enSCBJEvW1vkomtb1jMdj+uhod1LzFdXHdQjDCSKn/Glpn/YcZ9/LkiUSwNLTpL4
CxDbEis4QWNDndAR/u9REC1zDW/xQEC3UxsB06Zm9NaWjAHy8s0rOihgoetaroa5
AQ0EVH2zNAEIAK3gbs1saWWHWGxsPuhOf+x18g0/+N7f4fZE7TTetPNhdOgY0LGx
ul9VHRoZgvPbnm+BZmZhYGMr/oWlTEuF+sa/Dr8SKqVDjYIj0qOzimMLYgaKYV8S
Q8LhUFtUQjm5V5J/FQ97NzO2fPgEIo7JbIVrhsPEms+1gl9yanKW/+HUovl7KUyN
RovfaJdpO4uyuY9CGz875DqE39EhflBWN96bpCUmp9O/VQs4eJTp6pkv2EkMVcEa
dtFXAVFlSFe/OUd83gbVXM9NCRfY98ZJaB2OnI1/lU8OomdHOt+z6h7bdtC/w42q
sjBmu+y2Fth4WXzPd7WbfvVdlMjbBHZLn8EAEQEAAYkBJQQYAQIADwUCVH2zNAIb
DAUJBBLSgAAKCRBvpuvJkRpMAhEXB/0Xq9NqR7vgSZTed7esSMWqOLWZloKdjxys
3BA9h3EXCkF6gMdE4b6OkIUH0V2aFCYJXZmyFol0tq50aETD62aCgCOVtxlkx5VH
tTLl/T1Venf9TDISiEmDBI+3DDqjA3YOH86Fql7Jq+EMZx4e2L50PWWyRR3Lzjp6
TFe9Xh4rqQJoI0OBtLyX13Nfe/Ar4Z85DX6O1sv/CM0aWkfGbdMAeeHrDVRKaraH
ULyyX4kfu+mZj8AthxMpVDyaHil9WCX1uwGo+6rkiuAMvURbn05h5C92t2QUQJE1
rvBKpzLEBW8qQq5foo+8yHHWpzue4i4r2uEJ3+FLUsjtlU+3F+Pq
=dem0
-----END PGP PUBLIC KEY BLOCK-----

View File

@ -16,7 +16,7 @@
#
%define isc_version 4.2.6
%define isc_version 4.3.3
%define susefw2dir %{_sysconfdir}/sysconfig/SuSEfirewall2.d/services
%define omc_prefix /usr/share/omc
%define omc_svcdir %{omc_prefix}/svcinfo.d
@ -91,49 +91,23 @@ Patch2: 0002-dhcp-4.1.1-paranoia.patch
Patch3: 0003-dhcp-4.2.2-man-includes.patch
Patch4: 0004-dhcp-4.1.1-tmpfile.patch
Patch5: 0005-dhcp-4.1.1-dhclient-exec-filedes.patch
Patch6: 0006-dhcp-4.2.5-dhclient-send-hostname-rml.patch
# PATCH-FIX-UPSTREAM ldap-patch bnc#788787,bnc#784640
Patch7: 0007-dhcp-4.2.6-ldap-mt01.patch
Patch6: 0006-dhcp-4.3.2-dhclient-send-hostname-or-fqdn.patch
# PATCH-FIX-UPSTREAM lpf-bind-msg-fix bnc#617795
Patch8: 0008-dhcp-4.1.1-P1-lpf-bind-msg-fix.patch
# PATCH-FIX-SLE xen-checksum bnc#668194
Patch9: 0009-dhcp-4.2.6-xen-checksum.patch
# PATCH-FIX-SLE dhclient-option-checks bnc#675052
Patch10: 0010-dhcp-4.2.2-dhclient-option-checks.patch
# PATCH-FIX-OPENSUSE close-on-exec bnc#732910
Patch11: 0011-dhcp-4.2.6-close-on-exec.patch
# PATCH-FIX-OPENSUSE quiet-dhclient bnc#711420
Patch12: 0012-dhcp-4.2.2-quiet-dhclient.patch
# PATCH-FIX-OPENSUSE dhclient-log-pid
Patch13: 0013-dhcp-4.2.3-P1-dhclient-log-pid.patch
# PATCH-FIX-UPSTREAM use-getifaddrs bnc#791289,ISC-Bugs#31992
Patch14: 0014-Fixed-linux-interface-discovery-using-getifaddrs.patch
# PATCH-FIX-UPSTREAM no-die-on-SIGPIPE bnc#794578,ISC-Bugs#32222
Patch15: 0015-Ignore-SIGPIPE-to-not-die-in-socket-code.patch
# PATCH-FEATURE-UPSTREAM log-dhcpv6-client-addresses ISC-Bugs#26377
Patch16: 0016-server-log-DHCPv6-addresses-assigned-to-clients.patch
# PATCH-FIX-SLE dhcp-4.2.6-lpf-ip-over-ib-support bnc#870535
Patch17: 0017-dhcp-4.2.6-lpf-ip-over-ib-support.patch
# PATCH-FIX-SLE dhcp-4.2.6-improved-xid bnc#870535
Patch18: 0018-dhcp-4.2.6-improved-xid.patch
# PATCH-FIX-SLE dhcp-4.2.x-ldap-debug-write bug#835818
Patch19: 0019-dhcp-4.2.x-ldap-debug-write.bnc835818.patch
# PATCH-FIX-OPENSUSE dhcp-4.2.x-chown-server-leases bnc#868253
Patch20: 0020-dhcp-4.2.x-chown-server-leases.bnc868253.patch
# PATCH-FIX-SLE dhcp-4.2.4-P2-bnc878846-conf-to-ldap bnc#878846
Patch21: 0021-dhcp-4.2.4-P2-bnc878846-conf-to-ldap.patch
# PATCH-FIX-SLE dhcp-4.2.x-contrib-conf-to-ldap-reorder bnc#886094
Patch22: 0022-dhcp-4.2.x-contrib-conf-to-ldap-reorder.886094.patch
# PATCH-FIX-OPENSUSE dhcp-4.2.x-ddns-tsig-hmac-sha-support bnc#890731
Patch23: 0023-dhcp-4.2.x-ddns-tsig-hmac-sha-support.890731.patch
# PATCH-FIX-SLE dhcp-4.2.x-dhcpv6-decline-on-DAD-failure bnc#872609
Patch24: 0024-dhcp-4.2.x-dhcpv6-decline-on-DAD-failure.872609.patch
# PATCH-FIX-SLE dhcp-4.2.x-dhcpv6-retransmission-until-MRD bnc#872609
Patch25: 0025-dhcp-4.2.x-dhcpv6-retransmission-until-MRD.872609.patch
# PATCH-FIX-SLE dhcp-4.2.x-disable-unused-ddns-port-in-server bnc#891655
Patch26: 0026-dhcp-4.2.x-disable-unused-ddns-port-in-server.891655.patch
# PATCH-FIX-SLE dhcp-4.2.x-handle-ifa_addr-NULL bsc#909189
Patch27: 0027-dhcp-4.2.x-handle-ifa_addr-NULL.909189.patch
# PATCH-FIX-SLE
Patch30: 0030-infiniband-support.patch
##
PreReq: /bin/touch /sbin/chkconfig sysconfig
BuildRoot: %{_tmppath}/%{name}-%{version}-build
@ -253,29 +227,14 @@ Authors:
%patch4 -p1
%patch5 -p1
%patch6 -p1
%if %{with_ldap}
%patch7 -p1
%endif
%patch8 -p1
%patch9 -p1
%patch10 -p1
%patch11 -p1
%patch12 -p1
%patch13 -p1
%patch14 -p1
%patch15 -p1
%patch16 -p1
%patch17 -p1
%patch18 -p1
%patch19 -p1
%patch20 -p1
%patch21 -p1
%patch22 -p1
%patch23 -p1
%patch24 -p1
%patch25 -p1
%patch26 -p1
%patch27 -p1
%patch30 -p1
##
find . -type f -name \*.cat\* -exec rm -f {} \;
dos2unix contrib/ms2isc/*
@ -318,7 +277,7 @@ export CFLAGS FFLAGS CXXFLAGS
#
%{?suse_update_config:%{suse_update_config -f}}
libtoolize --force
autoreconf -i
autoreconf -f -i
#
%configure \
--enable-dhcpv6 \