From 5aeae7444f0554d5e440b0d875fdd06907d98067 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Fri, 27 Aug 2021 19:16:25 +0900 Subject: [PATCH] nghttpx: Add --frontend-quic-debug-log option --- gennghttpxfun.py | 1 + src/shrpx.cc | 8 ++++++++ src/shrpx_config.cc | 11 +++++++++++ src/shrpx_config.h | 3 +++ 4 files changed, 23 insertions(+) diff --git a/gennghttpxfun.py b/gennghttpxfun.py index cb4ed697..cadd11a2 100755 --- a/gennghttpxfun.py +++ b/gennghttpxfun.py @@ -182,6 +182,7 @@ OPTIONS = [ "http2-altsvc", "frontend-http3-read-timeout", "frontend-quic-idle-timeout", + "frontend-quic-debug-log", ] LOGVARS = [ diff --git a/src/shrpx.cc b/src/shrpx.cc index ea6c18d5..ca4f2b6c 100644 --- a/src/shrpx.cc +++ b/src/shrpx.cc @@ -2892,6 +2892,8 @@ QUIC: Specify an idle timeout for QUIC connection. Default: )" << config->quic.upstream.timeout.idle << R"( + --frontend-quic-debug-log + Output QUIC debug log to /dev/stderr. --bpf-program-file= Specify a path to eBPF program file reuseport_kern.o to direct an incoming QUIC UDP datagram to a correct @@ -3609,6 +3611,7 @@ int main(int argc, char **argv) { &flag, 172}, {SHRPX_OPT_FRONTEND_QUIC_IDLE_TIMEOUT.c_str(), required_argument, &flag, 173}, + {SHRPX_OPT_FRONTEND_QUIC_DEBUG_LOG.c_str(), no_argument, &flag, 174}, {nullptr, 0, nullptr, 0}}; int option_index = 0; @@ -4434,6 +4437,11 @@ int main(int argc, char **argv) { cmdcfgs.emplace_back(SHRPX_OPT_FRONTEND_QUIC_IDLE_TIMEOUT, StringRef{optarg}); break; + case 174: + // --frontend-quic-debug-log + cmdcfgs.emplace_back(SHRPX_OPT_FRONTEND_QUIC_DEBUG_LOG, + StringRef::from_lit("yes")); + break; default: break; } diff --git a/src/shrpx_config.cc b/src/shrpx_config.cc index 05c6cb20..0cfb62f0 100644 --- a/src/shrpx_config.cc +++ b/src/shrpx_config.cc @@ -2275,6 +2275,11 @@ int option_lookup_token(const char *name, size_t namelen) { return SHRPX_OPTID_PRIVATE_KEY_PASSWD_FILE; } break; + case 'g': + if (util::strieq_l("frontend-quic-debug-lo", name, 22)) { + return SHRPX_OPTID_FRONTEND_QUIC_DEBUG_LOG; + } + break; case 'r': if (util::strieq_l("backend-response-buffe", name, 22)) { return SHRPX_OPTID_BACKEND_RESPONSE_BUFFER; @@ -3892,6 +3897,12 @@ int parse_config(Config *config, int optid, const StringRef &opt, #else // !ENABLE_HTTP3 return 0; #endif // !ENABLE_HTTP3 + case SHRPX_OPTID_FRONTEND_QUIC_DEBUG_LOG: +#ifdef ENABLE_HTTP3 + config->quic.upstream.debug.log = util::strieq_l("yes", optarg); +#endif // ENABLE_HTTP3 + + return 0; case SHRPX_OPTID_CONF: LOG(WARN) << "conf: ignored"; diff --git a/src/shrpx_config.h b/src/shrpx_config.h index 13853b69..10b5b72c 100644 --- a/src/shrpx_config.h +++ b/src/shrpx_config.h @@ -371,6 +371,8 @@ constexpr auto SHRPX_OPT_FRONTEND_HTTP3_READ_TIMEOUT = StringRef::from_lit("frontend-http3-read-timeout"); constexpr auto SHRPX_OPT_FRONTEND_QUIC_IDLE_TIMEOUT = StringRef::from_lit("frontend-quic-idle-timeout"); +constexpr auto SHRPX_OPT_FRONTEND_QUIC_DEBUG_LOG = + StringRef::from_lit("frontend-quic-debug-log"); constexpr size_t SHRPX_OBFUSCATED_NODE_LENGTH = 8; @@ -1171,6 +1173,7 @@ enum { SHRPX_OPTID_FRONTEND_KEEP_ALIVE_TIMEOUT, SHRPX_OPTID_FRONTEND_MAX_REQUESTS, SHRPX_OPTID_FRONTEND_NO_TLS, + SHRPX_OPTID_FRONTEND_QUIC_DEBUG_LOG, SHRPX_OPTID_FRONTEND_QUIC_IDLE_TIMEOUT, SHRPX_OPTID_FRONTEND_READ_TIMEOUT, SHRPX_OPTID_FRONTEND_WRITE_TIMEOUT,