Skip to content

Commit 42394ca

Browse files
authored
Merge branch 'kubernetes:main' into k8s-1.30
2 parents 5957cfb + b90dd91 commit 42394ca

File tree

37 files changed

+2168
-3
lines changed

37 files changed

+2168
-3
lines changed

images/custom-error-pages/rootfs/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
ARG GOLANG_VERSION
1616

17-
FROM golang:${GOLANG_VERSION}-alpine3.18 as builder
17+
FROM golang:${GOLANG_VERSION}-alpine3.20 as builder
1818

1919
RUN apk update \
2020
&& apk upgrade && apk add git
@@ -37,4 +37,4 @@ COPY --from=builder /go/src/k8s.io/ingress-nginx/images/custom-error-pages/www /
3737
COPY --from=builder /go/src/k8s.io/ingress-nginx/images/custom-error-pages/etc /etc
3838
USER nonroot:nonroot
3939

40-
CMD ["/nginx-errors"]
40+
CMD ["/nginx-errors"]

images/nginx-1.25/TAG

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v0.0.7
1+
v0.0.8
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
diff --git a/src/os/win32/ngx_event_log.c b/src/os/win32/ngx_event_log.c
2+
index e11ed1e8..dce8eddd 100644
3+
--- a/src/os/win32/ngx_event_log.c
4+
+++ b/src/os/win32/ngx_event_log.c
5+
@@ -8,7 +8,9 @@
6+
#include <ngx_core.h>
7+
8+
9+
-#define NGX_MAX_ERROR_STR 2048
10+
+#ifndef NGX_MAX_ERROR_STR
11+
+#define NGX_MAX_ERROR_STR 4096
12+
+#endif
13+
14+
15+
void ngx_cdecl
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
diff --git a/src/stream/ngx_stream_upstream_round_robin.c b/src/stream/ngx_stream_upstream_round_robin.c
2+
index 526de3a..b531ce1 100644
3+
--- a/src/stream/ngx_stream_upstream_round_robin.c
4+
+++ b/src/stream/ngx_stream_upstream_round_robin.c
5+
@@ -21,10 +21,6 @@ static void ngx_stream_upstream_notify_round_robin_peer(
6+
7+
#if (NGX_STREAM_SSL)
8+
9+
-static ngx_int_t ngx_stream_upstream_set_round_robin_peer_session(
10+
- ngx_peer_connection_t *pc, void *data);
11+
-static void ngx_stream_upstream_save_round_robin_peer_session(
12+
- ngx_peer_connection_t *pc, void *data);
13+
static ngx_int_t ngx_stream_upstream_empty_set_session(
14+
ngx_peer_connection_t *pc, void *data);
15+
static void ngx_stream_upstream_empty_save_session(ngx_peer_connection_t *pc,
16+
@@ -690,7 +686,7 @@ ngx_stream_upstream_notify_round_robin_peer(ngx_peer_connection_t *pc,
17+
18+
#if (NGX_STREAM_SSL)
19+
20+
-static ngx_int_t
21+
+ngx_int_t
22+
ngx_stream_upstream_set_round_robin_peer_session(ngx_peer_connection_t *pc,
23+
void *data)
24+
{
25+
@@ -756,7 +752,7 @@ ngx_stream_upstream_set_round_robin_peer_session(ngx_peer_connection_t *pc,
26+
}
27+
28+
29+
-static void
30+
+void
31+
ngx_stream_upstream_save_round_robin_peer_session(ngx_peer_connection_t *pc,
32+
void *data)
33+
{
34+
diff --git a/src/stream/ngx_stream_upstream_round_robin.h b/src/stream/ngx_stream_upstream_round_robin.h
35+
index 35d9fce..75f3e31 100644
36+
--- a/src/stream/ngx_stream_upstream_round_robin.h
37+
+++ b/src/stream/ngx_stream_upstream_round_robin.h
38+
@@ -142,5 +142,15 @@ ngx_int_t ngx_stream_upstream_get_round_robin_peer(ngx_peer_connection_t *pc,
39+
void ngx_stream_upstream_free_round_robin_peer(ngx_peer_connection_t *pc,
40+
void *data, ngx_uint_t state);
41+
42+
+#if (NGX_STREAM_SSL)
43+
+ngx_int_t ngx_stream_upstream_set_round_robin_peer_session(
44+
+ ngx_peer_connection_t *pc, void *data);
45+
+void ngx_stream_upstream_save_round_robin_peer_session(
46+
+ ngx_peer_connection_t *pc, void *data);
47+
+#endif
48+
+
49+
+
50+
+#define HAVE_NGX_STREAM_BALANCER_EXPORT_PATCH 1
51+
+
52+
53+
#endif /* _NGX_STREAM_UPSTREAM_ROUND_ROBIN_H_INCLUDED_ */
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
diff --git a/src/stream/ngx_stream.h b/src/stream/ngx_stream.h
2+
index 09d2459..de92724 100644
3+
--- a/src/stream/ngx_stream.h
4+
+++ b/src/stream/ngx_stream.h
5+
@@ -303,4 +303,7 @@ typedef ngx_int_t (*ngx_stream_filter_pt)(ngx_stream_session_t *s,
6+
extern ngx_stream_filter_pt ngx_stream_top_filter;
7+
8+
9+
+#define HAS_NGX_STREAM_PROXY_GET_NEXT_UPSTREAM_TRIES_PATCH 1
10+
+
11+
+
12+
#endif /* _NGX_STREAM_H_INCLUDED_ */
13+
diff --git a/src/stream/ngx_stream_proxy_module.c b/src/stream/ngx_stream_proxy_module.c
14+
index 0afde1c..3254ce1 100644
15+
--- a/src/stream/ngx_stream_proxy_module.c
16+
+++ b/src/stream/ngx_stream_proxy_module.c
17+
@@ -2156,3 +2156,14 @@ ngx_stream_proxy_bind(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
18+
19+
return NGX_CONF_OK;
20+
}
21+
+
22+
+
23+
+ngx_uint_t
24+
+ngx_stream_proxy_get_next_upstream_tries(ngx_stream_session_t *s)
25+
+{
26+
+ ngx_stream_proxy_srv_conf_t *pscf;
27+
+
28+
+ pscf = ngx_stream_get_module_srv_conf(s, ngx_stream_proxy_module);
29+
+
30+
+ return pscf->next_upstream_tries;
31+
+}
Lines changed: 178 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,178 @@
1+
diff -u -r -p -Naur nginx-1.25.3/src/stream/ngx_stream.h nginx-1.25.3-patched/src/stream/ngx_stream.h
2+
--- nginx-1.25.3/src/stream/ngx_stream.h 2021-11-04 21:27:55.288708527 +0800
3+
+++ nginx-1.25.3-patched/src/stream/ngx_stream.h 2021-11-04 21:28:50.768035209 +0800
4+
@@ -254,6 +254,15 @@ typedef struct {
5+
} ngx_stream_module_t;
6+
7+
8+
+typedef struct {
9+
+ ngx_msec_t connect_timeout;
10+
+ ngx_msec_t timeout;
11+
+} ngx_stream_proxy_ctx_t;
12+
+
13+
+
14+
+#define NGX_STREAM_HAVE_PROXY_TIMEOUT_FIELDS_PATCH 1
15+
+
16+
+
17+
#define NGX_STREAM_MODULE 0x4d525453 /* "STRM" */
18+
19+
#define NGX_STREAM_MAIN_CONF 0x02000000
20+
@@ -307,6 +316,7 @@ void ngx_stream_finalize_session(ngx_str
21+
extern ngx_module_t ngx_stream_module;
22+
extern ngx_uint_t ngx_stream_max_module;
23+
extern ngx_module_t ngx_stream_core_module;
24+
+extern ngx_module_t ngx_stream_proxy_module;
25+
26+
27+
typedef ngx_int_t (*ngx_stream_filter_pt)(ngx_stream_session_t *s,
28+
diff -u -r -p -Naur nginx-1.25.3/src/stream/ngx_stream_proxy_module.c nginx-1.25.3-patched/src/stream/ngx_stream_proxy_module.c
29+
--- nginx-1.25.3/src/stream/ngx_stream_proxy_module.c 2021-11-04 21:27:55.289708533 +0800
30+
+++ nginx-1.25.3-patched/src/stream/ngx_stream_proxy_module.c 2021-11-04 21:37:03.578936990 +0800
31+
@@ -400,6 +400,7 @@ ngx_stream_proxy_handler(ngx_stream_sess
32+
ngx_stream_proxy_srv_conf_t *pscf;
33+
ngx_stream_upstream_srv_conf_t *uscf, **uscfp;
34+
ngx_stream_upstream_main_conf_t *umcf;
35+
+ ngx_stream_proxy_ctx_t *pctx;
36+
37+
c = s->connection;
38+
39+
@@ -408,6 +409,17 @@ ngx_stream_proxy_handler(ngx_stream_sess
40+
ngx_log_debug0(NGX_LOG_DEBUG_STREAM, c->log, 0,
41+
"proxy connection handler");
42+
43+
+ pctx = ngx_palloc(c->pool, sizeof(ngx_stream_proxy_ctx_t));
44+
+ if (pctx == NULL) {
45+
+ ngx_stream_proxy_finalize(s, NGX_STREAM_INTERNAL_SERVER_ERROR);
46+
+ return;
47+
+ }
48+
+
49+
+ pctx->connect_timeout = pscf->connect_timeout;
50+
+ pctx->timeout = pscf->timeout;
51+
+
52+
+ ngx_stream_set_ctx(s, pctx, ngx_stream_proxy_module);
53+
+
54+
u = ngx_pcalloc(c->pool, sizeof(ngx_stream_upstream_t));
55+
if (u == NULL) {
56+
ngx_stream_proxy_finalize(s, NGX_STREAM_INTERNAL_SERVER_ERROR);
57+
@@ -699,6 +711,7 @@ ngx_stream_proxy_connect(ngx_stream_sess
58+
ngx_connection_t *c, *pc;
59+
ngx_stream_upstream_t *u;
60+
ngx_stream_proxy_srv_conf_t *pscf;
61+
+ ngx_stream_proxy_ctx_t *ctx;
62+
63+
c = s->connection;
64+
65+
@@ -706,6 +719,8 @@ ngx_stream_proxy_connect(ngx_stream_sess
66+
67+
pscf = ngx_stream_get_module_srv_conf(s, ngx_stream_proxy_module);
68+
69+
+ ctx = ngx_stream_get_module_ctx(s, ngx_stream_proxy_module);
70+
+
71+
u = s->upstream;
72+
73+
u->connected = 0;
74+
@@ -774,7 +789,7 @@ ngx_stream_proxy_connect(ngx_stream_sess
75+
pc->read->handler = ngx_stream_proxy_connect_handler;
76+
pc->write->handler = ngx_stream_proxy_connect_handler;
77+
78+
- ngx_add_timer(pc->write, pscf->connect_timeout);
79+
+ ngx_add_timer(pc->write, ctx->connect_timeout);
80+
}
81+
82+
83+
@@ -957,12 +957,14 @@ ngx_stream_proxy_init_upstream(ngx_stream_session_t *s)
84+
static ngx_int_t
85+
ngx_stream_proxy_send_proxy_protocol(ngx_stream_session_t *s)
86+
{
87+
- u_char *p;
88+
- ssize_t n, size;
89+
- ngx_connection_t *c, *pc;
90+
- ngx_stream_upstream_t *u;
91+
- ngx_stream_proxy_srv_conf_t *pscf;
92+
- u_char buf[NGX_PROXY_PROTOCOL_V1_MAX_HEADER];
93+
+ u_char *p;
94+
+ u_char buf[NGX_PROXY_PROTOCOL_V1_MAX_HEADER];
95+
+ ssize_t n, size;
96+
+ ngx_connection_t *c, *pc;
97+
+ ngx_stream_upstream_t *u;
98+
+ ngx_stream_proxy_ctx_t *ctx;
99+
+
100+
+ ctx = ngx_stream_get_module_ctx(s, ngx_stream_proxy_module);
101+
102+
c = s->connection;
103+
104+
@@ -976,9 +993,7 @@ ngx_stream_proxy_send_proxy_protocol(ngx
105+
return NGX_ERROR;
106+
}
107+
108+
- pscf = ngx_stream_get_module_srv_conf(s, ngx_stream_proxy_module);
109+
-
110+
- ngx_add_timer(pc->write, pscf->timeout);
111+
+ ngx_add_timer(pc->write, ctx->timeout);
112+
113+
pc->write->handler = ngx_stream_proxy_connect_handler;
114+
115+
@@ -1053,6 +1068,9 @@ ngx_stream_proxy_ssl_init_connection(ngx
116+
ngx_connection_t *pc;
117+
ngx_stream_upstream_t *u;
118+
ngx_stream_proxy_srv_conf_t *pscf;
119+
+ ngx_stream_proxy_ctx_t *ctx;
120+
+
121+
+ ctx = ngx_stream_get_module_ctx(s, ngx_stream_proxy_module);
122+
123+
u = s->upstream;
124+
125+
@@ -1099,7 +1117,7 @@ ngx_stream_proxy_ssl_init_connection(ngx
126+
if (rc == NGX_AGAIN) {
127+
128+
if (!pc->write->timer_set) {
129+
- ngx_add_timer(pc->write, pscf->connect_timeout);
130+
+ ngx_add_timer(pc->write, ctx->connect_timeout);
131+
}
132+
133+
pc->ssl->handler = ngx_stream_proxy_ssl_handshake;
134+
@@ -1408,6 +1426,7 @@ ngx_stream_proxy_process_connection(ngx_
135+
ngx_stream_session_t *s;
136+
ngx_stream_upstream_t *u;
137+
ngx_stream_proxy_srv_conf_t *pscf;
138+
+ ngx_stream_proxy_ctx_t *ctx;
139+
140+
c = ev->data;
141+
s = c->data;
142+
@@ -1419,6 +1438,8 @@ ngx_stream_proxy_process_connection(ngx_
143+
return;
144+
}
145+
146+
+ ctx = ngx_stream_get_module_ctx(s, ngx_stream_proxy_module);
147+
+
148+
c = s->connection;
149+
pc = u->peer.connection;
150+
151+
@@ -1438,7 +1459,7 @@ ngx_stream_proxy_process_connection(ngx_
152+
}
153+
154+
if (u->connected && !c->read->delayed && !pc->read->delayed) {
155+
- ngx_add_timer(c->write, pscf->timeout);
156+
+ ngx_add_timer(c->write, ctx->timeout);
157+
}
158+
159+
return;
160+
@@ -1600,6 +1621,9 @@ ngx_stream_proxy_process(ngx_stream_sess
161+
ngx_log_handler_pt handler;
162+
ngx_stream_upstream_t *u;
163+
ngx_stream_proxy_srv_conf_t *pscf;
164+
+ ngx_stream_proxy_ctx_t *ctx;
165+
+
166+
+ ctx = ngx_stream_get_module_ctx(s, ngx_stream_proxy_module);
167+
168+
u = s->upstream;
169+
170+
@@ -1807,7 +1831,7 @@ ngx_stream_proxy_process(ngx_stream_sess
171+
}
172+
173+
if (!c->read->delayed && !pc->read->delayed) {
174+
- ngx_add_timer(c->write, pscf->timeout);
175+
+ ngx_add_timer(c->write, ctx->timeout);
176+
177+
} else if (c->write->timer_set) {
178+
ngx_del_timer(c->write);
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
diff --git a/src/stream/ngx_stream_ssl_preread_module.c b/src/stream/ngx_stream_ssl_preread_module.c
2+
index e3d11fd9..3717b5fe 100644
3+
--- a/src/stream/ngx_stream_ssl_preread_module.c
4+
+++ b/src/stream/ngx_stream_ssl_preread_module.c
5+
@@ -159,7 +159,7 @@ ngx_stream_ssl_preread_handler(ngx_stream_session_t *s)
6+
7+
rc = ngx_stream_ssl_preread_parse_record(ctx, p, p + len);
8+
if (rc != NGX_AGAIN) {
9+
- return rc;
10+
+ return rc == NGX_OK ? NGX_DECLINED : rc;
11+
}
12+
13+
p += len;

0 commit comments

Comments
 (0)