]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
af-packet: improve logged messages.
authorEric Leblond <eric@regit.org>
Tue, 4 Sep 2012 09:20:05 +0000 (11:20 +0200)
committerVictor Julien <victor@inliniac.net>
Thu, 6 Sep 2012 08:24:05 +0000 (10:24 +0200)
src/source-af-packet.c

index e3f55b6d2454f7daaddc1c0990ec0901eba0ff0c..947f529ce63a43e3cf2d9c5428679ad89330978f 100644 (file)
@@ -263,7 +263,6 @@ void AFPPeerUpdate(AFPThreadVars *ptv)
     if (ptv->mpeer == NULL) {
         return;
     }
-    SCLogInfo("Updating AFP peer");
     (void)SC_ATOMIC_SET(ptv->mpeer->if_idx, AFPGetIfnumByDev(ptv->socket, ptv->iface, 0));
     (void)SC_ATOMIC_SET(ptv->mpeer->socket, ptv->socket);
     (void)SC_ATOMIC_SET(ptv->mpeer->state, ptv->afp_state);
@@ -852,7 +851,7 @@ static int AFPTryReopen(AFPThreadVars *ptv)
         return afp_activate_r;
     }
 
-    SCLogInfo("Recovering interface listening");
+    SCLogInfo("Interface '%s' is back", ptv->iface);
     return 0;
 }
 
@@ -917,8 +916,9 @@ TmEcode ReceiveAFPLoop(ThreadVars *tv, void *data, void *slot)
                 /* Do a recv to get errno */
                 if (recv(ptv->socket, &c, sizeof c, MSG_PEEK) != -1)
                     continue; /* what, no error? */
-                SCLogError(SC_ERR_AFP_READ, "Error reading data from socket: (%d" PRIu32 ") %s",
-                        errno, strerror(errno));
+                SCLogError(SC_ERR_AFP_READ,
+                           "Error reading data from iface '%s': (%d" PRIu32 ") %s",
+                           ptv->iface, errno, strerror(errno));
                 AFPSwitchState(ptv, AFP_STATE_DOWN);
                 continue;
             } else if (fds.revents & POLLNVAL) {
@@ -936,8 +936,9 @@ TmEcode ReceiveAFPLoop(ThreadVars *tv, void *data, void *slot)
             switch (r) {
                 case AFP_READ_FAILURE:
                     /* AFPRead in error: best to reset the socket */
-                    SCLogError(SC_ERR_AFP_READ, "AFPRead error reading data from socket: (%d" PRIu32 ") %s",
-                            errno, strerror(errno));
+                    SCLogError(SC_ERR_AFP_READ,
+                           "AFPRead error reading data from iface '%s': (%d" PRIu32 ") %s",
+                           ptv->iface, errno, strerror(errno));
                     AFPSwitchState(ptv, AFP_STATE_DOWN);
                     continue;
                 case AFP_FAILURE:
@@ -952,7 +953,8 @@ TmEcode ReceiveAFPLoop(ThreadVars *tv, void *data, void *slot)
                     break;
             }
         } else if ((r < 0) && (errno != EINTR)) {
-            SCLogError(SC_ERR_AFP_READ, "Error reading data from socket: (%d" PRIu32 ") %s",
+            SCLogError(SC_ERR_AFP_READ, "Error reading data from iface '%s': (%d" PRIu32 ") %s",
+                       ptv->iface,
                        errno, strerror(errno));
             AFPSwitchState(ptv, AFP_STATE_DOWN);
             continue;