Browse Source

[1824] More descriptive error strings if the sendmsg function fails.

Marcin Siodelski 11 years ago
parent
commit
96c135a924
2 changed files with 8 additions and 3 deletions
  1. 4 2
      src/lib/dhcp/iface_mgr.cc
  2. 4 1
      src/lib/dhcp/pkt_filter_inet.cc

+ 4 - 2
src/lib/dhcp/iface_mgr.cc

@@ -26,7 +26,8 @@
 #include <exceptions/exceptions.h>
 #include <util/io/pktinfo_utilities.h>
 
-
+#include <cstring>
+#include <errno.h>
 #include <fstream>
 #include <sstream>
 
@@ -906,7 +907,8 @@ IfaceMgr::send(const Pkt6Ptr& pkt) {
 
     result = sendmsg(getSocket(*pkt), &m, 0);
     if (result < 0) {
-        isc_throw(SocketWriteError, "Pkt6 send failed: sendmsg() returned " << result);
+        isc_throw(SocketWriteError, "pkt6 send failed: sendmsg() returned"
+                  " with an error: " << strerror(errno));
     }
 
     return (result);

+ 4 - 1
src/lib/dhcp/pkt_filter_inet.cc

@@ -16,6 +16,8 @@
 #include <dhcp/iface_mgr.h>
 #include <dhcp/pkt4.h>
 #include <dhcp/pkt_filter_inet.h>
+#include <errno.h>
+#include <cstring>
 
 using namespace isc::asiolink;
 
@@ -242,7 +244,8 @@ PktFilterInet::send(const Iface&, uint16_t sockfd,
 
     int result = sendmsg(sockfd, &m, 0);
     if (result < 0) {
-        isc_throw(SocketWriteError, "pkt4 send failed");
+        isc_throw(SocketWriteError, "pkt4 send failed: sendmsg() returned "
+                  " with an error: " << strerror(errno));
     }
 
     return (result);