[hackers] [quark] Improve connection logging || Laslo Hunhold
 
commit 68b4f733b2755762e43df90f73db5a6ec8d14104
Author:     Laslo Hunhold <dev_AT_frign.de>
AuthorDate: Mon Feb 22 19:06:36 2021 +0100
Commit:     Laslo Hunhold <dev_AT_frign.de>
CommitDate: Mon Feb 22 19:06:36 2021 +0100
    Improve connection logging
    
    Given connection_log() can be called on "incomplete" connections since
    the last changes regarding properly logging dropped connections, the
    function sock_get_inaddr_str() had the broken assumption that when
    ss_family was neither AF_INET nor AF_INET6 it would be AF_UNIX, leading
    to the wrong logging of just-accepted-and-dropped connections as "uds",
    even when listening on an IP socket.
    
    As a solution, the switch is amended and yields the expected
    in-address-string "-" when the given sockaddr-struct is not filled yet.
    
    Signed-off-by: Laslo Hunhold <dev_AT_frign.de>
diff --git a/sock.c b/sock.c
index 89f1109..ecb73ef 100644
--- a/sock.c
+++ b/sock.c
_AT_@ -176,8 +176,11 @@ sock_get_inaddr_str(const struct sockaddr_storage *in_sa, char *str,
                         return 1;
                 }
                 break;
-	default:
+	case AF_UNIX:
                 snprintf(str, len, "uds");
+		break;
+	default:
+		snprintf(str, len, "-");
         }
 
         return 0;
Received on Mon Feb 22 2021 - 19:09:45 CET
This archive was generated by hypermail 2.3.0
: Mon Feb 22 2021 - 19:12:36 CET