Mercurial > hg > nginx
comparison src/event/ngx_event_quic_transport.h @ 8240:1f002206a59b quic
Added boundaries checks into frame parser.
The ngx_quic_parse_frame() functions now has new 'pkt' argument: the packet
header of a currently processed frame. This allows to log errors/debug
closer to reasons and perform additional checks regarding possible frame
types. The handler only performs processing of good frames.
A number of functions like read_uint32(), parse_int[_multi] probably should
be implemented as a macro, but currently it is better to have them as
functions for simpler debugging.
author | Vladimir Homutov <vl@nginx.com> |
---|---|
date | Thu, 19 Mar 2020 17:07:12 +0300 |
parents | ff540f13d95d |
children | db745339e54b |
comparison
equal
deleted
inserted
replaced
8239:5ad7bffd3850 | 8240:1f002206a59b |
---|---|
80 /* TODO: ecn counts */ | 80 /* TODO: ecn counts */ |
81 } ngx_quic_ack_frame_t; | 81 } ngx_quic_ack_frame_t; |
82 | 82 |
83 | 83 |
84 typedef struct { | 84 typedef struct { |
85 size_t offset; | 85 uint64_t offset; |
86 size_t len; | 86 uint64_t len; |
87 u_char *data; | 87 u_char *data; |
88 } ngx_quic_crypto_frame_t; | 88 } ngx_quic_crypto_frame_t; |
89 | 89 |
90 | 90 |
91 typedef struct { | 91 typedef struct { |
92 uint64_t seqnum; | 92 uint64_t seqnum; |
93 uint64_t retire; | 93 uint64_t retire; |
94 uint64_t len; | 94 uint8_t len; |
95 u_char cid[20]; | 95 u_char cid[20]; |
96 u_char srt[16]; | 96 u_char srt[16]; |
97 } ngx_quic_new_conn_id_frame_t; | 97 } ngx_quic_new_conn_id_frame_t; |
98 | 98 |
99 | 99 |
164 typedef struct { | 164 typedef struct { |
165 ngx_log_t *log; | 165 ngx_log_t *log; |
166 | 166 |
167 struct ngx_quic_secret_s *secret; | 167 struct ngx_quic_secret_s *secret; |
168 ngx_uint_t type; | 168 ngx_uint_t type; |
169 ngx_uint_t *number; | 169 ngx_uint_t *number; |
170 ngx_uint_t flags; | 170 uint8_t flags; |
171 uint32_t version; | 171 uint32_t version; |
172 ngx_str_t token; | 172 ngx_str_t token; |
173 enum ssl_encryption_level_t level; | 173 enum ssl_encryption_level_t level; |
174 | 174 |
175 /* filled in by parser */ | 175 /* filled in by parser */ |
195 ngx_int_t ngx_quic_parse_short_header(ngx_quic_header_t *pkt, | 195 ngx_int_t ngx_quic_parse_short_header(ngx_quic_header_t *pkt, |
196 ngx_str_t *dcid); | 196 ngx_str_t *dcid); |
197 ngx_int_t ngx_quic_parse_initial_header(ngx_quic_header_t *pkt); | 197 ngx_int_t ngx_quic_parse_initial_header(ngx_quic_header_t *pkt); |
198 ngx_int_t ngx_quic_parse_handshake_header(ngx_quic_header_t *pkt); | 198 ngx_int_t ngx_quic_parse_handshake_header(ngx_quic_header_t *pkt); |
199 | 199 |
200 ssize_t ngx_quic_parse_frame(u_char *start, u_char *end, | 200 ssize_t ngx_quic_parse_frame(ngx_quic_header_t *pkt, u_char *start, u_char *end, |
201 ngx_quic_frame_t *frame); | 201 ngx_quic_frame_t *frame); |
202 ssize_t ngx_quic_create_frame(u_char *p, u_char *end, ngx_quic_frame_t *f); | 202 ssize_t ngx_quic_create_frame(u_char *p, u_char *end, ngx_quic_frame_t *f); |
203 size_t ngx_quic_frame_len(ngx_quic_frame_t *frame); | 203 size_t ngx_quic_frame_len(ngx_quic_frame_t *frame); |
204 | 204 |
205 #endif /* _NGX_EVENT_QUIC_WIRE_H_INCLUDED_ */ | 205 #endif /* _NGX_EVENT_QUIC_WIRE_H_INCLUDED_ */ |