]> git.kaiwu.me - nginx.git/commit
QUIC: fixed migration during NAT rebinding.
authorVladimir Homutov <vl@nginx.com>
Mon, 29 Nov 2021 08:51:14 +0000 (11:51 +0300)
committerVladimir Homutov <vl@nginx.com>
Mon, 29 Nov 2021 08:51:14 +0000 (11:51 +0300)
commit82b4912a8ebbbff46a70c0186bde0a0e6cfdab2c
tree2fb8332352601e871699f0fc90c577c3f4a2f129
parentb8aa869a6f4ee0fda4ab32d5c002fc10bd738079
QUIC: fixed migration during NAT rebinding.

The RFC 9000 allows a packet from known CID arrive from unknown path:

    These requirements regarding connection ID reuse apply only to the
    sending of packets, as unintentional changes in path without a change
    in connection ID are possible.  For example, after a period of
    network inactivity, NAT rebinding might cause packets to be sent on a
    new path when the client resumes sending.

Before the patch, such packets were rejected with an error in the
ngx_quic_check_migration() function.  Removing the check makes the
separate function excessive - remaining checks are early migration
check and "disable_active_migration" check.  The latter is a transport
parameter sent to client and it should not be used by server.

The server should send "disable_active_migration" "if the endpoint does
not support active connection migration" (18.2). The support status depends
on nginx configuration: to have migration working with multiple workers,
you need bpf helper, available on recent Linux systems.  The patch does
not set "disable_active_migration" automatically and leaves it for the
administrator. By default, active migration is enabled.

RFC 900 says that it is ok to migrate if the peer violates
"disable_active_migration" flag requirements:

   If the peer violates this requirement,

   the endpoint MUST either drop the incoming packets on that path without
   generating a Stateless Reset

   OR

   proceed with path validation and allow the peer to migrate.  Generating a
   Stateless Reset or closing the connection would allow third parties in the
   network to cause connections to close by spoofing or otherwise manipulating
   observed traffic.

So, nginx adheres to the second option and proceeds to path validation.

Note:

The ngtcp2 may be used for testing both active migration and NAT rebinding:

ngtcp2/client --change-local-addr=200ms --delay-stream=500ms <ip> <port> <url>

ngtcp2/client --change-local-addr=200ms --delay-stream=500ms --nat-rebinding \
              <ip> <port> <url>
src/event/quic/ngx_event_quic.c
src/event/quic/ngx_event_quic_migration.c
src/event/quic/ngx_event_quic_migration.h