Commit 32e651c4 authored by Shawn Routhier's avatar Shawn Routhier
Browse files

A problem with missing get_hw_addr function when --enable-use-sockets

was used is now solved on GNU/Linux, BSD and GNU/Hurd systems. Note
that use-sockets feature was not tested on those systems. Client and
server code no longer use MAX_PATH constant that is not defined on
GNU/Hurd systems. [ISC-Bugs 25979]
parent 6980ae03
......@@ -52,6 +52,12 @@ work on other platforms. Please report any problems and suggested fixes to
matching billing class tried before failing to provide a billing.
[ISC-Bugs #21759]
- A problem with missing get_hw_addr function when --enable-use-sockets
was used is now solved on GNU/Linux, BSD and GNU/Hurd systems. Note
that use-sockets feature was not tested on those systems. Client and
server code no longer use MAX_PATH constant that is not defined on
GNU/Hurd systems. [ISC-Bugs 25979]
Changes since 4.2.4
- Correct code to calculate timing values in client to compare
......
......@@ -374,21 +374,17 @@ main(int argc, char **argv) {
* to be reopened after chdir() has been called
*/
if (path_dhclient_db[0] != '/') {
char *path = dmalloc(PATH_MAX, MDL);
if (path == NULL)
log_fatal("No memory for filename\n");
path_dhclient_db = realpath(path_dhclient_db, path);
const char *old_path = path_dhclient_db;
path_dhclient_db = realpath(path_dhclient_db, NULL);
if (path_dhclient_db == NULL)
log_fatal("%s: %s", path, strerror(errno));
log_fatal("Failed to get realpath for %s: %s", old_path, strerror(errno));
}
if (path_dhclient_script[0] != '/') {
char *path = dmalloc(PATH_MAX, MDL);
if (path == NULL)
log_fatal("No memory for filename\n");
path_dhclient_script = realpath(path_dhclient_script, path);
const char *old_path = path_dhclient_script;
path_dhclient_script = realpath(path_dhclient_script, NULL);
if (path_dhclient_script == NULL)
log_fatal("%s: %s", path, strerror(errno));
log_fatal("Failed to get realpath for %s: %s", old_path, strerror(errno));
}
/*
......
......@@ -3,7 +3,8 @@
BPF socket interface code, originally contributed by Archie Cobbs. */
/*
* Copyright (c) 2004,2007,2009 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 2009,2012 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
......@@ -43,7 +44,6 @@
# include <sys/ioctl.h>
# include <sys/uio.h>
# include <net/bpf.h>
# include <net/if_types.h>
# if defined (NEED_OSF_PFILT_HACKS)
# include <net/pfilt.h>
# endif
......@@ -55,7 +55,8 @@
#include "includes/netinet/if_ether.h"
#endif
#ifdef USE_BPF_RECEIVE
#if defined(USE_BPF_SEND) || defined(USE_BPF_RECEIVE) || defined(USE_BPF_HWADDR)
#include <net/if_types.h>
#include <ifaddrs.h>
#endif
......@@ -550,7 +551,9 @@ void maybe_setup_fallback ()
interface_dereference (&fbi, MDL);
}
}
#endif
#if defined(USE_BPF_RECEIVE) || defined(USE_BPF_HWADDR)
void
get_hw_addr(const char *name, struct hardware *hw) {
struct ifaddrs *ifa;
......
......@@ -28,7 +28,6 @@
#include "dhcpd.h"
#if defined (USE_LPF_SEND) || defined (USE_LPF_RECEIVE)
#include <sys/ioctl.h>
#include <sys/uio.h>
#include <errno.h>
......@@ -40,8 +39,14 @@
#include "includes/netinet/ip.h"
#include "includes/netinet/udp.h"
#include "includes/netinet/if_ether.h"
#endif
#if defined (USE_LPF_RECEIVE) || defined (USE_LPF_HWADDR)
#include <sys/ioctl.h>
#include <net/if.h>
#endif
#if defined (USE_LPF_SEND) || defined (USE_LPF_RECEIVE)
/* Reinitializes the specified interface after an address change. This
is not required for packet-filter APIs. */
......@@ -417,7 +422,9 @@ void maybe_setup_fallback ()
interface_dereference (&fbi, MDL);
}
}
#endif
#if defined (USE_LPF_RECEIVE) || defined (USE_LPF_HWADDR)
void
get_hw_addr(const char *name, struct hardware *hw) {
int sock;
......
......@@ -108,6 +108,10 @@
# define USE_SOCKET_RECEIVE
# if defined(HAVE_DLPI)
# define USE_DLPI_HWADDR
# elif defined(HAVE_LPF)
# define USE_LPF_HWADDR
# elif defined(HAVE_BPF)
# define USE_BPF_HWADDR
# endif
#endif
......
......@@ -464,12 +464,11 @@ main(int argc, char **argv) {
* to be reopened after chdir() has been called
*/
if (path_dhcpd_db[0] != '/') {
char *path = dmalloc(PATH_MAX, MDL);
if (path == NULL)
log_fatal("No memory for filename\n");
path_dhcpd_db = realpath(path_dhcpd_db, path);
const char *path = path_dhcpd_db;
path_dhcpd_db = realpath(path_dhcpd_db, NULL);
if (path_dhcpd_db == NULL)
log_fatal("%s: %s", path, strerror(errno));
log_fatal("Failed to get realpath for %s: %s", path,
strerror(errno));
}
if (!quiet) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment