Mercurial > hg > nginx
annotate src/os/win32/ngx_errno.c @ 8971:1e2f4e9c8195 quic
QUIC: reworked migration handling.
The quic connection now holds active, backup and probe paths instead
of sockets. The number of migration paths is now limited and cannot
be inflated by a bad client or an attacker.
The client id is now associated with path rather than socket. This allows
to simplify processing of output and connection ids handling.
New migration abandons any previously started migrations. This allows to
free consumed client ids and request new for use in future migrations and
make progress in case when connection id limit is hit during migration.
A path now can be revalidated without losing its state.
The patch also fixes various issues with NAT rebinding case handling:
- paths are now validated (previously, there was no validation
and paths were left in limited state)
- attempt to reuse id on different path is now again verified
(this was broken in 40445fc7c403)
- former path is now validated in case of apparent migration
author | Vladimir Homutov <vl@nginx.com> |
---|---|
date | Wed, 19 Jan 2022 22:39:24 +0300 |
parents | 746567d633ac |
children |
rev | line source |
---|---|
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1 |
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
2 /* |
444
42d11f017717
nginx-0.1.0-2004-09-29-20:00:49 import; remove years from copyright
Igor Sysoev <igor@sysoev.ru>
parents:
441
diff
changeset
|
3 * Copyright (C) Igor Sysoev |
4412 | 4 * Copyright (C) Nginx, Inc. |
441
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
186
diff
changeset
|
5 */ |
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
186
diff
changeset
|
6 |
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
186
diff
changeset
|
7 |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
8 #include <ngx_config.h> |
98
c9b243802a17
nginx-0.0.1-2003-05-30-18:27:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
0
diff
changeset
|
9 #include <ngx_core.h> |
c9b243802a17
nginx-0.0.1-2003-05-30-18:27:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
0
diff
changeset
|
10 |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
11 |
2335
3d8ab5957202
ngx_strerror_r() style and size == 0 bug fix
Igor Sysoev <igor@sysoev.ru>
parents:
473
diff
changeset
|
12 u_char * |
3787
e294f37401c0
use copied strerror() messages and autoconfigured sys_nerr value
Igor Sysoev <igor@sysoev.ru>
parents:
2770
diff
changeset
|
13 ngx_strerror(ngx_err_t err, u_char *errstr, size_t size) |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
14 { |
2770
e70ac6e13f31
fallback to neutral language in FormatMessage()
Igor Sysoev <igor@sysoev.ru>
parents:
2766
diff
changeset
|
15 u_int len; |
e70ac6e13f31
fallback to neutral language in FormatMessage()
Igor Sysoev <igor@sysoev.ru>
parents:
2766
diff
changeset
|
16 static u_long lang = MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US); |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
17 |
461 | 18 if (size == 0) { |
19 return errstr; | |
20 } | |
21 | |
2770
e70ac6e13f31
fallback to neutral language in FormatMessage()
Igor Sysoev <igor@sysoev.ru>
parents:
2766
diff
changeset
|
22 len = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, |
e70ac6e13f31
fallback to neutral language in FormatMessage()
Igor Sysoev <igor@sysoev.ru>
parents:
2766
diff
changeset
|
23 NULL, err, lang, (char *) errstr, size, NULL); |
e70ac6e13f31
fallback to neutral language in FormatMessage()
Igor Sysoev <igor@sysoev.ru>
parents:
2766
diff
changeset
|
24 |
7585
746567d633ac
Win32: improved fallback on FormatMessage() errors.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4693
diff
changeset
|
25 if (len == 0 && lang) { |
2770
e70ac6e13f31
fallback to neutral language in FormatMessage()
Igor Sysoev <igor@sysoev.ru>
parents:
2766
diff
changeset
|
26 |
e70ac6e13f31
fallback to neutral language in FormatMessage()
Igor Sysoev <igor@sysoev.ru>
parents:
2766
diff
changeset
|
27 /* |
e70ac6e13f31
fallback to neutral language in FormatMessage()
Igor Sysoev <igor@sysoev.ru>
parents:
2766
diff
changeset
|
28 * Try to use English messages first and fallback to a language, |
e70ac6e13f31
fallback to neutral language in FormatMessage()
Igor Sysoev <igor@sysoev.ru>
parents:
2766
diff
changeset
|
29 * based on locale: non-English Windows have no English messages |
e70ac6e13f31
fallback to neutral language in FormatMessage()
Igor Sysoev <igor@sysoev.ru>
parents:
2766
diff
changeset
|
30 * at all. This way allows to use English messages at least on |
e70ac6e13f31
fallback to neutral language in FormatMessage()
Igor Sysoev <igor@sysoev.ru>
parents:
2766
diff
changeset
|
31 * Windows with MUI. |
e70ac6e13f31
fallback to neutral language in FormatMessage()
Igor Sysoev <igor@sysoev.ru>
parents:
2766
diff
changeset
|
32 */ |
e70ac6e13f31
fallback to neutral language in FormatMessage()
Igor Sysoev <igor@sysoev.ru>
parents:
2766
diff
changeset
|
33 |
e70ac6e13f31
fallback to neutral language in FormatMessage()
Igor Sysoev <igor@sysoev.ru>
parents:
2766
diff
changeset
|
34 lang = 0; |
e70ac6e13f31
fallback to neutral language in FormatMessage()
Igor Sysoev <igor@sysoev.ru>
parents:
2766
diff
changeset
|
35 |
e70ac6e13f31
fallback to neutral language in FormatMessage()
Igor Sysoev <igor@sysoev.ru>
parents:
2766
diff
changeset
|
36 len = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, |
e70ac6e13f31
fallback to neutral language in FormatMessage()
Igor Sysoev <igor@sysoev.ru>
parents:
2766
diff
changeset
|
37 NULL, err, lang, (char *) errstr, size, NULL); |
e70ac6e13f31
fallback to neutral language in FormatMessage()
Igor Sysoev <igor@sysoev.ru>
parents:
2766
diff
changeset
|
38 } |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
39 |
103
6dfda4cf5200
nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
98
diff
changeset
|
40 if (len == 0) { |
461 | 41 return ngx_snprintf(errstr, size, |
2740
e5a4be07c3eb
axe incomplete support of Winsock error descriptions on NT
Igor Sysoev <igor@sysoev.ru>
parents:
2739
diff
changeset
|
42 "FormatMessage() error:(%d)", GetLastError()); |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
43 } |
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
44 |
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
45 /* remove ".\r\n\0" */ |
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
46 while (errstr[len] == '\0' || errstr[len] == CR |
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
47 || errstr[len] == LF || errstr[len] == '.') |
461 | 48 { |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
49 --len; |
461 | 50 } |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
51 |
461 | 52 return &errstr[++len]; |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
53 } |
3787
e294f37401c0
use copied strerror() messages and autoconfigured sys_nerr value
Igor Sysoev <igor@sysoev.ru>
parents:
2770
diff
changeset
|
54 |
e294f37401c0
use copied strerror() messages and autoconfigured sys_nerr value
Igor Sysoev <igor@sysoev.ru>
parents:
2770
diff
changeset
|
55 |
4693
f1a0de6eb505
Fixed return type of ngx_strerror_init().
Maxim Dounin <mdounin@mdounin.ru>
parents:
4412
diff
changeset
|
56 ngx_int_t |
3787
e294f37401c0
use copied strerror() messages and autoconfigured sys_nerr value
Igor Sysoev <igor@sysoev.ru>
parents:
2770
diff
changeset
|
57 ngx_strerror_init(void) |
e294f37401c0
use copied strerror() messages and autoconfigured sys_nerr value
Igor Sysoev <igor@sysoev.ru>
parents:
2770
diff
changeset
|
58 { |
e294f37401c0
use copied strerror() messages and autoconfigured sys_nerr value
Igor Sysoev <igor@sysoev.ru>
parents:
2770
diff
changeset
|
59 return NGX_OK; |
e294f37401c0
use copied strerror() messages and autoconfigured sys_nerr value
Igor Sysoev <igor@sysoev.ru>
parents:
2770
diff
changeset
|
60 } |