]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#1234] Added a return for external sockets without handlers
authorFrancis Dupont <fdupont@isc.org>
Tue, 16 Jun 2020 12:02:01 +0000 (14:02 +0200)
committerFrancis Dupont <fdupont@isc.org>
Fri, 19 Jun 2020 16:10:55 +0000 (18:10 +0200)
src/lib/dhcp/iface_mgr.cc

index 7dfad76df7a7a67144cb6a6cc093424ea475f01d..e5fee84ffc5807bb51a023232d55bc261390b242 100644 (file)
@@ -1091,12 +1091,14 @@ Pkt4Ptr IfaceMgr::receive4Indirect(uint32_t timeout_sec, uint32_t timeout_usec /
 
         // Let's find out which external socket has the data
         SocketCallbackInfo ex_sock;
+        bool found = false;
         {
             std::lock_guard<std::mutex> lock(callbacks_mutex_);
             BOOST_FOREACH(SocketCallbackInfo s, callbacks_) {
                 if (!FD_ISSET(s.socket_, &sockets)) {
                     continue;
                 }
+                found = true;
 
                 // something received over external socket
                 if (s.callback_) {
@@ -1113,7 +1115,8 @@ Pkt4Ptr IfaceMgr::receive4Indirect(uint32_t timeout_sec, uint32_t timeout_usec /
             // layer access without integrating any specific features
             // in IfaceMgr
             ex_sock.callback_(ex_sock.socket_);
-
+        }
+        if (found) {
             return (Pkt4Ptr());
         }
     }
@@ -1199,12 +1202,14 @@ Pkt4Ptr IfaceMgr::receive4Direct(uint32_t timeout_sec, uint32_t timeout_usec /*
 
     // Let's find out which socket has the data
     SocketCallbackInfo ex_sock;
+    bool found = false;
     {
         std::lock_guard<std::mutex> lock(callbacks_mutex_);
         BOOST_FOREACH(SocketCallbackInfo s, callbacks_) {
             if (!FD_ISSET(s.socket_, &sockets)) {
                 continue;
             }
+            found = true;
 
             // something received over external socket
             if (s.callback_) {
@@ -1221,7 +1226,8 @@ Pkt4Ptr IfaceMgr::receive4Direct(uint32_t timeout_sec, uint32_t timeout_usec /*
         // layer access without integrating any specific features
         // in IfaceMgr
         ex_sock.callback_(ex_sock.socket_);
-
+    }
+    if (found) {
         return (Pkt4Ptr());
     }
 
@@ -1341,12 +1347,14 @@ IfaceMgr::receive6Direct(uint32_t timeout_sec, uint32_t timeout_usec /* = 0 */ )
 
     // Let's find out which socket has the data
     SocketCallbackInfo ex_sock;
+    bool found = false;
     {
         std::lock_guard<std::mutex> lock(callbacks_mutex_);
         BOOST_FOREACH(SocketCallbackInfo s, callbacks_) {
             if (!FD_ISSET(s.socket_, &sockets)) {
                 continue;
             }
+            found = true;
 
             // something received over external socket
             if (s.callback_) {
@@ -1363,7 +1371,8 @@ IfaceMgr::receive6Direct(uint32_t timeout_sec, uint32_t timeout_usec /* = 0 */ )
         // layer access without integrating any specific features
         // in IfaceMgr
         ex_sock.callback_(ex_sock.socket_);
-
+    }
+    if (found) {
         return (Pkt6Ptr());
     }
 
@@ -1471,12 +1480,14 @@ IfaceMgr::receive6Indirect(uint32_t timeout_sec, uint32_t timeout_usec /* = 0 */
 
         // Let's find out which external socket has the data
         SocketCallbackInfo ex_sock;
+        bool found = false;
         {
             std::lock_guard<std::mutex> lock(callbacks_mutex_);
             BOOST_FOREACH(SocketCallbackInfo s, callbacks_) {
                 if (!FD_ISSET(s.socket_, &sockets)) {
                     continue;
                 }
+                found = true;
 
                 // something received over external socket
                 if (s.callback_) {
@@ -1493,7 +1504,8 @@ IfaceMgr::receive6Indirect(uint32_t timeout_sec, uint32_t timeout_usec /* = 0 */
             // layer access without integrating any specific features
             // in IfaceMgr
             ex_sock.callback_(ex_sock.socket_);
-
+        }
+        if (found) {
             return (Pkt6Ptr());
         }
     }