[ISC-Bugs #21497] Add a little more randomness to rng seed in client
thanks to a patch from Jeremiah Jinno.
+- Correct error handling in DLPI [ISC-Bugs #20378]
+
+- Remove __sun__ and __hpux__ typedefs in osdep.h as they are now being
+ checked in configure. [ISC-Bugs #20443]
+
+- Modify how the cmsg header is allocated the v6 send and received routines
+ to compile on more compilers. [ISC-Bugs #20524]
+
+- When parsing a domain name free the memory for the name after we are
+ done with it. [ISC-Bugs #20824]
+
Changes since 4.2.0b2
- Add declaration for variable in debug code in alloc.c. [ISC-Bugs #21472]
Data Link Provider Interface (DLPI) network interface code. */
/*
- * Copyright (c) 2004,2007,2009 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 2009-2010 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 2004,2007 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1996-2003 by Internet Software Consortium
*
* Permission to use, copy, modify, and distribute this software for any
dlp = (union DL_primitives *)ctl.buf;
- if (!expected (DL_BIND_ACK, dlp, flags) < 0) {
+ if (expected (DL_BIND_ACK, dlp, flags) == -1) {
return -1;
}
dlp = (union DL_primitives *)ctl.buf;
- if (!expected (DL_OK_ACK, dlp, flags) < 0) {
+ if (expected (DL_OK_ACK, dlp, flags) == -1) {
return -1;
}
dlp = (union DL_primitives *) ctl.buf;
- if (!expected (DL_INFO_ACK, dlp, flags) < 0) {
+ if (expected (DL_INFO_ACK, dlp, flags) == -1) {
return -1;
}
dlp = (union DL_primitives *)ctl.buf;
- if (!expected (DL_PHYS_ADDR_ACK, dlp, flags) < 0) {
+ if (expected (DL_PHYS_ADDR_ACK, dlp, flags) == -1) {
return -1;
}
{
if (msgflags != RS_HIPRI) {
/* Message was not M_PCPROTO */
- return 0;
+ return -1;
}
- if (dlp -> dl_primitive != prim) {
+ if (dlp->dl_primitive != prim) {
/* Incorrect/unexpected return message */
- return 0;
+ return -1;
}
- return 1;
+ return 0;
}
/*
Common parser code for dhcpd and dhclient. */
/*
- * Copyright (c) 2004-2009 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 2004-2010 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1995-2003 by Internet Software Consortium
*
* Permission to use, copy, modify, and distribute this software for any
unsigned len;
struct iaddr addr;
int compress;
+ isc_boolean_t freeval = ISC_FALSE;
const char *f, *g;
struct enumeration_value *e;
return 0;
}
len = strlen (val);
+ freeval = ISC_TRUE;
goto make_string;
case 't': /* Text string... */
if (!make_const_data (&t, (const unsigned char *)val,
len, 1, 1, MDL))
log_fatal ("No memory for concatenation");
+ if (freeval == ISC_TRUE) {
+ dfree((char *)val, MDL);
+ freeval = ISC_FALSE;
+ }
break;
case 'N':
BSD socket interface code... */
/*
- * Copyright (c) 2004-2009 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 2004-2010 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1995-2003 by Internet Software Consortium
*
* Permission to use, copy, modify, and distribute this software for any
#endif /* DHCPv6 */
#ifdef DHCPv6
+/*
+ * For both send_packet6() and receive_packet6() we need to allocate
+ * space for the cmsg header information. We do this once and reuse
+ * the buffer.
+ */
+static void *control_buf = NULL;
+static size_t control_buf_len = 0;
+
+static void
+allocate_cmsg_cbuf(void) {
+ control_buf_len = CMSG_SPACE(sizeof(struct in6_pktinfo));
+ control_buf = dmalloc(control_buf_len, MDL);
+ return;
+}
+
/*
* For both send_packet6() and receive_packet6() we need to use the
* sendmsg()/recvmsg() functions rather than the simpler send()/recv()
int result;
struct in6_pktinfo *pktinfo;
struct cmsghdr *cmsg;
- union {
- struct cmsghdr cmsg_sizer;
- u_int8_t pktinfo_sizer[CMSG_SPACE(sizeof(struct in6_pktinfo))];
- } control_buf;
+
+ /*
+ * If necessary allocate space for the control message header.
+ * The space is common between send and receive.
+ */
+
+ if (control_buf == NULL) {
+ allocate_cmsg_cbuf();
+ if (control_buf == NULL) {
+ log_error("send_packet6: unable to allocate cmsg header");
+ return(ENOMEM);
+ }
+ }
+ memset(control_buf, 0, control_buf_len);
/*
* Initialize our message header structure.
* source address if we wanted, but we can safely let the
* kernel decide what that should be.
*/
- m.msg_control = &control_buf;
- m.msg_controllen = sizeof(control_buf);
+ m.msg_control = control_buf;
+ m.msg_controllen = control_buf_len;
cmsg = CMSG_FIRSTHDR(&m);
cmsg->cmsg_level = IPPROTO_IPV6;
cmsg->cmsg_type = IPV6_PKTINFO;
struct cmsghdr *cmsg;
struct in6_pktinfo *pktinfo;
int found_pktinfo;
- union {
- struct cmsghdr cmsg_sizer;
- u_int8_t pktinfo_sizer[CMSG_SPACE(sizeof(struct in6_pktinfo))];
- } control_buf;
+
+ /*
+ * If necessary allocate space for the control message header.
+ * The space is common between send and receive.
+ */
+ if (control_buf == NULL) {
+ allocate_cmsg_cbuf();
+ if (control_buf == NULL) {
+ log_error("send_packet6: unable to allocate cmsg header");
+ return(ENOMEM);
+ }
+ }
+ memset(control_buf, 0, control_buf_len);
/*
* Initialize our message header structure.
* information (when we initialized the interface), so we
* should get the destination address from that.
*/
- m.msg_control = &control_buf;
- m.msg_controllen = sizeof(control_buf);
+ m.msg_control = control_buf;
+ m.msg_controllen = control_buf_len;
result = recvmsg(interface->rfdesc, &m, 0);
Operating system dependencies... */
/*
- * Copyright (c) 2004-2005,2007-2009 by Internet Systems Consortium,
+ * Copyright (c) 2004-2005,2007-2010 by Internet Systems Consortium,
* Inc. ("ISC")
* Copyright (c) 1996-2003 by Internet Software Consortium
*
#include "config.h"
#include <inttypes.h>
-/* XXX: now that we have a nice autoconf, we should sense this in
- * ./configure.
- */
-#if defined(__sun__) || defined(__hpux__)
-typedef uint8_t u_int8_t;
-typedef uint16_t u_int16_t;
-typedef uint32_t u_int32_t;
-#endif
#ifndef LITTLE_ENDIAN
#define LITTLE_ENDIAN 1234