comparison src/event/quic/ngx_event_quic_migration.c @ 8997:fab36e4abf83 quic

QUIC: got rid of hash symbol in backup and logging. Now all objectes with sequence number (i.e. sockets, connection ids and paths) are logged as "foo seq:N".
author Vladimir Homutov <vl@nginx.com>
date Fri, 28 Jan 2022 14:57:33 +0300
parents da24a78720eb
children a2fbae359828
comparison
equal deleted inserted replaced
8996:430755fcdb61 8997:fab36e4abf83
158 if (ngx_quic_send_new_token(c, path) != NGX_OK) { 158 if (ngx_quic_send_new_token(c, path) != NGX_OK) {
159 return NGX_ERROR; 159 return NGX_ERROR;
160 } 160 }
161 161
162 ngx_log_error(NGX_LOG_INFO, c->log, 0, 162 ngx_log_error(NGX_LOG_INFO, c->log, 0,
163 "quic path #%uL addr:%V successfully validated", 163 "quic path seq:%uL addr:%V successfully validated",
164 path->seqnum, &path->addr_text); 164 path->seqnum, &path->addr_text);
165 165
166 ngx_quic_path_dbg(c, "is validated", path); 166 ngx_quic_path_dbg(c, "is validated", path);
167 167
168 path->validated = 1; 168 path->validated = 1;
216 path->addr_text.data = path->text; 216 path->addr_text.data = path->text;
217 path->addr_text.len = ngx_sock_ntop(sockaddr, socklen, path->text, 217 path->addr_text.len = ngx_sock_ntop(sockaddr, socklen, path->text,
218 NGX_SOCKADDR_STRLEN, 1); 218 NGX_SOCKADDR_STRLEN, 1);
219 219
220 ngx_log_debug2(NGX_LOG_DEBUG_EVENT, c->log, 0, 220 ngx_log_debug2(NGX_LOG_DEBUG_EVENT, c->log, 0,
221 "quic path #%uL created addr:%V", 221 "quic path seq:%uL created addr:%V",
222 path->seqnum, &path->addr_text); 222 path->seqnum, &path->addr_text);
223 return path; 223 return path;
224 } 224 }
225 225
226 226
344 * should we account garbage as received or only decrypting packets? 344 * should we account garbage as received or only decrypting packets?
345 */ 345 */
346 path->received += len; 346 path->received += len;
347 347
348 ngx_log_debug3(NGX_LOG_DEBUG_EVENT, c->log, 0, 348 ngx_log_debug3(NGX_LOG_DEBUG_EVENT, c->log, 0,
349 "quic packet len:%O via sock#%L path#%uL", 349 "quic packet len:%O via sock seq:%L path seq:%uL",
350 len, (int64_t) qsock->sid.seqnum, path->seqnum); 350 len, (int64_t) qsock->sid.seqnum, path->seqnum);
351 ngx_quic_path_dbg(c, "status", path); 351 ngx_quic_path_dbg(c, "status", path);
352 352
353 return NGX_OK; 353 return NGX_OK;
354 } 354 }
373 return NGX_ERROR; 373 return NGX_ERROR;
374 } 374 }
375 } 375 }
376 376
377 ngx_log_debug2(NGX_LOG_DEBUG_EVENT, c->log, 0, 377 ngx_log_debug2(NGX_LOG_DEBUG_EVENT, c->log, 0,
378 "quic path #%uL addr:%V retired", 378 "quic path seq:%uL addr:%V retired",
379 path->seqnum, &path->addr_text); 379 path->seqnum, &path->addr_text);
380 380
381 return NGX_OK; 381 return NGX_OK;
382 } 382 }
383 383
396 ngx_memcpy(c->addr_text.data, path->addr_text.data, len); 396 ngx_memcpy(c->addr_text.data, path->addr_text.data, len);
397 c->addr_text.len = len; 397 c->addr_text.len = len;
398 } 398 }
399 399
400 ngx_log_debug2(NGX_LOG_DEBUG_EVENT, c->log, 0, 400 ngx_log_debug2(NGX_LOG_DEBUG_EVENT, c->log, 0,
401 "quic send path set to #%uL addr:%V", 401 "quic send path set to seq:%uL addr:%V",
402 path->seqnum, &path->addr_text); 402 path->seqnum, &path->addr_text);
403 } 403 }
404 404
405 405
406 ngx_int_t 406 ngx_int_t
473 return NGX_ERROR; 473 return NGX_ERROR;
474 } 474 }
475 } 475 }
476 476
477 ngx_log_error(NGX_LOG_INFO, c->log, 0, 477 ngx_log_error(NGX_LOG_INFO, c->log, 0,
478 "quic migrated to path#%uL addr:%V", 478 "quic migrated to path seq:%uL addr:%V",
479 qc->path->seqnum, &qc->path->addr_text); 479 qc->path->seqnum, &qc->path->addr_text);
480 480
481 ngx_quic_path_dbg(c, "is now active", qc->path); 481 ngx_quic_path_dbg(c, "is now active", qc->path);
482 482
483 return NGX_OK; 483 return NGX_OK;
492 ngx_quic_connection_t *qc; 492 ngx_quic_connection_t *qc;
493 493
494 qc = ngx_quic_get_connection(c); 494 qc = ngx_quic_get_connection(c);
495 495
496 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, c->log, 0, 496 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, c->log, 0,
497 "quic initiated validation of path #%uL", path->seqnum); 497 "quic initiated validation of path seq:%uL", path->seqnum);
498 498
499 path->validating = 1; 499 path->validating = 1;
500 500
501 if (RAND_bytes(path->challenge1, 8) != 1) { 501 if (RAND_bytes(path->challenge1, 8) != 1) {
502 return NGX_ERROR; 502 return NGX_ERROR;
528 ngx_quic_send_path_challenge(ngx_connection_t *c, ngx_quic_path_t *path) 528 ngx_quic_send_path_challenge(ngx_connection_t *c, ngx_quic_path_t *path)
529 { 529 {
530 ngx_quic_frame_t frame; 530 ngx_quic_frame_t frame;
531 531
532 ngx_log_debug2(NGX_LOG_DEBUG_EVENT, c->log, 0, 532 ngx_log_debug2(NGX_LOG_DEBUG_EVENT, c->log, 0,
533 "quic path #%uL send path_challenge tries:%ui", 533 "quic path seq:%uL send path_challenge tries:%ui",
534 path->seqnum, path->tries); 534 path->seqnum, path->tries);
535 535
536 ngx_memzero(&frame, sizeof(ngx_quic_frame_t)); 536 ngx_memzero(&frame, sizeof(ngx_quic_frame_t));
537 537
538 frame.level = ssl_encryption_application; 538 frame.level = ssl_encryption_application;
618 618
619 continue; 619 continue;
620 } 620 }
621 621
622 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, ev->log, 0, 622 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, ev->log, 0,
623 "quic path #%uL validation failed", path->seqnum); 623 "quic path seq:%uL validation failed", path->seqnum);
624 624
625 /* found expired path */ 625 /* found expired path */
626 626
627 path->validated = 0; 627 path->validated = 0;
628 path->validating = 0; 628 path->validating = 0;
652 qc->path->tag = NGX_QUIC_PATH_ACTIVE; 652 qc->path->tag = NGX_QUIC_PATH_ACTIVE;
653 653
654 ngx_quic_set_connection_path(c, qc->path); 654 ngx_quic_set_connection_path(c, qc->path);
655 655
656 ngx_log_error(NGX_LOG_INFO, c->log, 0, 656 ngx_log_error(NGX_LOG_INFO, c->log, 0,
657 "quic path #%uL addr:%V is restored from backup", 657 "quic path seq:%uL addr:%V is restored from backup",
658 qc->path->seqnum, &qc->path->addr_text); 658 qc->path->seqnum, &qc->path->addr_text);
659 659
660 ngx_quic_path_dbg(c, "is active", qc->path); 660 ngx_quic_path_dbg(c, "is active", qc->path);
661 } 661 }
662 662