blob: 03f4178259c3bc43e507a9e9639d9ede53ca63a4 [file] [log] [blame]
Amaury Denoyellec8b4ce42022-01-11 11:54:59 +01001#include <haproxy/api.h>
Amaury Denoyelle97e84c62022-04-19 18:26:55 +02002#include <haproxy/cfgparse.h>
3#include <haproxy/global-t.h>
Amaury Denoyellec8b4ce42022-01-11 11:54:59 +01004#include <haproxy/listener.h>
5#include <haproxy/proxy-t.h>
Amaury Denoyelle97e84c62022-04-19 18:26:55 +02006#include <haproxy/tools.h>
Amaury Denoyellec8b4ce42022-01-11 11:54:59 +01007
Amaury Denoyelleb76ae692022-01-11 14:16:37 +01008static int bind_parse_quic_force_retry(char **args, int cur_arg, struct proxy *px, struct bind_conf *conf, char **err)
9{
10 conf->quic_force_retry = 1;
11 return 0;
12}
13
Amaury Denoyellec8b4ce42022-01-11 11:54:59 +010014static struct bind_kw_list bind_kws = { "QUIC", { }, {
Amaury Denoyelleb76ae692022-01-11 14:16:37 +010015 { "quic-force-retry", bind_parse_quic_force_retry, 0 },
Amaury Denoyellec8b4ce42022-01-11 11:54:59 +010016 { NULL, NULL, 0 },
17}};
18
19INITCALL1(STG_REGISTER, bind_register_keywords, &bind_kws);
Amaury Denoyelle97e84c62022-04-19 18:26:55 +020020
Frédéric Lécaille92862102022-05-20 16:29:10 +020021/* Parse any tune.quic.* setting with strictly positive integer values.
22 * Return -1 on alert, or 0 if succeeded.
23 */
24static int cfg_parse_quic_tune_setting(char **args, int section_type,
25 struct proxy *curpx,
26 const struct proxy *defpx,
27 const char *file, int line, char **err)
Amaury Denoyelle97e84c62022-04-19 18:26:55 +020028{
29 unsigned int arg = 0;
Frédéric Lécaille92862102022-05-20 16:29:10 +020030 int prefix_len = strlen("tune.quic.");
Amaury Denoyelle97e84c62022-04-19 18:26:55 +020031
32 if (too_many_args(1, args, err, NULL))
33 return -1;
34
35 if (*(args[1]) != 0)
36 arg = atoi(args[1]);
37
38 if (arg < 1) {
39 memprintf(err, "'%s' expects a positive integer.", args[0]);
40 return -1;
41 }
42
Frédéric Lécaille92862102022-05-20 16:29:10 +020043 if (strcmp(args[0] + prefix_len, "conn-buf-limit") == 0)
44 global.tune.quic_streams_buf = arg;
45 else if (strcmp(args[0] + prefix_len, "retry-threshold") == 0)
46 global.tune.quic_retry_threshold = arg;
47 else {
48 memprintf(err, "'%s' keyword not unhandled (please report this bug).", args[0]);
49 return -1;
50 }
Amaury Denoyelle97e84c62022-04-19 18:26:55 +020051
52 return 0;
53}
54
55static struct cfg_kw_list cfg_kws = {ILH, {
Frédéric Lécaille92862102022-05-20 16:29:10 +020056 { CFG_GLOBAL, "tune.quic.conn-buf-limit", cfg_parse_quic_tune_setting },
57 { CFG_GLOBAL, "tune.quic.retry-threshold", cfg_parse_quic_tune_setting },
Amaury Denoyelle97e84c62022-04-19 18:26:55 +020058 { 0, NULL, NULL }
59}};
60
61INITCALL1(STG_REGISTER, cfg_register_keywords, &cfg_kws);