[PATCH 1 of 6] QUIC: ignore server address while looking up a connection
Roman Arutyunyan
arut at nginx.com
Fri Dec 9 09:38:47 UTC 2022
# HG changeset patch
# User Roman Arutyunyan <arut at nginx.com>
# Date 1670322119 0
# Tue Dec 06 10:21:59 2022 +0000
# Branch quic
# Node ID 1038d7300c29eea02b47eac3f205e293b1e55f5b
# Parent b87a0dbc1150f415def5bc1e1f00d02b33519026
QUIC: ignore server address while looking up a connection.
The server connection check was copied from the common UDP code in c2f5d79cde64.
In QUIC it does not make much sense though. Technically client is not allowed
to migrate to a different server address. However, migrating withing a single
wildcard listening does not seem to affect anything.
diff --git a/src/event/quic/ngx_event_quic_udp.c b/src/event/quic/ngx_event_quic_udp.c
--- a/src/event/quic/ngx_event_quic_udp.c
+++ b/src/event/quic/ngx_event_quic_udp.c
@@ -13,7 +13,7 @@
static void ngx_quic_close_accepted_connection(ngx_connection_t *c);
static ngx_connection_t *ngx_quic_lookup_connection(ngx_listening_t *ls,
- ngx_str_t *key, struct sockaddr *local_sockaddr, socklen_t local_socklen);
+ ngx_str_t *key);
void
@@ -156,7 +156,7 @@ ngx_quic_recvmsg(ngx_event_t *ev)
goto next;
}
- c = ngx_quic_lookup_connection(ls, &key, local_sockaddr, local_socklen);
+ c = ngx_quic_lookup_connection(ls, &key);
if (c) {
@@ -370,7 +370,6 @@ ngx_quic_rbtree_insert_value(ngx_rbtree_
ngx_rbtree_node_t *node, ngx_rbtree_node_t *sentinel)
{
ngx_int_t rc;
- ngx_connection_t *c, *ct;
ngx_rbtree_node_t **p;
ngx_quic_socket_t *qsock, *qsockt;
@@ -387,19 +386,11 @@ ngx_quic_rbtree_insert_value(ngx_rbtree_
} else { /* node->key == temp->key */
qsock = (ngx_quic_socket_t *) node;
- c = qsock->udp.connection;
-
qsockt = (ngx_quic_socket_t *) temp;
- ct = qsockt->udp.connection;
rc = ngx_memn2cmp(qsock->sid.id, qsockt->sid.id,
qsock->sid.len, qsockt->sid.len);
- if (rc == 0 && c->listening->wildcard) {
- rc = ngx_cmp_sockaddr(c->local_sockaddr, c->local_socklen,
- ct->local_sockaddr, ct->local_socklen, 1);
- }
-
p = (rc < 0) ? &temp->left : &temp->right;
}
@@ -419,8 +410,7 @@ ngx_quic_rbtree_insert_value(ngx_rbtree_
static ngx_connection_t *
-ngx_quic_lookup_connection(ngx_listening_t *ls, ngx_str_t *key,
- struct sockaddr *local_sockaddr, socklen_t local_socklen)
+ngx_quic_lookup_connection(ngx_listening_t *ls, ngx_str_t *key)
{
uint32_t hash;
ngx_int_t rc;
@@ -454,14 +444,8 @@ ngx_quic_lookup_connection(ngx_listening
rc = ngx_memn2cmp(key->data, qsock->sid.id, key->len, qsock->sid.len);
- c = qsock->udp.connection;
-
- if (rc == 0 && ls->wildcard) {
- rc = ngx_cmp_sockaddr(local_sockaddr, local_socklen,
- c->local_sockaddr, c->local_socklen, 1);
- }
-
if (rc == 0) {
+ c = qsock->udp.connection;
c->udp = &qsock->udp;
return c;
}
More information about the nginx-devel
mailing list