mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2024-12-27 23:22:09 +00:00
MINOR: quic: Flag asap the connection having reached the anti-amplification limit
The best location to flag the connection is just after having built the packet which reached the anti-amplication limit.
This commit is contained in:
parent
de6f7c503e
commit
41a076087b
@ -2484,8 +2484,6 @@ static int qc_prep_pkts(struct quic_conn *qc, struct qring *qr,
|
||||
/* Leave room for the datagram header */
|
||||
pos += dg_headlen;
|
||||
if (!quic_peer_validated_addr(qc) && objt_listener(qc->conn->target)) {
|
||||
if (qc->tx.prep_bytes >= 3 * qc->rx.bytes)
|
||||
qc->flags |= QUIC_FL_CONN_ANTI_AMPLIFICATION_REACHED;
|
||||
end = pos + QUIC_MIN(qc->path->mtu, 3 * qc->rx.bytes - qc->tx.prep_bytes);
|
||||
}
|
||||
else {
|
||||
@ -4869,6 +4867,8 @@ static struct quic_tx_packet *qc_build_pkt(unsigned char **pos,
|
||||
/* Consume a packet number */
|
||||
qel->pktns->tx.next_pn++;
|
||||
qc->tx.prep_bytes += pkt->len;
|
||||
if (qc->tx.prep_bytes >= 3 * qc->rx.bytes)
|
||||
HA_ATOMIC_OR(&qc->flags, QUIC_FL_CONN_ANTI_AMPLIFICATION_REACHED);
|
||||
/* Now that a correct packet is built, let us consume <*pos> buffer. */
|
||||
*pos = end;
|
||||
/* Attach the built packet to its tree. */
|
||||
|
Loading…
Reference in New Issue
Block a user