comparison src/event/ngx_event_quic.c @ 8580:07971f870879 quic

QUIC: added debug message with final packet processing status.
author Vladimir Homutov <vl@nginx.com>
date Fri, 02 Oct 2020 16:20:41 +0300
parents d57cfdebe301
children ec04dbb77fb7
comparison
equal deleted inserted replaced
8579:d57cfdebe301 8580:07971f870879
43 */ 43 */
44 #define NGX_QUIC_MIN_PKT_LEN 21 44 #define NGX_QUIC_MIN_PKT_LEN 21
45 45
46 #define NGX_QUIC_MIN_SR_PACKET 43 /* 5 random + 16 srt + 22 padding */ 46 #define NGX_QUIC_MIN_SR_PACKET 43 /* 5 random + 16 srt + 22 padding */
47 #define NGX_QUIC_MAX_SR_PACKET 1200 47 #define NGX_QUIC_MAX_SR_PACKET 1200
48
49 #define ngx_quic_level_name(lvl) \
50 (lvl == ssl_encryption_application) ? "application" \
51 : (lvl == ssl_encryption_initial) ? "initial" \
52 : (lvl == ssl_encryption_handshake) ? "handshake" : "early_data"
48 53
49 54
50 typedef struct { 55 typedef struct {
51 ngx_rbtree_t tree; 56 ngx_rbtree_t tree;
52 ngx_rbtree_node_t sentinel; 57 ngx_rbtree_node_t sentinel;
1623 pkt.flags = p[0]; 1628 pkt.flags = p[0];
1624 pkt.raw->pos++; 1629 pkt.raw->pos++;
1625 1630
1626 rc = ngx_quic_process_packet(c, conf, &pkt); 1631 rc = ngx_quic_process_packet(c, conf, &pkt);
1627 1632
1633 #if (NGX_DEBUG)
1634 if (pkt.parsed) {
1635 ngx_quic_connection_t *qc;
1636
1637 qc = c->quic;
1638
1639 ngx_log_debug8(NGX_LOG_DEBUG_EVENT, c->log, 0,
1640 "quic pkt done %s decr:%d pn:%L pe:%ui rc:%i"
1641 " closing:%d err:%d %s",
1642 ngx_quic_level_name(pkt.level), pkt.decrypted,
1643 pkt.pn, pkt.error, rc, (qc && qc->closing) ? 1 : 0,
1644 qc ? qc->error : 0,
1645 (qc && qc->error_reason) ? qc->error_reason : "");
1646 } else {
1647 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, c->log, 0,
1648 "quic pkt done parse failed rc:%i", rc);
1649 }
1650 #endif
1651
1628 if (rc == NGX_ERROR) { 1652 if (rc == NGX_ERROR) {
1629 return NGX_ERROR; 1653 return NGX_ERROR;
1630 } 1654 }
1631 1655
1632 if (rc == NGX_OK) { 1656 if (rc == NGX_OK) {
1685 1709
1686 if (rc == NGX_DECLINED || rc == NGX_ERROR) { 1710 if (rc == NGX_DECLINED || rc == NGX_ERROR) {
1687 return rc; 1711 return rc;
1688 } 1712 }
1689 1713
1714 pkt->parsed = 1;
1715
1690 c->log->action = "processing quic packet"; 1716 c->log->action = "processing quic packet";
1691 1717
1692 qc = c->quic; 1718 qc = c->quic;
1693 1719
1694 #if (NGX_DEBUG) 1720 #if (NGX_DEBUG)
1835 if (rc != NGX_OK) { 1861 if (rc != NGX_OK) {
1836 qc->error = pkt->error; 1862 qc->error = pkt->error;
1837 qc->error_reason = "failed to decrypt packet"; 1863 qc->error_reason = "failed to decrypt packet";
1838 return rc; 1864 return rc;
1839 } 1865 }
1866
1867 pkt->decrypted = 1;
1840 1868
1841 if (c->ssl == NULL) { 1869 if (c->ssl == NULL) {
1842 if (ngx_quic_init_connection(c) != NGX_OK) { 1870 if (ngx_quic_init_connection(c) != NGX_OK) {
1843 return NGX_ERROR; 1871 return NGX_ERROR;
1844 } 1872 }