Client only sends PATH_RESPONSE to the current path
@@ -4936,6 +4936,14 @@ static void conn_recv_path_challenge(ngtcp2_conn *conn, const ngtcp2_path *path,
ngtcp2_path_challenge *fr) {
ngtcp2_path_challenge_entry *ent;
+ /* client only responds to PATH_CHALLENGE from the current path. */
+ if (!conn->server && !ngtcp2_path_eq(&conn->dcid.current.ps.path, path)) {
+ ngtcp2_log_info(
+ &conn->log, NGTCP2_LOG_EVENT_CON,
+ "discard PATH_CHALLENGE from the path which is not current");
+ return;
+ }
+
ent = ngtcp2_ringbuf_push_front(&conn->rx.path_challenge);
ngtcp2_path_challenge_entry_init(ent, path, fr->data);
}
