Release 2.5.1

- [BUGFIX] Fix double-free when emptying a packet number space.
- [BUGFIX] http_server: fix md5sum handler: handle EOF correctly.
- [BUGFIX] Use random values in bits 4 and 5 of the first byte of
  verneg packets (regression introduced in 2.5.0).
- [OPTIMIZATION] Don't compile in expensive attq checks by default.
- [OPTIMIZATION] http_server: compile regexes only once.
This commit is contained in:
Dmitri Tikhonov 2019-11-04 16:44:54 -05:00
parent a0e1aeeee0
commit 1c9cee3ed5
8 changed files with 95 additions and 36 deletions

View file

@ -72,7 +72,7 @@ attq_destroy (struct attq *q)
#define AE_RCHILD(i) (2 * i + 2)
#ifndef NDEBUG
#if LSQUIC_EXTRA_CHECKS && !defined(NDEBUG)
static void
attq_verify (struct attq *q)
{

View file

@ -1846,7 +1846,7 @@ lsquic_ietf_v1_gen_ver_nego_pkt (unsigned char *buf, size_t bufsz,
if (need > bufsz)
return -1;
*buf++ = 0x80 | 0x40 | (rand & 0xF);
*buf++ = 0x80 | 0x40 | rand;
memset(buf, 0, 4);
buf += 4;

View file

@ -561,7 +561,7 @@ lsquic_Q046_gen_ver_nego_pkt (unsigned char *buf, size_t bufsz,
if (need > bufsz)
return -1;
*buf++ = 0x80 | 0x40 | (rand & 0xF);
*buf++ = 0x80 | 0x40 | rand;
memset(buf, 0, 4);
buf += 4;

View file

@ -491,7 +491,7 @@ prq_next_conn (struct pr_queue *prq)
len = gen_verneg(packet_out->po_data, max_bufsz(prq),
/* Flip SCID/DCID here: */ &req->pr_dcid, &req->pr_scid,
prq->prq_enpub->enp_settings.es_versions,
get_rand_nybble(prq));
get_rand_byte(prq));
if (len > 0)
packet_out->po_data_sz = len;
else

View file

@ -2636,14 +2636,45 @@ lsquic_send_ctl_empty_pns (struct lsquic_send_ctl *ctl, enum packnum_space pns)
unsigned count, packet_sz;
struct lsquic_packets_tailq *const *q;
struct lsquic_packets_tailq *const queues[] = {
&ctl->sc_scheduled_packets,
&ctl->sc_unacked_packets[pns],
&ctl->sc_lost_packets,
&ctl->sc_buffered_packets[0].bpq_packets,
&ctl->sc_buffered_packets[1].bpq_packets,
};
/* Don't bother with chain destruction, as all chains members are always
* within the same packet number space
*/
count = 0;
for (packet_out = TAILQ_FIRST(&ctl->sc_scheduled_packets); packet_out;
packet_out = next)
{
next = TAILQ_NEXT(packet_out, po_next);
if (pns == lsquic_packet_out_pns(packet_out))
{
send_ctl_maybe_renumber_sched_to_right(ctl, packet_out);
send_ctl_sched_remove(ctl, packet_out);
send_ctl_destroy_packet(ctl, packet_out);
++count;
}
}
for (packet_out = TAILQ_FIRST(&ctl->sc_unacked_packets[pns]); packet_out;
packet_out = next)
{
next = TAILQ_NEXT(packet_out, po_next);
if (packet_out->po_flags & PO_LOSS_REC)
TAILQ_REMOVE(&ctl->sc_unacked_packets[pns], packet_out, po_next);
else
{
packet_sz = packet_out_sent_sz(packet_out);
send_ctl_unacked_remove(ctl, packet_out, packet_sz);
lsquic_packet_out_ack_streams(packet_out);
}
send_ctl_destroy_packet(ctl, packet_out);
++count;
}
for (q = queues; q < queues + sizeof(queues) / sizeof(queues[0]); ++q)
for (packet_out = TAILQ_FIRST(*q); packet_out; packet_out = next)
{
@ -2651,16 +2682,6 @@ lsquic_send_ctl_empty_pns (struct lsquic_send_ctl *ctl, enum packnum_space pns)
if (pns == lsquic_packet_out_pns(packet_out))
{
TAILQ_REMOVE(*q, packet_out, po_next);
if (*q == &ctl->sc_unacked_packets[pns])
{
if (0 == (packet_out->po_flags & PO_LOSS_REC))
{
packet_sz = packet_out_sent_sz(packet_out);
send_ctl_unacked_remove(ctl, packet_out, packet_sz);
lsquic_packet_out_ack_streams(packet_out);
}
send_ctl_destroy_chain(ctl, packet_out, &next);
}
send_ctl_destroy_packet(ctl, packet_out);
++count;
}