Add tcp connection logging - geomyidae - A small C-based gopherd. HTML git clone git://bitreich.org/geomyidae/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/geomyidae/ DIR Log DIR Files DIR Refs DIR Tags DIR README DIR LICENSE --- DIR commit baafaf38935f949caf81db281fc17bbeb9bbbe6c DIR parent aef0076447d9ca07b4e758287f611e6cbbda224e HTML Author: Quentin Rameau <quinq@fifth.space> Date: Thu, 15 Jun 2017 19:21:31 +0200 Add tcp connection logging Signed-off-by: Christoph Lohmann <20h@r-36.net> Diffstat: M geomyidae.8 | 11 ++++++----- M main.c | 6 +++++- 2 files changed, 11 insertions(+), 6 deletions(-) --- DIR diff --git a/geomyidae.8 b/geomyidae.8 @@ -97,11 +97,12 @@ Set the logging level (default: 7) . .Bd -literal Loglevels: - 0 - no logging - 1 - served plain files - 2 - directory listings - 4 - HTTP redirects - 8 - errors (e.g., not found) + 0 - no logging + 1 - served plain files + 2 - directory listings + 4 - HTTP redirects + 8 - errors (e.g., not found) + 16 - client connections e.g.: 1 + 2 + 4 + 8 = 15 (files + directories + HTTP + errors) DIR diff --git a/main.c b/main.c @@ -32,7 +32,8 @@ enum { FILES = 1, DIRS = 2, HTTP = 4, - ERRORS = 8 + ERRORS = 8, + CONN = 16 }; int glfd = -1; @@ -476,6 +477,9 @@ main(int argc, char *argv[]) sizeof(clienth), clientp, sizeof(clientp), NI_NUMERICHOST|NI_NUMERICSERV); + if (loglvl & CONN) + logentry(clienth, clientp, "-", "connected"); + switch(fork()) { case -1: perror("fork");