nghttpx: Rename eBPF options

This commit is contained in:
Tatsuhiro Tsujikawa 2021-08-27 21:34:18 +09:00
parent 4292bd7ad9
commit 7d13891066
4 changed files with 30 additions and 25 deletions

View File

@ -177,8 +177,8 @@ OPTIONS = [
"tls13-ciphers",
"tls13-client-ciphers",
"no-strip-incoming-early-data",
"bpf-program-file",
"no-bpf",
"quic-bpf-program-file",
"no-quic-bpf",
"http2-altsvc",
"frontend-http3-read-timeout",
"frontend-quic-idle-timeout",

View File

@ -2905,13 +2905,14 @@ QUIC:
<< util::duration_str(config->quic.upstream.timeout.idle) << R"(
--frontend-quic-debug-log
Output QUIC debug log to /dev/stderr.
--bpf-program-file=<PATH>
--quic-bpf-program-file=<PATH>
Specify a path to eBPF program file reuseport_kern.o to
direct an incoming QUIC UDP datagram to a correct
socket.
Default: )"
<< config->quic.bpf.prog_file << R"(
--no-bpf Disable eBPF.
--no-quic-bpf
Disable eBPF.
--frontend-http3-window-size=<SIZE>
Sets the per-stream initial window size of HTTP/3
frontend connection.
@ -3648,8 +3649,9 @@ int main(int argc, char **argv) {
{SHRPX_OPT_NO_HTTP2_CIPHER_BLOCK_LIST.c_str(), no_argument, &flag, 167},
{SHRPX_OPT_CLIENT_NO_HTTP2_CIPHER_BLOCK_LIST.c_str(), no_argument,
&flag, 168},
{SHRPX_OPT_BPF_PROGRAM_FILE.c_str(), required_argument, &flag, 169},
{SHRPX_OPT_NO_BPF.c_str(), no_argument, &flag, 170},
{SHRPX_OPT_QUIC_BPF_PROGRAM_FILE.c_str(), required_argument, &flag,
169},
{SHRPX_OPT_NO_QUIC_BPF.c_str(), no_argument, &flag, 170},
{SHRPX_OPT_HTTP2_ALTSVC.c_str(), required_argument, &flag, 171},
{SHRPX_OPT_FRONTEND_HTTP3_READ_TIMEOUT.c_str(), required_argument,
&flag, 172},
@ -4470,12 +4472,13 @@ int main(int argc, char **argv) {
StringRef::from_lit("yes"));
break;
case 169:
// --bpf-program-file
cmdcfgs.emplace_back(SHRPX_OPT_BPF_PROGRAM_FILE, StringRef{optarg});
// --quic-bpf-program-file
cmdcfgs.emplace_back(SHRPX_OPT_QUIC_BPF_PROGRAM_FILE,
StringRef{optarg});
break;
case 170:
// --no-bpf
cmdcfgs.emplace_back(SHRPX_OPT_NO_BPF, StringRef::from_lit("yes"));
// --no-quic-bpf
cmdcfgs.emplace_back(SHRPX_OPT_NO_QUIC_BPF, StringRef::from_lit("yes"));
break;
case 171:
// --http2-altsvc

View File

@ -1740,11 +1740,6 @@ int option_lookup_token(const char *name, size_t namelen) {
return SHRPX_OPTID_ALTSVC;
}
break;
case 'f':
if (util::strieq_l("no-bp", name, 5)) {
return SHRPX_OPTID_NO_BPF;
}
break;
case 'n':
if (util::strieq_l("daemo", name, 5)) {
return SHRPX_OPTID_DAEMON;
@ -1871,6 +1866,11 @@ int option_lookup_token(const char *name, size_t namelen) {
return SHRPX_OPTID_SERVER_NAME;
}
break;
case 'f':
if (util::strieq_l("no-quic-bp", name, 10)) {
return SHRPX_OPTID_NO_QUIC_BPF;
}
break;
case 'r':
if (util::strieq_l("tls-sct-di", name, 10)) {
return SHRPX_OPTID_TLS_SCT_DIR;
@ -2042,9 +2042,6 @@ int option_lookup_token(const char *name, size_t namelen) {
case 16:
switch (name[15]) {
case 'e':
if (util::strieq_l("bpf-program-fil", name, 15)) {
return SHRPX_OPTID_BPF_PROGRAM_FILE;
}
if (util::strieq_l("certificate-fil", name, 15)) {
return SHRPX_OPTID_CERTIFICATE_FILE;
}
@ -2203,6 +2200,11 @@ int option_lookup_token(const char *name, size_t namelen) {
return SHRPX_OPTID_BACKEND_TLS_SNI_FIELD;
}
break;
case 'e':
if (util::strieq_l("quic-bpf-program-fil", name, 20)) {
return SHRPX_OPTID_QUIC_BPF_PROGRAM_FILE;
}
break;
case 'l':
if (util::strieq_l("accept-proxy-protoco", name, 20)) {
return SHRPX_OPTID_ACCEPT_PROXY_PROTOCOL;
@ -3879,13 +3881,13 @@ int parse_config(Config *config, int optid, const StringRef &opt,
config->http.early_data.strip_incoming = !util::strieq_l("yes", optarg);
return 0;
case SHRPX_OPTID_BPF_PROGRAM_FILE:
case SHRPX_OPTID_QUIC_BPF_PROGRAM_FILE:
#ifdef ENABLE_HTTP3
config->quic.bpf.prog_file = make_string_ref(config->balloc, optarg);
#endif // ENABLE_HTTP3
return 0;
case SHRPX_OPTID_NO_BPF:
case SHRPX_OPTID_NO_QUIC_BPF:
#ifdef ENABLE_HTTP3
config->quic.bpf.disabled = util::strieq_l("yes", optarg);
#endif // ENABLE_HTTP3

View File

@ -363,9 +363,9 @@ constexpr auto SHRPX_OPT_TLS13_CLIENT_CIPHERS =
StringRef::from_lit("tls13-client-ciphers");
constexpr auto SHRPX_OPT_NO_STRIP_INCOMING_EARLY_DATA =
StringRef::from_lit("no-strip-incoming-early-data");
constexpr auto SHRPX_OPT_BPF_PROGRAM_FILE =
StringRef::from_lit("bpf-program-file");
constexpr auto SHRPX_OPT_NO_BPF = StringRef::from_lit("no-bpf");
constexpr auto SHRPX_OPT_QUIC_BPF_PROGRAM_FILE =
StringRef::from_lit("quic-bpf-program-file");
constexpr auto SHRPX_OPT_NO_QUIC_BPF = StringRef::from_lit("no-quic-bpf");
constexpr auto SHRPX_OPT_HTTP2_ALTSVC = StringRef::from_lit("http2-altsvc");
constexpr auto SHRPX_OPT_FRONTEND_HTTP3_READ_TIMEOUT =
StringRef::from_lit("frontend-http3-read-timeout");
@ -1149,7 +1149,6 @@ enum {
SHRPX_OPTID_BACKEND_TLS_SNI_FIELD,
SHRPX_OPTID_BACKEND_WRITE_TIMEOUT,
SHRPX_OPTID_BACKLOG,
SHRPX_OPTID_BPF_PROGRAM_FILE,
SHRPX_OPTID_CACERT,
SHRPX_OPTID_CERTIFICATE_FILE,
SHRPX_OPTID_CIPHERS,
@ -1220,13 +1219,13 @@ enum {
SHRPX_OPTID_MAX_RESPONSE_HEADER_FIELDS,
SHRPX_OPTID_MRUBY_FILE,
SHRPX_OPTID_NO_ADD_X_FORWARDED_PROTO,
SHRPX_OPTID_NO_BPF,
SHRPX_OPTID_NO_HOST_REWRITE,
SHRPX_OPTID_NO_HTTP2_CIPHER_BLACK_LIST,
SHRPX_OPTID_NO_HTTP2_CIPHER_BLOCK_LIST,
SHRPX_OPTID_NO_KQUEUE,
SHRPX_OPTID_NO_LOCATION_REWRITE,
SHRPX_OPTID_NO_OCSP,
SHRPX_OPTID_NO_QUIC_BPF,
SHRPX_OPTID_NO_SERVER_PUSH,
SHRPX_OPTID_NO_SERVER_REWRITE,
SHRPX_OPTID_NO_STRIP_INCOMING_EARLY_DATA,
@ -1241,6 +1240,7 @@ enum {
SHRPX_OPTID_PRIVATE_KEY_FILE,
SHRPX_OPTID_PRIVATE_KEY_PASSWD_FILE,
SHRPX_OPTID_PSK_SECRETS,
SHRPX_OPTID_QUIC_BPF_PROGRAM_FILE,
SHRPX_OPTID_READ_BURST,
SHRPX_OPTID_READ_RATE,
SHRPX_OPTID_REDIRECT_HTTPS_PORT,