Building 4.1.0 with USE_SOCKETS on Solaris 10 x86
Christof Chen
christof at chen.de
Sat Mar 7 17:37:29 UTC 2009
> I am getting some weird errors trying to build dhcp 4.1.0 on Solaris 10 x86. The stock build does not work reliably, even with the "snoop" workaround. So building with USE_SOCKETS is the last chance.
> In short, there is a duplicate declaration somewhere, and the #if macros are probably not lining up or something.
>
> Has anyone got this to build and work on Solaris 10 x86?
>
You need to disable DLPI to use the socket interface, but retain the
code for get_hw_address().
You may try the following patch below.
Best regards,
Christof Chen
Index: common/dlpi.c
===================================================================
--- common/dlpi.c (revision 104)
+++ common/dlpi.c (revision 105)
@@ -87,7 +87,8 @@
#include "dhcpd.h"
-#if defined (USE_DLPI_SEND) || defined (USE_DLPI_RECEIVE)
+#if defined (USE_DLPI_SEND) || defined (USE_DLPI_RECEIVE) || \
+ defined(USE_DLPI_HWADDR)
# include <sys/ioctl.h>
# include <sys/time.h>
@@ -149,6 +150,10 @@
static int dlpiinfoack PROTO ((int fd, char *bufp));
static int dlpiphysaddrack PROTO ((int fd, char *bufp));
static int dlpibindack PROTO ((int fd, char *bufp));
+#if !defined(USE_DLPI_HWADDR)
+/* These functions are not used if we're only sourcing the get_hw_addr()
+ * function (for USE_SOCKETS).
+ */
static int dlpiunitdatareq PROTO ((int fd, unsigned char *addr,
int addrlen, unsigned long minpri,
unsigned long maxpri, unsigned char *data,
@@ -161,7 +166,7 @@
unsigned long *grpaddr,
unsigned char *data,
int datalen));
-
+#endif /* !USE_DLPI_HWADDR */
static int expected PROTO ((unsigned long prim, union DL_primitives *dlp,
int msgflags));
static int strgetmsg PROTO ((int fd, struct strbuf *ctlp,
@@ -1083,6 +1088,7 @@
return 0;
}
+#if !defined(USE_DLPI_HWADDR)
int dlpiunitdatareq (fd, addr, addrlen, minpri, maxpri, dbuf, dbuflen)
int fd;
unsigned char *addr;
@@ -1190,6 +1196,7 @@
return data.len;
}
+#endif /* !USE_DLPI_HWADDR */
/*
* expected - see if we got what we wanted.
@@ -1280,7 +1287,9 @@
return 0;
}
+#endif
+#if defined(USE_DLPI_SEND)
int can_unicast_without_arp (ip)
struct interface_info *ip;
{
@@ -1314,7 +1323,9 @@
interface_dereference (&fbi, MDL);
}
}
+#endif /* USE_DLPI_SEND */
+#if defined(USE_DLPI_HWADDR)
void
get_hw_addr(const char *name, struct hardware *hw) {
int sock;
@@ -1383,4 +1394,4 @@
close(sock);
}
-#endif /* USE_DLPI */
+#endif /* USE_DLPI_HWADDR */
Index: includes/site.h
===================================================================
--- includes/site.h (revision 104)
+++ includes/site.h (revision 105)
@@ -146,8 +146,10 @@
the aforementioned problems do not matter to you, or if no other
API is supported for your system, you may want to go with it. */
-/* #define USE_SOCKETS */
+#define USE_SOCKETS
+#define USE_DLPI_HWADDR
+
/* Define this to use the Sun Streams NIT API.
The Sun Streams NIT API is only supported on SunOS 4.x releases. */
Index: includes/dhcpd.h
===================================================================
--- includes/dhcpd.h (revision 104)
+++ includes/dhcpd.h (revision 105)
@@ -1151,7 +1151,8 @@
/* Only used by DHCP client code. */
struct client_state *client;
-# if defined (USE_DLPI_SEND) || defined (USE_DLPI_RECEIVE)
+# if defined(USE_DLPI_SEND) || defined(USE_DLPI_RECEIVE) || \
+ defined(USE_DLPI_HWADDR)
int dlpi_sap_length;
struct hardware dlpi_broadcast_addr;
# endif /* DLPI_SEND || DLPI_RECEIVE */
More information about the dhcp-hackers
mailing list