]> git.ipfire.org Git - thirdparty/dhcp.git/commitdiff
[v4_1_esv] Fixed interface device naming for DLPI under Solaris 11
authorThomas Markwalder <tmark@isc.org>
Tue, 23 Feb 2016 12:34:23 +0000 (07:34 -0500)
committerThomas Markwalder <tmark@isc.org>
Tue, 23 Feb 2016 12:34:23 +0000 (07:34 -0500)
    Merges in rt37954.

RELNOTES
common/dlpi.c
configure
configure.ac
includes/config.h.in

index e5a5b7a745ac752cc754da44d3d047cade3f5dc0..c53117314ae9713a91da0936edc2821985049571 100644 (file)
--- a/RELNOTES
+++ b/RELNOTES
@@ -180,6 +180,12 @@ by Eric Young (eay@cryptsoft.com).
 - Corrected minor Coverity issues.
   [ISC-Bugs #35144]
 
+- Corrected interface name formation when using DLPI under Solaris 11. As of
+  Solaris 11, ethernet device files are located in "/dev/net".  The configure
+  script has been modified to detect this situation and adjust the directory
+  used accordingly.
+  [ISC-Bugs #37954]
+
                        Changes since 4.1-ESV-R12b1
 
 - None
index 1307c3183b0004369b002063ba8f6a05be76feb6..a94778af61477d085efa46302be48ef5be4a1516 100644 (file)
@@ -3,7 +3,7 @@
    Data Link Provider Interface (DLPI) network interface code. */
 
 /*
- * Copyright (c) 2009-2011,2014 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 2009-2011,2014,2016 by Internet Systems Consortium, Inc. ("ISC")
  * Copyright (c) 2004,2007 by Internet Systems Consortium, Inc. ("ISC")
  * Copyright (c) 1996-2003 by Internet Software Consortium
  *
@@ -130,7 +130,13 @@ static int strioctl (int fd, int cmd, int timeout, int len, char *dp);
 
 #define DLPI_MAXDLBUF          8192    /* Buffer size */
 #define DLPI_MAXDLADDR         1024    /* Max address size */
-#define DLPI_DEVDIR            "/dev/" /* Device directory */
+
+/* Device directory */
+#if defined(USE_DEV_NET)
+#define DLPI_DEVDIR            "/dev/net/"  /* Solaris 11 + */
+#else
+#define DLPI_DEVDIR            "/dev/"      /* Pre Solaris 11 */
+#endif
 
 static int dlpiopen(const char *ifname);
 static int dlpiunit (char *ifname);
@@ -791,9 +797,13 @@ dlpiopen(const char *ifname) {
        ep = cp = ifname;
        while (*ep)
                ep++;
+
+/* Before Solaris 11 we strip off the digit to open the base dev name */
+#if !defined(USE_DEV_NET)
        /* And back up to the first digit (unit number) */
        while ((*(ep - 1) >= '0' && *(ep - 1) <= '9') || *(ep - 1) == ':')
                ep--;
+#endif
        
        /* Copy everything up to the unit number */
        while (cp < ep) {
index 3e435187b26c1e7e0909394f969cf59d0fb8f921..41fa614e9b7ce41e8c2868eecda179f8b6c61fe2 100755 (executable)
--- a/configure
+++ b/configure
@@ -6624,7 +6624,31 @@ CFLAGS="$CFLAGS $STD_CWARNINGS"
 
 case "$host" in
 *-darwin*)
-    CFLAGS="$CFLAGS -D__APPLE_USE_RFC_3542" ;;
+    CFLAGS="$CFLAGS -D__APPLE_USE_RFC_3542";;
+*-solaris*)
+    # As of Solaris 11, ethernet dev files are in /dev/net
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for /dev/net" >&5
+$as_echo_n "checking for /dev/net... " >&6; }
+if ${ac_cv_file__dev_net+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  test "$cross_compiling" = yes &&
+  as_fn_error $? "cannot check for file existence when cross compiling" "$LINENO" 5
+if test -r "/dev/net"; then
+  ac_cv_file__dev_net=yes
+else
+  ac_cv_file__dev_net=no
+fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_file__dev_net" >&5
+$as_echo "$ac_cv_file__dev_net" >&6; }
+if test "x$ac_cv_file__dev_net" = xyes; then :
+
+$as_echo "#define USE_DEV_NET 1" >>confdefs.h
+
+fi
+
+    ;;
 esac
 
 
index c6748eb967f4198fea88e8329684ba4715d56f29..c20b8f55934f25b15cb315518a3bb97726acb8e0 100644 (file)
@@ -630,7 +630,13 @@ CFLAGS="$CFLAGS $STD_CWARNINGS"
 
 case "$host" in
 *-darwin*)
-    CFLAGS="$CFLAGS -D__APPLE_USE_RFC_3542" ;;
+    CFLAGS="$CFLAGS -D__APPLE_USE_RFC_3542";;
+*-solaris*)
+    # As of Solaris 11, ethernet dev files are in /dev/net
+    AC_CHECK_FILE(/dev/net,
+                   [AC_DEFINE([USE_DEV_NET], [1],
+                       [Define to 1 if ethernet devices are in /dev/net])])
+    ;;
 esac
 
 AC_C_FLEXIBLE_ARRAY_MEMBER
index 8c17338547a827b6330bac549f47216354ed40e4..fcb5ae305749c3075cf5265dcc794a265d6bf4a6 100644 (file)
 /* Define to include server activity tracing support. */
 #undef TRACING
 
+/* Define to 1 if ethernet devices are in /dev/net */
+#undef USE_DEV_NET
+
 /* Define to include PIDs in syslog messages. */
 #undef USE_LOG_PID