[OmniOS-discuss] [PATCH] isc-dhcp to work with VNIC's via DLPI

Alex McWhirter alexmcwhirter at mojovapes.net
Mon Dec 1 15:28:40 UTC 2014


As of now, the network/service/isc-dhcp package uses UDP sockets. The build.sh file is using the options “—enable-use-sockets” and “—enable-ipv4-pktinfo”. More details on this workaround can be found here. https://kb.isc.org/article/AA-01040/0/Building-ISC-DHCP-on-Solaris-11.html <https://kb.isc.org/article/AA-01040/0/Building-ISC-DHCP-on-Solaris-11.html>


The problem with using UDP sockets is that unicast clients cannot correctly obtain an IP without a relay, which really isn’t ideal. I’ve sent this patch to the isc-dhcp team, but i figured it might be found more quickly useful here.

I’ve created two patches for isc-dhcp that allow dhcpd to use DLPI with VNIC’s and other vanity named interfaces. the modified files are “./configure.ac” and “./common/dlpi.c” Below is the diff info.





--- /Users/alexmcwhirter/Downloads/dhcp-4.3.1 2/common/dlpi.c	2014-07-29 18:41:04.000000000 -0400
+++ /Users/alexmcwhirter/Desktop/dhcp-4.3.1/common/dlpi.c	2014-11-30 20:48:39.000000000 -0500
@@ -130,7 +130,14 @@
 
 #define DLPI_MAXDLBUF		8192	/* Buffer size */
 #define DLPI_MAXDLADDR		1024	/* Max address size */
-#define DLPI_DEVDIR		"/dev/"	/* Device directory */
+
+/* Solaris 11 / Illumos 11 uses vanity names for ethernet devices
+ * and places them in /dev/net */
+#ifdef __SOLARIS_2_11
+# define DLPI_DEVDIR		"/dev/net/"	/* Device directory */
+#else
+# define DLPI_DEVDIR		"/dev/"	/* Device directory */
+#endif
 
 static int dlpiopen(const char *ifname);
 static int dlpiunit (char *ifname);
@@ -794,9 +801,13 @@
 	ep = cp = ifname;
 	while (*ep)
 		ep++;
-	/* And back up to the first digit (unit number) */
-	while ((*(ep - 1) >= '0' && *(ep - 1) <= '9') || *(ep - 1) == ':')
-		ep--;
+    /* Solaris 11 / Illumos 11 should not have the number removed from the 
+     * interface name */
+    if (__SOLARIS_2_11 != 1) {
+        /* And back up to the first digit (unit number) */
+        while ((*(ep - 1) >= '0' && *(ep - 1) <= '9') || *(ep - 1) == ':')
+            ep--;
+    }
 	
 	/* Copy everything up to the unit number */
 	while (cp < ep) {




--- /Users/alexmcwhirter/Downloads/dhcp-4.3.1 2/configure.ac	2014-08-06 18:35:33.000000000 -0400
+++ /Users/alexmcwhirter/Desktop/dhcp-4.3.1/configure.ac	2014-11-30 20:50:11.000000000 -0500
@@ -13,6 +13,13 @@
 
 AC_CANONICAL_HOST
 
+# Solaris 11 / Illumos 11 is identified as solaris2.11
+AM_CONDITIONAL([SOLARIS_2_11], [test x$host_os = xsolaris2.11])
+
+# If host_os is solaris2.11 then define __SOLARIS_2_11
+AM_COND_IF([SOLARIS_2_11],[AC_DEFINE([__SOLARIS_2_11], [1],
+    [Define if host_os is solaris2.11])]) 
+
 # We want to turn on warnings if we are using gcc and the user did 
 # not specify CFLAGS. The autoconf check for the C compiler sets the
 # CFLAGS if gcc is used, so we will save it before we run that check.



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://omniosce.org/ml-archive/attachments/20141201/3b9a4153/attachment.html>


More information about the OmniOS-discuss mailing list