Fix: cancel path response if path could not be initialized

This commit is contained in:
Dmitri Tikhonov 2020-11-17 11:07:07 -05:00
parent 0098937630
commit 36d0fee2c1

View file

@ -5844,7 +5844,7 @@ init_new_path (struct ietf_full_conn *conn, struct conn_path *path,
}
static void
static int
on_new_or_unconfirmed_path (struct ietf_full_conn *conn,
const struct lsquic_packet_in *packet_in)
{
@ -5871,7 +5871,7 @@ on_new_or_unconfirmed_path (struct ietf_full_conn *conn,
{
ABORT_ERROR("DCID %"CID_FMT" not found on new path",
CID_BITS(&packet_in->pi_dcid));
return;
return -1;
}
dcid_changed = !(cce->cce_flags & CCE_USED);
@ -5883,7 +5883,7 @@ on_new_or_unconfirmed_path (struct ietf_full_conn *conn,
if (0 == init_new_path(conn, path, dcid_changed))
path->cop_flags |= COP_INITIALIZED;
else
return;
return -1;
conn->ifc_send_flags |= SF_SEND_PATH_CHAL << packet_in->pi_path_id;
LSQ_DEBUG("scheduled return path challenge on path %hhu",
@ -5901,6 +5901,7 @@ on_new_or_unconfirmed_path (struct ietf_full_conn *conn,
path->cop_cce_idx = cce - lconn->cn_cces;
cce->cce_flags |= CCE_USED;
LOG_SCIDS(conn);
return 0;
}
@ -6369,7 +6370,15 @@ process_regular_packet (struct ietf_full_conn *conn,
if (saved_path_id == conn->ifc_cur_path_id)
{
if (conn->ifc_cur_path_id != packet_in->pi_path_id)
on_new_or_unconfirmed_path(conn, packet_in);
{
if (0 != on_new_or_unconfirmed_path(conn, packet_in))
{
LSQ_DEBUG("path %hhu invalid, cancel any path response "
"on it", packet_in->pi_path_id);
conn->ifc_send_flags &= ~(SF_SEND_PATH_RESP
<< packet_in->pi_path_id);
}
}
else if (!LSQUIC_CIDS_EQ(CN_SCID(&conn->ifc_conn),
&packet_in->pi_dcid))
{