comparison src/event/ngx_event_quic.c @ 8135:eacca87c476e quic

QUIC: updated c->log->action strings to reflect proper state.
author Vladimir Homutov <vl@nginx.com>
date Wed, 07 Oct 2020 13:38:17 +0300
parents 2b11bd029815
children b38b41127489
comparison
equal deleted inserted replaced
8134:2b11bd029815 8135:eacca87c476e
641 { 641 {
642 ngx_int_t rc; 642 ngx_int_t rc;
643 643
644 ngx_log_debug0(NGX_LOG_DEBUG_EVENT, c->log, 0, "quic run"); 644 ngx_log_debug0(NGX_LOG_DEBUG_EVENT, c->log, 0, "quic run");
645 645
646 c->log->action = "QUIC initialization";
647
648 rc = ngx_quic_input(c, c->buffer, conf); 646 rc = ngx_quic_input(c, c->buffer, conf);
649 if (rc != NGX_OK) { 647 if (rc != NGX_OK) {
650 ngx_quic_close_connection(c, rc == NGX_DECLINED ? NGX_DONE : NGX_ERROR); 648 ngx_quic_close_connection(c, rc == NGX_DECLINED ? NGX_DONE : NGX_ERROR);
651 return; 649 return;
652 } 650 }
666 { 664 {
667 ngx_uint_t i; 665 ngx_uint_t i;
668 ngx_quic_tp_t *ctp; 666 ngx_quic_tp_t *ctp;
669 ngx_quic_client_id_t *cid; 667 ngx_quic_client_id_t *cid;
670 ngx_quic_connection_t *qc; 668 ngx_quic_connection_t *qc;
671
672 c->log->action = "creating new quic connection";
673 669
674 qc = ngx_pcalloc(c->pool, sizeof(ngx_quic_connection_t)); 670 qc = ngx_pcalloc(c->pool, sizeof(ngx_quic_connection_t));
675 if (qc == NULL) { 671 if (qc == NULL) {
676 return NULL; 672 return NULL;
677 } 673 }
1298 ngx_buf_t b; 1294 ngx_buf_t b;
1299 ngx_connection_t *c; 1295 ngx_connection_t *c;
1300 ngx_quic_connection_t *qc; 1296 ngx_quic_connection_t *qc;
1301 static u_char buf[NGX_QUIC_MAX_UDP_PAYLOAD_SIZE]; 1297 static u_char buf[NGX_QUIC_MAX_UDP_PAYLOAD_SIZE];
1302 1298
1299 ngx_log_debug0(NGX_LOG_DEBUG_EVENT, rev->log, 0, "quic input handler");
1300
1303 ngx_memzero(&b, sizeof(ngx_buf_t)); 1301 ngx_memzero(&b, sizeof(ngx_buf_t));
1304 b.start = buf; 1302 b.start = buf;
1305 b.end = buf + sizeof(buf); 1303 b.end = buf + sizeof(buf);
1306 b.pos = b.last = b.start; 1304 b.pos = b.last = b.start;
1307 b.memory = 1; 1305 b.memory = 1;
1308 1306
1309 c = rev->data; 1307 c = rev->data;
1310 qc = c->quic; 1308 qc = c->quic;
1311 1309
1312 ngx_log_debug0(NGX_LOG_DEBUG_EVENT, rev->log, 0, "quic input handler"); 1310 c->log->action = "handling quic input";
1313 1311
1314 if (rev->timedout) { 1312 if (rev->timedout) {
1315 ngx_log_error(NGX_LOG_INFO, c->log, NGX_ETIMEDOUT, 1313 ngx_log_error(NGX_LOG_INFO, c->log, NGX_ETIMEDOUT,
1316 "quic client timed out"); 1314 "quic client timed out");
1317 ngx_quic_close_connection(c, NGX_DONE); 1315 ngx_quic_close_connection(c, NGX_DONE);
1616 good = 0; 1614 good = 0;
1617 1615
1618 p = b->pos; 1616 p = b->pos;
1619 1617
1620 while (p < b->last) { 1618 while (p < b->last) {
1621 c->log->action = "processing quic packet";
1622 1619
1623 ngx_memzero(&pkt, sizeof(ngx_quic_header_t)); 1620 ngx_memzero(&pkt, sizeof(ngx_quic_header_t));
1624 pkt.raw = b; 1621 pkt.raw = b;
1625 pkt.data = p; 1622 pkt.data = p;
1626 pkt.len = b->last - p; 1623 pkt.len = b->last - p;
1682 ngx_quic_send_ctx_t *ctx; 1679 ngx_quic_send_ctx_t *ctx;
1683 ngx_quic_connection_t *qc; 1680 ngx_quic_connection_t *qc;
1684 1681
1685 static u_char buf[NGX_QUIC_MAX_UDP_PAYLOAD_SIZE]; 1682 static u_char buf[NGX_QUIC_MAX_UDP_PAYLOAD_SIZE];
1686 1683
1684 c->log->action = "parsing quic packet";
1685
1687 rc = ngx_quic_parse_packet(pkt); 1686 rc = ngx_quic_parse_packet(pkt);
1688 1687
1689 if (rc == NGX_DECLINED || rc == NGX_ERROR) { 1688 if (rc == NGX_DECLINED || rc == NGX_ERROR) {
1690 return rc; 1689 return rc;
1691 } 1690 }
1691
1692 c->log->action = "processing quic packet";
1692 1693
1693 qc = c->quic; 1694 qc = c->quic;
1694 1695
1695 if (qc) { 1696 if (qc) {
1696 1697
1756 if (rc == NGX_ABORT) { 1757 if (rc == NGX_ABORT) {
1757 return ngx_quic_negotiate_version(c, pkt); 1758 return ngx_quic_negotiate_version(c, pkt);
1758 } 1759 }
1759 1760
1760 if (pkt->level == ssl_encryption_initial) { 1761 if (pkt->level == ssl_encryption_initial) {
1762
1763 c->log->action = "creating quic connection";
1761 1764
1762 if (pkt->dcid.len < NGX_QUIC_CID_LEN_MIN) { 1765 if (pkt->dcid.len < NGX_QUIC_CID_LEN_MIN) {
1763 /* 7.2. Negotiating Connection IDs */ 1766 /* 7.2. Negotiating Connection IDs */
1764 ngx_log_error(NGX_LOG_INFO, c->log, 0, 1767 ngx_log_error(NGX_LOG_INFO, c->log, 0,
1765 "quic too short dcid in initial" 1768 "quic too short dcid in initial"
1798 } else { 1801 } else {
1799 return NGX_ERROR; 1802 return NGX_ERROR;
1800 } 1803 }
1801 } 1804 }
1802 1805
1806 c->log->action = "decrypting packet";
1807
1803 keys = &qc->keys[pkt->level]; 1808 keys = &qc->keys[pkt->level];
1804 1809
1805 if (keys->client.key.len == 0) { 1810 if (keys->client.key.len == 0) {
1806 ngx_log_error(NGX_LOG_INFO, c->log, 0, 1811 ngx_log_error(NGX_LOG_INFO, c->log, 0,
1807 "quic no level %d keys yet, ignoring packet", pkt->level); 1812 "quic no level %d keys yet, ignoring packet", pkt->level);
1844 if (pkt->level == ssl_encryption_early_data 1849 if (pkt->level == ssl_encryption_early_data
1845 || pkt->level == ssl_encryption_application) 1850 || pkt->level == ssl_encryption_application)
1846 { 1851 {
1847 ngx_gettimeofday(&pkt->received); 1852 ngx_gettimeofday(&pkt->received);
1848 } 1853 }
1854
1855 c->log->action = "handling payload";
1849 1856
1850 if (pkt->level != ssl_encryption_application) { 1857 if (pkt->level != ssl_encryption_application) {
1851 return ngx_quic_payload_handler(c, pkt); 1858 return ngx_quic_payload_handler(c, pkt);
1852 } 1859 }
1853 1860