Mercurial > hg > nginx-quic
annotate src/stream/ngx_stream_quic_module.c @ 8622:a2cef164a924 quic
QUIC: simplified stream fd initialization.
author | Roman Arutyunyan <arut@nginx.com> |
---|---|
date | Tue, 21 Sep 2021 18:25:26 +0300 |
parents | 8ab0d609af09 |
children | 4b2d259bdadd |
rev | line source |
---|---|
8000
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
1 |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
2 /* |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
3 * Copyright (C) Nginx, Inc. |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
4 * Copyright (C) Roman Arutyunyan |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
5 */ |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
6 |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
7 |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
8 #include <ngx_config.h> |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
9 #include <ngx_core.h> |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
10 #include <ngx_stream.h> |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
11 |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
12 |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
13 static ngx_int_t ngx_stream_variable_quic(ngx_stream_session_t *s, |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
14 ngx_stream_variable_value_t *v, uintptr_t data); |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
15 static ngx_int_t ngx_stream_quic_add_variables(ngx_conf_t *cf); |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
16 static void *ngx_stream_quic_create_srv_conf(ngx_conf_t *cf); |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
17 static char *ngx_stream_quic_merge_srv_conf(ngx_conf_t *cf, void *parent, |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
18 void *child); |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
19 static char *ngx_stream_quic_max_ack_delay(ngx_conf_t *cf, void *post, |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
20 void *data); |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
21 static char *ngx_stream_quic_max_udp_payload_size(ngx_conf_t *cf, void *post, |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
22 void *data); |
8287
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
23 static char *ngx_stream_quic_host_key(ngx_conf_t *cf, ngx_command_t *cmd, |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
24 void *conf); |
8000
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
25 |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
26 |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
27 static ngx_conf_post_t ngx_stream_quic_max_ack_delay_post = |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
28 { ngx_stream_quic_max_ack_delay }; |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
29 static ngx_conf_post_t ngx_stream_quic_max_udp_payload_size_post = |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
30 { ngx_stream_quic_max_udp_payload_size }; |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
31 static ngx_conf_num_bounds_t ngx_stream_quic_ack_delay_exponent_bounds = |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
32 { ngx_conf_check_num_bounds, 0, 20 }; |
8101
bed310672f39
QUIC: moved ssl configuration pointer to quic configuration.
Vladimir Homutov <vl@nginx.com>
parents:
8000
diff
changeset
|
33 static ngx_conf_num_bounds_t |
8000
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
34 ngx_stream_quic_active_connection_id_limit_bounds = |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
35 { ngx_conf_check_num_bounds, 2, -1 }; |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
36 |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
37 |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
38 static ngx_command_t ngx_stream_quic_commands[] = { |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
39 |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
40 { ngx_string("quic_max_idle_timeout"), |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
41 NGX_STREAM_MAIN_CONF|NGX_STREAM_SRV_CONF|NGX_CONF_TAKE1, |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
42 ngx_conf_set_msec_slot, |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
43 NGX_STREAM_SRV_CONF_OFFSET, |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
44 offsetof(ngx_quic_conf_t, tp.max_idle_timeout), |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
45 NULL }, |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
46 |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
47 { ngx_string("quic_max_ack_delay"), |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
48 NGX_STREAM_MAIN_CONF|NGX_STREAM_SRV_CONF|NGX_CONF_TAKE1, |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
49 ngx_conf_set_msec_slot, |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
50 NGX_STREAM_SRV_CONF_OFFSET, |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
51 offsetof(ngx_quic_conf_t, tp.max_ack_delay), |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
52 &ngx_stream_quic_max_ack_delay_post }, |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
53 |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
54 { ngx_string("quic_max_udp_payload_size"), |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
55 NGX_STREAM_MAIN_CONF|NGX_STREAM_SRV_CONF|NGX_CONF_TAKE1, |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
56 ngx_conf_set_size_slot, |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
57 NGX_STREAM_SRV_CONF_OFFSET, |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
58 offsetof(ngx_quic_conf_t, tp.max_udp_payload_size), |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
59 &ngx_stream_quic_max_udp_payload_size_post }, |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
60 |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
61 { ngx_string("quic_initial_max_data"), |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
62 NGX_STREAM_MAIN_CONF|NGX_STREAM_SRV_CONF|NGX_CONF_TAKE1, |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
63 ngx_conf_set_size_slot, |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
64 NGX_STREAM_SRV_CONF_OFFSET, |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
65 offsetof(ngx_quic_conf_t, tp.initial_max_data), |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
66 NULL }, |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
67 |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
68 { ngx_string("quic_initial_max_stream_data_bidi_local"), |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
69 NGX_STREAM_MAIN_CONF|NGX_STREAM_SRV_CONF|NGX_CONF_TAKE1, |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
70 ngx_conf_set_size_slot, |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
71 NGX_STREAM_SRV_CONF_OFFSET, |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
72 offsetof(ngx_quic_conf_t, tp.initial_max_stream_data_bidi_local), |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
73 NULL }, |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
74 |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
75 { ngx_string("quic_initial_max_stream_data_bidi_remote"), |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
76 NGX_STREAM_MAIN_CONF|NGX_STREAM_SRV_CONF|NGX_CONF_TAKE1, |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
77 ngx_conf_set_size_slot, |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
78 NGX_STREAM_SRV_CONF_OFFSET, |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
79 offsetof(ngx_quic_conf_t, tp.initial_max_stream_data_bidi_remote), |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
80 NULL }, |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
81 |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
82 { ngx_string("quic_initial_max_stream_data_uni"), |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
83 NGX_STREAM_MAIN_CONF|NGX_STREAM_SRV_CONF|NGX_CONF_TAKE1, |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
84 ngx_conf_set_size_slot, |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
85 NGX_STREAM_SRV_CONF_OFFSET, |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
86 offsetof(ngx_quic_conf_t, tp.initial_max_stream_data_uni), |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
87 NULL }, |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
88 |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
89 { ngx_string("quic_initial_max_streams_bidi"), |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
90 NGX_STREAM_MAIN_CONF|NGX_STREAM_SRV_CONF|NGX_CONF_TAKE1, |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
91 ngx_conf_set_num_slot, |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
92 NGX_STREAM_SRV_CONF_OFFSET, |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
93 offsetof(ngx_quic_conf_t, tp.initial_max_streams_bidi), |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
94 NULL }, |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
95 |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
96 { ngx_string("quic_initial_max_streams_uni"), |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
97 NGX_STREAM_MAIN_CONF|NGX_STREAM_SRV_CONF|NGX_CONF_TAKE1, |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
98 ngx_conf_set_num_slot, |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
99 NGX_STREAM_SRV_CONF_OFFSET, |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
100 offsetof(ngx_quic_conf_t, tp.initial_max_streams_uni), |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
101 NULL }, |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
102 |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
103 { ngx_string("quic_ack_delay_exponent"), |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
104 NGX_STREAM_MAIN_CONF|NGX_STREAM_SRV_CONF|NGX_CONF_TAKE1, |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
105 ngx_conf_set_num_slot, |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
106 NGX_STREAM_SRV_CONF_OFFSET, |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
107 offsetof(ngx_quic_conf_t, tp.ack_delay_exponent), |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
108 &ngx_stream_quic_ack_delay_exponent_bounds }, |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
109 |
8198
45db1b5c1706
QUIC: connection multiplexing per port.
Roman Arutyunyan <arut@nginx.com>
parents:
8101
diff
changeset
|
110 { ngx_string("quic_disable_active_migration"), |
8000
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
111 NGX_STREAM_MAIN_CONF|NGX_STREAM_SRV_CONF|NGX_CONF_TAKE1, |
8198
45db1b5c1706
QUIC: connection multiplexing per port.
Roman Arutyunyan <arut@nginx.com>
parents:
8101
diff
changeset
|
112 ngx_conf_set_flag_slot, |
8000
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
113 NGX_STREAM_SRV_CONF_OFFSET, |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
114 offsetof(ngx_quic_conf_t, tp.disable_active_migration), |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
115 NULL }, |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
116 |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
117 { ngx_string("quic_active_connection_id_limit"), |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
118 NGX_STREAM_MAIN_CONF|NGX_STREAM_SRV_CONF|NGX_CONF_TAKE1, |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
119 ngx_conf_set_num_slot, |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
120 NGX_STREAM_SRV_CONF_OFFSET, |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
121 offsetof(ngx_quic_conf_t, tp.active_connection_id_limit), |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
122 &ngx_stream_quic_active_connection_id_limit_bounds }, |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
123 |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
124 { ngx_string("quic_retry"), |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
125 NGX_STREAM_MAIN_CONF|NGX_STREAM_SRV_CONF|NGX_CONF_FLAG, |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
126 ngx_conf_set_flag_slot, |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
127 NGX_STREAM_SRV_CONF_OFFSET, |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
128 offsetof(ngx_quic_conf_t, retry), |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
129 NULL }, |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
130 |
8540
8ab0d609af09
QUIC: the "quic_gso" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8507
diff
changeset
|
131 { ngx_string("quic_gso"), |
8ab0d609af09
QUIC: the "quic_gso" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8507
diff
changeset
|
132 NGX_STREAM_MAIN_CONF|NGX_STREAM_SRV_CONF|NGX_CONF_FLAG, |
8ab0d609af09
QUIC: the "quic_gso" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8507
diff
changeset
|
133 ngx_conf_set_flag_slot, |
8ab0d609af09
QUIC: the "quic_gso" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8507
diff
changeset
|
134 NGX_STREAM_SRV_CONF_OFFSET, |
8ab0d609af09
QUIC: the "quic_gso" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8507
diff
changeset
|
135 offsetof(ngx_quic_conf_t, gso_enabled), |
8ab0d609af09
QUIC: the "quic_gso" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8507
diff
changeset
|
136 NULL }, |
8ab0d609af09
QUIC: the "quic_gso" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8507
diff
changeset
|
137 |
8287
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
138 { ngx_string("quic_host_key"), |
8202
50f5c4f75fc1
QUIC: added quic_stateless_reset_token_key Stream directive.
Roman Arutyunyan <arut@nginx.com>
parents:
8200
diff
changeset
|
139 NGX_STREAM_MAIN_CONF|NGX_STREAM_SRV_CONF|NGX_CONF_FLAG, |
8287
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
140 ngx_stream_quic_host_key, |
8202
50f5c4f75fc1
QUIC: added quic_stateless_reset_token_key Stream directive.
Roman Arutyunyan <arut@nginx.com>
parents:
8200
diff
changeset
|
141 NGX_STREAM_SRV_CONF_OFFSET, |
8287
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
142 0, |
8202
50f5c4f75fc1
QUIC: added quic_stateless_reset_token_key Stream directive.
Roman Arutyunyan <arut@nginx.com>
parents:
8200
diff
changeset
|
143 NULL }, |
50f5c4f75fc1
QUIC: added quic_stateless_reset_token_key Stream directive.
Roman Arutyunyan <arut@nginx.com>
parents:
8200
diff
changeset
|
144 |
8000
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
145 ngx_null_command |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
146 }; |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
147 |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
148 |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
149 static ngx_stream_module_t ngx_stream_quic_module_ctx = { |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
150 ngx_stream_quic_add_variables, /* preconfiguration */ |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
151 NULL, /* postconfiguration */ |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
152 |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
153 NULL, /* create main configuration */ |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
154 NULL, /* init main configuration */ |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
155 |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
156 ngx_stream_quic_create_srv_conf, /* create server configuration */ |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
157 ngx_stream_quic_merge_srv_conf, /* merge server configuration */ |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
158 }; |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
159 |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
160 |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
161 ngx_module_t ngx_stream_quic_module = { |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
162 NGX_MODULE_V1, |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
163 &ngx_stream_quic_module_ctx, /* module context */ |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
164 ngx_stream_quic_commands, /* module directives */ |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
165 NGX_STREAM_MODULE, /* module type */ |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
166 NULL, /* init master */ |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
167 NULL, /* init module */ |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
168 NULL, /* init process */ |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
169 NULL, /* init thread */ |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
170 NULL, /* exit thread */ |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
171 NULL, /* exit process */ |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
172 NULL, /* exit master */ |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
173 NGX_MODULE_V1_PADDING |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
174 }; |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
175 |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
176 |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
177 static ngx_stream_variable_t ngx_stream_quic_vars[] = { |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
178 |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
179 { ngx_string("quic"), NULL, ngx_stream_variable_quic, 0, 0, 0 }, |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
180 |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
181 ngx_stream_null_variable |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
182 }; |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
183 |
8287
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
184 static ngx_str_t ngx_stream_quic_salt = ngx_string("ngx_quic"); |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
185 |
8000
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
186 |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
187 static ngx_int_t |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
188 ngx_stream_variable_quic(ngx_stream_session_t *s, |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
189 ngx_stream_variable_value_t *v, uintptr_t data) |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
190 { |
8200
279ad36f2f4b
QUIC: renamed c->qs to c->quic.
Roman Arutyunyan <arut@nginx.com>
parents:
8198
diff
changeset
|
191 if (s->connection->quic) { |
8000
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
192 |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
193 v->len = 4; |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
194 v->valid = 1; |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
195 v->no_cacheable = 1; |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
196 v->not_found = 0; |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
197 v->data = (u_char *) "quic"; |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
198 return NGX_OK; |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
199 } |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
200 |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
201 v->not_found = 1; |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
202 |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
203 return NGX_OK; |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
204 } |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
205 |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
206 |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
207 static ngx_int_t |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
208 ngx_stream_quic_add_variables(ngx_conf_t *cf) |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
209 { |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
210 ngx_stream_variable_t *var, *v; |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
211 |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
212 for (v = ngx_stream_quic_vars; v->name.len; v++) { |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
213 var = ngx_stream_add_variable(cf, &v->name, v->flags); |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
214 if (var == NULL) { |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
215 return NGX_ERROR; |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
216 } |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
217 |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
218 var->get_handler = v->get_handler; |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
219 var->data = v->data; |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
220 } |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
221 |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
222 return NGX_OK; |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
223 } |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
224 |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
225 |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
226 static void * |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
227 ngx_stream_quic_create_srv_conf(ngx_conf_t *cf) |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
228 { |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
229 ngx_quic_conf_t *conf; |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
230 |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
231 conf = ngx_pcalloc(cf->pool, sizeof(ngx_quic_conf_t)); |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
232 if (conf == NULL) { |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
233 return NULL; |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
234 } |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
235 |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
236 /* |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
237 * set by ngx_pcalloc(): |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
238 * |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
239 * conf->tp.original_dcid = { 0, NULL }; |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
240 * conf->tp.initial_scid = { 0, NULL }; |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
241 * conf->tp.retry_scid = { 0, NULL }; |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
242 * conf->tp.preferred_address = NULL |
8287
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
243 * conf->host_key = { 0, NULL } |
8000
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
244 * conf->require_alpn = 0; |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
245 */ |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
246 |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
247 conf->tp.max_idle_timeout = NGX_CONF_UNSET_MSEC; |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
248 conf->tp.max_ack_delay = NGX_CONF_UNSET_MSEC; |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
249 conf->tp.max_udp_payload_size = NGX_CONF_UNSET_SIZE; |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
250 conf->tp.initial_max_data = NGX_CONF_UNSET_SIZE; |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
251 conf->tp.initial_max_stream_data_bidi_local = NGX_CONF_UNSET_SIZE; |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
252 conf->tp.initial_max_stream_data_bidi_remote = NGX_CONF_UNSET_SIZE; |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
253 conf->tp.initial_max_stream_data_uni = NGX_CONF_UNSET_SIZE; |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
254 conf->tp.initial_max_streams_bidi = NGX_CONF_UNSET_UINT; |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
255 conf->tp.initial_max_streams_uni = NGX_CONF_UNSET_UINT; |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
256 conf->tp.ack_delay_exponent = NGX_CONF_UNSET_UINT; |
8198
45db1b5c1706
QUIC: connection multiplexing per port.
Roman Arutyunyan <arut@nginx.com>
parents:
8101
diff
changeset
|
257 conf->tp.disable_active_migration = NGX_CONF_UNSET; |
8000
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
258 conf->tp.active_connection_id_limit = NGX_CONF_UNSET_UINT; |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
259 |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
260 conf->retry = NGX_CONF_UNSET; |
8540
8ab0d609af09
QUIC: the "quic_gso" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8507
diff
changeset
|
261 conf->gso_enabled = NGX_CONF_UNSET; |
8000
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
262 |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
263 return conf; |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
264 } |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
265 |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
266 |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
267 static char * |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
268 ngx_stream_quic_merge_srv_conf(ngx_conf_t *cf, void *parent, void *child) |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
269 { |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
270 ngx_quic_conf_t *prev = parent; |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
271 ngx_quic_conf_t *conf = child; |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
272 |
8101
bed310672f39
QUIC: moved ssl configuration pointer to quic configuration.
Vladimir Homutov <vl@nginx.com>
parents:
8000
diff
changeset
|
273 ngx_stream_ssl_conf_t *scf; |
bed310672f39
QUIC: moved ssl configuration pointer to quic configuration.
Vladimir Homutov <vl@nginx.com>
parents:
8000
diff
changeset
|
274 |
8000
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
275 ngx_conf_merge_msec_value(conf->tp.max_idle_timeout, |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
276 prev->tp.max_idle_timeout, 60000); |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
277 |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
278 ngx_conf_merge_msec_value(conf->tp.max_ack_delay, |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
279 prev->tp.max_ack_delay, |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
280 NGX_QUIC_DEFAULT_MAX_ACK_DELAY); |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
281 |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
282 ngx_conf_merge_size_value(conf->tp.max_udp_payload_size, |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
283 prev->tp.max_udp_payload_size, |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
284 NGX_QUIC_MAX_UDP_PAYLOAD_SIZE); |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
285 |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
286 ngx_conf_merge_size_value(conf->tp.initial_max_data, |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
287 prev->tp.initial_max_data, |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
288 16 * NGX_QUIC_STREAM_BUFSIZE); |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
289 |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
290 ngx_conf_merge_size_value(conf->tp.initial_max_stream_data_bidi_local, |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
291 prev->tp.initial_max_stream_data_bidi_local, |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
292 NGX_QUIC_STREAM_BUFSIZE); |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
293 |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
294 ngx_conf_merge_size_value(conf->tp.initial_max_stream_data_bidi_remote, |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
295 prev->tp.initial_max_stream_data_bidi_remote, |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
296 NGX_QUIC_STREAM_BUFSIZE); |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
297 |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
298 ngx_conf_merge_size_value(conf->tp.initial_max_stream_data_uni, |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
299 prev->tp.initial_max_stream_data_uni, |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
300 NGX_QUIC_STREAM_BUFSIZE); |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
301 |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
302 ngx_conf_merge_uint_value(conf->tp.initial_max_streams_bidi, |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
303 prev->tp.initial_max_streams_bidi, 16); |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
304 |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
305 ngx_conf_merge_uint_value(conf->tp.initial_max_streams_uni, |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
306 prev->tp.initial_max_streams_uni, 16); |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
307 |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
308 ngx_conf_merge_uint_value(conf->tp.ack_delay_exponent, |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
309 prev->tp.ack_delay_exponent, |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
310 NGX_QUIC_DEFAULT_ACK_DELAY_EXPONENT); |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
311 |
8198
45db1b5c1706
QUIC: connection multiplexing per port.
Roman Arutyunyan <arut@nginx.com>
parents:
8101
diff
changeset
|
312 ngx_conf_merge_value(conf->tp.disable_active_migration, |
45db1b5c1706
QUIC: connection multiplexing per port.
Roman Arutyunyan <arut@nginx.com>
parents:
8101
diff
changeset
|
313 prev->tp.disable_active_migration, 0); |
8000
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
314 |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
315 ngx_conf_merge_uint_value(conf->tp.active_connection_id_limit, |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
316 prev->tp.active_connection_id_limit, 2); |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
317 |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
318 ngx_conf_merge_value(conf->retry, prev->retry, 0); |
8540
8ab0d609af09
QUIC: the "quic_gso" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8507
diff
changeset
|
319 ngx_conf_merge_value(conf->gso_enabled, prev->gso_enabled, 0); |
8000
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
320 |
8287
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
321 ngx_conf_merge_str_value(conf->host_key, prev->host_key, ""); |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
322 |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
323 if (conf->host_key.len == 0) { |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
324 |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
325 conf->host_key.len = NGX_QUIC_DEFAULT_HOST_KEY_LEN; |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
326 conf->host_key.data = ngx_palloc(cf->pool, conf->host_key.len); |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
327 if (conf->host_key.data == NULL) { |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
328 return NGX_CONF_ERROR; |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
329 } |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
330 |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
331 if (RAND_bytes(conf->host_key.data, NGX_QUIC_DEFAULT_HOST_KEY_LEN) |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
332 <= 0) |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
333 { |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
334 return NGX_CONF_ERROR; |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
335 } |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
336 } |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
337 |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
338 if (ngx_quic_derive_key(cf->log, "av_token_key", |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
339 &conf->host_key, &ngx_stream_quic_salt, |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
340 conf->av_token_key, NGX_QUIC_AV_KEY_LEN) |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
341 != NGX_OK) |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
342 { |
8279 | 343 return NGX_CONF_ERROR; |
8000
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
344 } |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
345 |
8287
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
346 if (ngx_quic_derive_key(cf->log, "sr_token_key", |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
347 &conf->host_key, &ngx_stream_quic_salt, |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
348 conf->sr_token_key, NGX_QUIC_SR_KEY_LEN) |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
349 != NGX_OK) |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
350 { |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
351 return NGX_CONF_ERROR; |
8204
831d1960826f
QUIC: generate default stateless reset token key.
Roman Arutyunyan <arut@nginx.com>
parents:
8203
diff
changeset
|
352 } |
831d1960826f
QUIC: generate default stateless reset token key.
Roman Arutyunyan <arut@nginx.com>
parents:
8203
diff
changeset
|
353 |
8101
bed310672f39
QUIC: moved ssl configuration pointer to quic configuration.
Vladimir Homutov <vl@nginx.com>
parents:
8000
diff
changeset
|
354 scf = ngx_stream_conf_get_module_srv_conf(cf, ngx_stream_ssl_module); |
bed310672f39
QUIC: moved ssl configuration pointer to quic configuration.
Vladimir Homutov <vl@nginx.com>
parents:
8000
diff
changeset
|
355 conf->ssl = &scf->ssl; |
bed310672f39
QUIC: moved ssl configuration pointer to quic configuration.
Vladimir Homutov <vl@nginx.com>
parents:
8000
diff
changeset
|
356 |
8000
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
357 return NGX_CONF_OK; |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
358 } |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
359 |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
360 |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
361 static char * |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
362 ngx_stream_quic_max_ack_delay(ngx_conf_t *cf, void *post, void *data) |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
363 { |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
364 ngx_msec_t *sp = data; |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
365 |
8507
f8ad3dd142ad
QUIC: consider max_ack_delay=16384 invalid.
Roman Arutyunyan <arut@nginx.com>
parents:
8415
diff
changeset
|
366 if (*sp >= 16384) { |
8000
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
367 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
368 "\"quic_max_ack_delay\" must be less than 16384"); |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
369 |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
370 return NGX_CONF_ERROR; |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
371 } |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
372 |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
373 return NGX_CONF_OK; |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
374 } |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
375 |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
376 |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
377 static char * |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
378 ngx_stream_quic_max_udp_payload_size(ngx_conf_t *cf, void *post, void *data) |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
379 { |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
380 size_t *sp = data; |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
381 |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
382 if (*sp < NGX_QUIC_MIN_INITIAL_SIZE |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
383 || *sp > NGX_QUIC_MAX_UDP_PAYLOAD_SIZE) |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
384 { |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
385 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
386 "\"quic_max_udp_payload_size\" must be between " |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
387 "%d and %d", |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
388 NGX_QUIC_MIN_INITIAL_SIZE, |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
389 NGX_QUIC_MAX_UDP_PAYLOAD_SIZE); |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
390 |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
391 return NGX_CONF_ERROR; |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
392 } |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
393 |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
394 return NGX_CONF_OK; |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
diff
changeset
|
395 } |
8287
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
396 |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
397 |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
398 static char * |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
399 ngx_stream_quic_host_key(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
400 { |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
401 ngx_quic_conf_t *qcf = conf; |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
402 |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
403 u_char *buf; |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
404 size_t size; |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
405 ssize_t n; |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
406 ngx_str_t *value; |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
407 ngx_file_t file; |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
408 ngx_file_info_t fi; |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
409 |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
410 if (qcf->host_key.len) { |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
411 return "is duplicate"; |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
412 } |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
413 |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
414 buf = NULL; |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
415 #if (NGX_SUPPRESS_WARN) |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
416 size = 0; |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
417 #endif |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
418 |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
419 value = cf->args->elts; |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
420 |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
421 if (ngx_conf_full_name(cf->cycle, &value[1], 1) != NGX_OK) { |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
422 return NGX_CONF_ERROR; |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
423 } |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
424 |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
425 ngx_memzero(&file, sizeof(ngx_file_t)); |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
426 file.name = value[1]; |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
427 file.log = cf->log; |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
428 |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
429 file.fd = ngx_open_file(file.name.data, NGX_FILE_RDONLY, NGX_FILE_OPEN, 0); |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
430 |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
431 if (file.fd == NGX_INVALID_FILE) { |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
432 ngx_conf_log_error(NGX_LOG_EMERG, cf, ngx_errno, |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
433 ngx_open_file_n " \"%V\" failed", &file.name); |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
434 return NGX_CONF_ERROR; |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
435 } |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
436 |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
437 if (ngx_fd_info(file.fd, &fi) == NGX_FILE_ERROR) { |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
438 ngx_conf_log_error(NGX_LOG_CRIT, cf, ngx_errno, |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
439 ngx_fd_info_n " \"%V\" failed", &file.name); |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
440 goto failed; |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
441 } |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
442 |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
443 size = ngx_file_size(&fi); |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
444 |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
445 if (size == 0) { |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
446 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
447 "\"%V\" zero key size", &file.name); |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
448 goto failed; |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
449 } |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
450 |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
451 buf = ngx_pnalloc(cf->pool, size); |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
452 if (buf == NULL) { |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
453 goto failed; |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
454 } |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
455 |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
456 n = ngx_read_file(&file, buf, size, 0); |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
457 |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
458 if (n == NGX_ERROR) { |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
459 ngx_conf_log_error(NGX_LOG_CRIT, cf, ngx_errno, |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
460 ngx_read_file_n " \"%V\" failed", &file.name); |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
461 goto failed; |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
462 } |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
463 |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
464 if ((size_t) n != size) { |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
465 ngx_conf_log_error(NGX_LOG_CRIT, cf, 0, |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
466 ngx_read_file_n " \"%V\" returned only " |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
467 "%z bytes instead of %uz", &file.name, n, size); |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
468 goto failed; |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
469 } |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
470 |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
471 qcf->host_key.data = buf; |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
472 qcf->host_key.len = n; |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
473 |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
474 if (ngx_close_file(file.fd) == NGX_FILE_ERROR) { |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
475 ngx_log_error(NGX_LOG_ALERT, cf->log, ngx_errno, |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
476 ngx_close_file_n " \"%V\" failed", &file.name); |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
477 } |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
478 |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
479 return NGX_CONF_OK; |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
480 |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
481 failed: |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
482 |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
483 if (ngx_close_file(file.fd) == NGX_FILE_ERROR) { |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
484 ngx_log_error(NGX_LOG_ALERT, cf->log, ngx_errno, |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
485 ngx_close_file_n " \"%V\" failed", &file.name); |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
486 } |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
487 |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
488 if (buf) { |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
489 ngx_explicit_memzero(buf, size); |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
490 } |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
491 |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
492 return NGX_CONF_ERROR; |
cef042935003
QUIC: the "quic_host_key" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8279
diff
changeset
|
493 } |