Browse Source

Merge branch 'trac1968'

Tomek Mrugalski 13 years ago
parent
commit
f37c712d3d

+ 2 - 2
configure.ac

@@ -407,9 +407,9 @@ case $system in
       OS_TYPE="BSD"
       CPPFLAGS="$CPPFLAGS -DOS_BSD"
       ;;
-    Solaris)
+    SunOS)
       OS_TYPE="Solaris"
-      CPPFLAGS="$CPPFLAGS -DOS_SOLARIS"
+      CPPFLAGS="$CPPFLAGS -DOS_SUN"
       ;;
     *)
       OS_TYPE="Unknown"

+ 1 - 0
src/lib/dhcp/Makefile.am

@@ -13,6 +13,7 @@ libdhcp___la_SOURCES += libdhcp++.cc libdhcp++.h
 libdhcp___la_SOURCES += iface_mgr.cc iface_mgr.h
 libdhcp___la_SOURCES += iface_mgr_linux.cc
 libdhcp___la_SOURCES += iface_mgr_bsd.cc
+libdhcp___la_SOURCES += iface_mgr_sun.cc
 libdhcp___la_SOURCES += option.cc option.h
 libdhcp___la_SOURCES += option6_ia.cc option6_ia.h
 libdhcp___la_SOURCES += option6_iaaddr.cc option6_iaaddr.h

+ 0 - 9
src/lib/dhcp/iface_mgr.cc

@@ -213,15 +213,6 @@ void IfaceMgr::stubDetectIfaces() {
     }
 }
 
-/// @todo: Remove this once we have OS-specific interface detection
-/// routines (or at least OS-specific files, like iface_mgr_solaris.cc)
-/// for all OSes.
-#if !defined(OS_LINUX) && !defined(OS_BSD)
-void IfaceMgr::detectIfaces() {
-    stubDetectIfaces();
-}
-#endif
-
 bool IfaceMgr::openSockets4(const uint16_t port) {
     int sock;
     int count = 0;

+ 3 - 1
src/lib/dhcp/iface_mgr_bsd.cc

@@ -25,6 +25,7 @@ using namespace isc::asiolink;
 using namespace isc::dhcp;
 
 namespace isc {
+namespace dhcp {
 
 void
 IfaceMgr::detectIfaces() {
@@ -48,6 +49,7 @@ bool IfaceMgr::os_receive4(struct msghdr& /*m*/, Pkt4Ptr& /*pkt*/) {
   return (true); // pretend that we have everything set up for reception.
 }
 
-}
+} // end of isc::dhcp namespace
+} // end of dhcp namespace
 
 #endif

+ 0 - 1
src/lib/dhcp/iface_mgr_linux.cc

@@ -410,7 +410,6 @@ void Netlink::release_list(NetlinkMessages& messages) {
 } // end of anonymous namespace
 
 namespace isc {
-
 namespace dhcp {
 
 /// @brief Detect available interfaces on Linux systems.

+ 55 - 0
src/lib/dhcp/iface_mgr_sun.cc

@@ -0,0 +1,55 @@
+// Copyright (C) 2011  Internet Systems Consortium, Inc. ("ISC")
+//
+// Permission to use, copy, modify, and/or distribute this software for any
+// purpose with or without fee is hereby granted, provided that the above
+// copyright notice and this permission notice appear in all copies.
+//
+// THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
+// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+// AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
+// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+// PERFORMANCE OF THIS SOFTWARE.
+
+#include <config.h>
+
+#if defined(OS_SUN)
+
+#include <dhcp/iface_mgr.h>
+#include <exceptions/exceptions.h>
+
+using namespace std;
+using namespace isc;
+using namespace isc::asiolink;
+using namespace isc::dhcp;
+
+namespace isc {
+namespace dhcp {
+
+void
+IfaceMgr::detectIfaces() {
+    /// @todo do the actual detection on Solaris. Currently just calling
+    /// stub implementation.
+    stubDetectIfaces();
+}
+
+void IfaceMgr::os_send4(struct msghdr& /*m*/,
+                        boost::scoped_array<char>& /*control_buf*/,
+                        size_t /*control_buf_len*/,
+                        const Pkt4Ptr& /*pkt*/) {
+  // @todo: Are there any specific actions required before sending IPv4 packet
+  // on BSDs? See iface_mgr_linux.cc for working Linux implementation.
+}
+
+bool IfaceMgr::os_receive4(struct msghdr& /*m*/, Pkt4Ptr& /*pkt*/) {
+  // @todo: Are there any specific actions required before receiving IPv4 packet
+  // on BSDs? See iface_mgr_linux.cc for working Linux implementation.
+
+  return (true); // pretend that we have everything set up for reception.
+}
+
+} // end of isc::dhcp namespace
+} // end of dhcp namespace
+
+#endif

+ 1 - 0
src/lib/dhcp/tests/Makefile.am

@@ -23,6 +23,7 @@ libdhcp___unittests_SOURCES += libdhcp++_unittest.cc
 libdhcp___unittests_SOURCES += ../iface_mgr.cc ../iface_mgr.h iface_mgr_unittest.cc
 libdhcp___unittests_SOURCES += ../iface_mgr_linux.cc
 libdhcp___unittests_SOURCES += ../iface_mgr_bsd.cc
+libdhcp___unittests_SOURCES += ../iface_mgr_sun.cc
 libdhcp___unittests_SOURCES += ../option6_iaaddr.h ../option6_iaaddr.cc option6_iaaddr_unittest.cc
 libdhcp___unittests_SOURCES += ../option6_ia.h ../option6_ia.cc option6_ia_unittest.cc
 libdhcp___unittests_SOURCES += ../option6_addrlst.h ../option6_addrlst.cc option6_addrlst_unittest.cc