comparison src/event/ngx_event_quic_transport.c @ 7996:d2f716e668e8 quic

Fixed format specifiers.
author Sergey Kandaurov <pluknet@nginx.com>
date Mon, 20 Jul 2020 15:19:03 +0300
parents 0d1ad81dd65c
children d0ac4449a07f
comparison
equal deleted inserted replaced
7995:031918df51c0 7996:d2f716e668e8
259 "quic packet is too small to read version"); 259 "quic packet is too small to read version");
260 return NGX_ERROR; 260 return NGX_ERROR;
261 } 261 }
262 262
263 ngx_log_debug2(NGX_LOG_DEBUG_EVENT, pkt->log, 0, 263 ngx_log_debug2(NGX_LOG_DEBUG_EVENT, pkt->log, 0,
264 "quic long packet flags:%xi version:%xD", 264 "quic long packet flags:%xd version:%xD",
265 pkt->flags, pkt->version); 265 pkt->flags, pkt->version);
266 266
267 if (!(pkt->flags & NGX_QUIC_PKT_FIXED_BIT)) { 267 if (!(pkt->flags & NGX_QUIC_PKT_FIXED_BIT)) {
268 ngx_log_error(NGX_LOG_INFO, pkt->log, 0, "quic fixed bit is not set"); 268 ngx_log_error(NGX_LOG_INFO, pkt->log, 0, "quic fixed bit is not set");
269 return NGX_DECLINED; 269 return NGX_DECLINED;
270 } 270 }
271 271
272 if (pkt->version != NGX_QUIC_VERSION) { 272 if (pkt->version != NGX_QUIC_VERSION) {
273 ngx_log_error(NGX_LOG_INFO, pkt->log, 0, 273 ngx_log_error(NGX_LOG_INFO, pkt->log, 0,
274 "quic unsupported version: 0x%xi", pkt->version); 274 "quic unsupported version: 0x%xD", pkt->version);
275 return NGX_ERROR; 275 return NGX_ERROR;
276 } 276 }
277 277
278 p = ngx_quic_read_uint8(p, end, &idlen); 278 p = ngx_quic_read_uint8(p, end, &idlen);
279 if (p == NULL) { 279 if (p == NULL) {
455 ngx_log_error(NGX_LOG_INFO, pkt->log, 0, "quic not a short packet"); 455 ngx_log_error(NGX_LOG_INFO, pkt->log, 0, "quic not a short packet");
456 return NGX_ERROR; 456 return NGX_ERROR;
457 } 457 }
458 458
459 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, pkt->log, 0, 459 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, pkt->log, 0,
460 "quic short packet flags:%xi", pkt->flags); 460 "quic short packet flags:%xd", pkt->flags);
461 461
462 if (!(pkt->flags & NGX_QUIC_PKT_FIXED_BIT)) { 462 if (!(pkt->flags & NGX_QUIC_PKT_FIXED_BIT)) {
463 ngx_log_error(NGX_LOG_INFO, pkt->log, 0, "quic fixed bit is not set"); 463 ngx_log_error(NGX_LOG_INFO, pkt->log, 0, "quic fixed bit is not set");
464 return NGX_DECLINED; 464 return NGX_DECLINED;
465 } 465 }
667 } 667 }
668 668
669 f->u.ack.ranges_end = p; 669 f->u.ack.ranges_end = p;
670 670
671 ngx_log_debug4(NGX_LOG_DEBUG_EVENT, pkt->log, 0, 671 ngx_log_debug4(NGX_LOG_DEBUG_EVENT, pkt->log, 0,
672 "quic frame in ACK largest:%ui delay:%ui" 672 "quic frame in ACK largest:%uL delay:%uL"
673 " count:%ui first:%ui", f->u.ack.largest, 673 " count:%uL first:%uL", f->u.ack.largest,
674 f->u.ack.delay, 674 f->u.ack.delay,
675 f->u.ack.range_count, 675 f->u.ack.range_count,
676 f->u.ack.first_range); 676 f->u.ack.first_range);
677 677
678 if (f->type == NGX_QUIC_FT_ACK_ECN) { 678 if (f->type == NGX_QUIC_FT_ACK_ECN) {
683 { 683 {
684 goto error; 684 goto error;
685 } 685 }
686 686
687 ngx_log_debug3(NGX_LOG_DEBUG_EVENT, pkt->log, 0, 687 ngx_log_debug3(NGX_LOG_DEBUG_EVENT, pkt->log, 0,
688 "quic ACK ECN counters: %ui %ui %ui", 688 "quic ACK ECN counters: %uL %uL %uL",
689 f->u.ack.ect0, f->u.ack.ect1, f->u.ack.ce); 689 f->u.ack.ect0, f->u.ack.ect1, f->u.ack.ce);
690 } 690 }
691 691
692 break; 692 break;
693 693
720 if (p == NULL) { 720 if (p == NULL) {
721 goto error; 721 goto error;
722 } 722 }
723 723
724 ngx_log_debug3(NGX_LOG_DEBUG_EVENT, pkt->log, 0, 724 ngx_log_debug3(NGX_LOG_DEBUG_EVENT, pkt->log, 0,
725 "quic frame in: NCID seq:%ui retire:%ui len:%ui", 725 "quic frame in: NCID seq:%uL retire:%uL len:%ud",
726 f->u.ncid.seqnum, f->u.ncid.retire, f->u.ncid.len); 726 f->u.ncid.seqnum, f->u.ncid.retire, f->u.ncid.len);
727 break; 727 break;
728 728
729 case NGX_QUIC_FT_CONNECTION_CLOSE: 729 case NGX_QUIC_FT_CONNECTION_CLOSE:
730 case NGX_QUIC_FT_CONNECTION_CLOSE_APP: 730 case NGX_QUIC_FT_CONNECTION_CLOSE_APP:
756 756
757 if (f->type == NGX_QUIC_FT_CONNECTION_CLOSE) { 757 if (f->type == NGX_QUIC_FT_CONNECTION_CLOSE) {
758 758
759 ngx_log_debug4(NGX_LOG_DEBUG_EVENT, pkt->log, 0, 759 ngx_log_debug4(NGX_LOG_DEBUG_EVENT, pkt->log, 0,
760 "quic frame in CONNECTION_CLOSE" 760 "quic frame in CONNECTION_CLOSE"
761 " err:%s code:0x%xi type:0x%xi reason:'%V'", 761 " err:%s code:0x%xL type:0x%xL reason:'%V'",
762 ngx_quic_error_text(f->u.close.error_code), 762 ngx_quic_error_text(f->u.close.error_code),
763 f->u.close.error_code, f->u.close.frame_type, 763 f->u.close.error_code, f->u.close.frame_type,
764 &f->u.close.reason); 764 &f->u.close.reason);
765 } else { 765 } else {
766 766
767 ngx_log_debug2(NGX_LOG_DEBUG_EVENT, pkt->log, 0, 767 ngx_log_debug2(NGX_LOG_DEBUG_EVENT, pkt->log, 0,
768 "quic frame in: CONNECTION_CLOSE_APP:" 768 "quic frame in: CONNECTION_CLOSE_APP:"
769 " code:0x%xi reason:'%V'", 769 " code:0x%xL reason:'%V'",
770 f->u.close.error_code, &f->u.close.reason); 770 f->u.close.error_code, &f->u.close.reason);
771 } 771 }
772 772
773 break; 773 break;
774 774
817 if (p == NULL) { 817 if (p == NULL) {
818 goto error; 818 goto error;
819 } 819 }
820 820
821 ngx_log_debug7(NGX_LOG_DEBUG_EVENT, pkt->log, 0, 821 ngx_log_debug7(NGX_LOG_DEBUG_EVENT, pkt->log, 0,
822 "quic frame in: STREAM type:0x%xi id:0x%xi offset:0x%xi " 822 "quic frame in: STREAM type:0x%xi id:0x%xL offset:0x%xL "
823 "len:0x%xi bits off:%d len:%d fin:%d", 823 "len:0x%xL bits off:%d len:%d fin:%d",
824 f->type, f->u.stream.stream_id, f->u.stream.offset, 824 f->type, f->u.stream.stream_id, f->u.stream.offset,
825 f->u.stream.length, f->u.stream.off, f->u.stream.len, 825 f->u.stream.length, f->u.stream.off, f->u.stream.len,
826 f->u.stream.fin); 826 f->u.stream.fin);
827 827
828 #ifdef NGX_QUIC_DEBUG_FRAMES 828 #ifdef NGX_QUIC_DEBUG_FRAMES
837 if (p == NULL) { 837 if (p == NULL) {
838 goto error; 838 goto error;
839 } 839 }
840 840
841 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, pkt->log, 0, 841 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, pkt->log, 0,
842 "quic frame in: MAX_DATA max_data:%ui", 842 "quic frame in: MAX_DATA max_data:%uL",
843 f->u.max_data.max_data); 843 f->u.max_data.max_data);
844 break; 844 break;
845 845
846 case NGX_QUIC_FT_RESET_STREAM: 846 case NGX_QUIC_FT_RESET_STREAM:
847 847
853 goto error; 853 goto error;
854 } 854 }
855 855
856 ngx_log_debug3(NGX_LOG_DEBUG_EVENT, pkt->log, 0, 856 ngx_log_debug3(NGX_LOG_DEBUG_EVENT, pkt->log, 0,
857 "quic frame in: RESET_STREAM" 857 "quic frame in: RESET_STREAM"
858 " id:0x%xi error_code:0x%xi final_size:0x%xi", 858 " id:0x%xL error_code:0x%xL final_size:0x%xL",
859 f->u.reset_stream.id, f->u.reset_stream.error_code, 859 f->u.reset_stream.id, f->u.reset_stream.error_code,
860 f->u.reset_stream.final_size); 860 f->u.reset_stream.final_size);
861 break; 861 break;
862 862
863 case NGX_QUIC_FT_STOP_SENDING: 863 case NGX_QUIC_FT_STOP_SENDING:
871 if (p == NULL) { 871 if (p == NULL) {
872 goto error; 872 goto error;
873 } 873 }
874 874
875 ngx_log_debug2(NGX_LOG_DEBUG_EVENT, pkt->log, 0, 875 ngx_log_debug2(NGX_LOG_DEBUG_EVENT, pkt->log, 0,
876 "quic frame in: STOP_SENDING id:0x%xi error_code:0x%xi", 876 "quic frame in: STOP_SENDING id:0x%xL error_code:0x%xL",
877 f->u.stop_sending.id, f->u.stop_sending.error_code); 877 f->u.stop_sending.id, f->u.stop_sending.error_code);
878 878
879 break; 879 break;
880 880
881 case NGX_QUIC_FT_STREAMS_BLOCKED: 881 case NGX_QUIC_FT_STREAMS_BLOCKED:
888 888
889 f->u.streams_blocked.bidi = 889 f->u.streams_blocked.bidi =
890 (f->type == NGX_QUIC_FT_STREAMS_BLOCKED) ? 1 : 0; 890 (f->type == NGX_QUIC_FT_STREAMS_BLOCKED) ? 1 : 0;
891 891
892 ngx_log_debug2(NGX_LOG_DEBUG_EVENT, pkt->log, 0, 892 ngx_log_debug2(NGX_LOG_DEBUG_EVENT, pkt->log, 0,
893 "quic frame in: STREAMS_BLOCKED limit:%ui bidi:%d", 893 "quic frame in: STREAMS_BLOCKED limit:%uL bidi:%ui",
894 f->u.streams_blocked.limit, 894 f->u.streams_blocked.limit,
895 f->u.streams_blocked.bidi); 895 f->u.streams_blocked.bidi);
896 896
897 break; 897 break;
898 898
913 } 913 }
914 914
915 f->u.max_streams.bidi = (f->type == NGX_QUIC_FT_MAX_STREAMS) ? 1 : 0; 915 f->u.max_streams.bidi = (f->type == NGX_QUIC_FT_MAX_STREAMS) ? 1 : 0;
916 916
917 ngx_log_debug2(NGX_LOG_DEBUG_EVENT, pkt->log, 0, 917 ngx_log_debug2(NGX_LOG_DEBUG_EVENT, pkt->log, 0,
918 "quic frame in: MAX_STREAMS limit:%ui bidi:%d", 918 "quic frame in: MAX_STREAMS limit:%uL bidi:%ui",
919 f->u.max_streams.limit, 919 f->u.max_streams.limit,
920 f->u.max_streams.bidi); 920 f->u.max_streams.bidi);
921 break; 921 break;
922 922
923 case NGX_QUIC_FT_MAX_STREAM_DATA: 923 case NGX_QUIC_FT_MAX_STREAM_DATA:
931 if (p == NULL) { 931 if (p == NULL) {
932 goto error; 932 goto error;
933 } 933 }
934 934
935 ngx_log_debug2(NGX_LOG_DEBUG_EVENT, pkt->log, 0, 935 ngx_log_debug2(NGX_LOG_DEBUG_EVENT, pkt->log, 0,
936 "quic frame in: MAX_STREAM_DATA id:%ui limit:%ui", 936 "quic frame in: MAX_STREAM_DATA id:%uL limit:%uL",
937 f->u.max_stream_data.id, 937 f->u.max_stream_data.id,
938 f->u.max_stream_data.limit); 938 f->u.max_stream_data.limit);
939 break; 939 break;
940 940
941 case NGX_QUIC_FT_DATA_BLOCKED: 941 case NGX_QUIC_FT_DATA_BLOCKED:
944 if (p == NULL) { 944 if (p == NULL) {
945 goto error; 945 goto error;
946 } 946 }
947 947
948 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, pkt->log, 0, 948 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, pkt->log, 0,
949 "quic frame in: DATA_BLOCKED limit:%ui", 949 "quic frame in: DATA_BLOCKED limit:%uL",
950 f->u.data_blocked.limit); 950 f->u.data_blocked.limit);
951 break; 951 break;
952 952
953 case NGX_QUIC_FT_STREAM_DATA_BLOCKED: 953 case NGX_QUIC_FT_STREAM_DATA_BLOCKED:
954 954
962 goto error; 962 goto error;
963 } 963 }
964 964
965 ngx_log_debug2(NGX_LOG_DEBUG_EVENT, pkt->log, 0, 965 ngx_log_debug2(NGX_LOG_DEBUG_EVENT, pkt->log, 0,
966 "quic frame in: STREAM_DATA_BLOCKED" 966 "quic frame in: STREAM_DATA_BLOCKED"
967 " id:%ui limit:%ui", 967 " id:%uL limit:%uL",
968 f->u.stream_data_blocked.id, 968 f->u.stream_data_blocked.id,
969 f->u.stream_data_blocked.limit); 969 f->u.stream_data_blocked.limit);
970 break; 970 break;
971 971
972 case NGX_QUIC_FT_RETIRE_CONNECTION_ID: 972 case NGX_QUIC_FT_RETIRE_CONNECTION_ID:
976 goto error; 976 goto error;
977 } 977 }
978 978
979 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, pkt->log, 0, 979 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, pkt->log, 0,
980 "quic frame in: RETIRE_CONNECTION_ID" 980 "quic frame in: RETIRE_CONNECTION_ID"
981 " sequence_number:%ui", 981 " sequence_number:%uL",
982 f->u.retire_cid.sequence_number); 982 f->u.retire_cid.sequence_number);
983 break; 983 break;
984 984
985 case NGX_QUIC_FT_PATH_CHALLENGE: 985 case NGX_QUIC_FT_PATH_CHALLENGE:
986 986
1098 return NGX_OK; 1098 return NGX_OK;
1099 } 1099 }
1100 1100
1101 ngx_log_error(NGX_LOG_INFO, pkt->log, 0, 1101 ngx_log_error(NGX_LOG_INFO, pkt->log, 0,
1102 "quic frame type 0x%xi is not " 1102 "quic frame type 0x%xi is not "
1103 "allowed in packet with flags 0x%xi", 1103 "allowed in packet with flags 0x%xd",
1104 frame_type, pkt->flags); 1104 frame_type, pkt->flags);
1105 1105
1106 return NGX_DECLINED; 1106 return NGX_DECLINED;
1107 } 1107 }
1108 1108
1128 "quic failed to parse ack frame range"); 1128 "quic failed to parse ack frame range");
1129 return NGX_ERROR; 1129 return NGX_ERROR;
1130 } 1130 }
1131 1131
1132 ngx_log_debug2(NGX_LOG_DEBUG_EVENT, pkt->log, 0, 1132 ngx_log_debug2(NGX_LOG_DEBUG_EVENT, pkt->log, 0,
1133 "quic ACK range: gap %ui range %ui", *gap, *range); 1133 "quic ACK range: gap %uL range %uL", *gap, *range);
1134 1134
1135 return p - start; 1135 return p - start;
1136 } 1136 }
1137 1137
1138 1138
1480 case NGX_QUIC_TP_PREFERRED_ADDRESS: 1480 case NGX_QUIC_TP_PREFERRED_ADDRESS:
1481 case NGX_QUIC_TP_RETRY_SCID: 1481 case NGX_QUIC_TP_RETRY_SCID:
1482 case NGX_QUIC_TP_STATELESS_RESET_TOKEN: 1482 case NGX_QUIC_TP_STATELESS_RESET_TOKEN:
1483 ngx_log_error(NGX_LOG_INFO, log, 0, 1483 ngx_log_error(NGX_LOG_INFO, log, 0,
1484 "quic client sent forbidden transport param" 1484 "quic client sent forbidden transport param"
1485 " id 0x%xi", id); 1485 " id 0x%xL", id);
1486 return NGX_ERROR; 1486 return NGX_ERROR;
1487 } 1487 }
1488 1488
1489 p = ngx_quic_parse_int(p, end, &len); 1489 p = ngx_quic_parse_int(p, end, &len);
1490 if (p == NULL) { 1490 if (p == NULL) {
1491 ngx_log_error(NGX_LOG_INFO, log, 0, 1491 ngx_log_error(NGX_LOG_INFO, log, 0,
1492 "quic failed to parse" 1492 "quic failed to parse"
1493 " transport param id 0x%xi length", id); 1493 " transport param id 0x%xL length", id);
1494 return NGX_ERROR; 1494 return NGX_ERROR;
1495 } 1495 }
1496 1496
1497 rc = ngx_quic_parse_transport_param(p, p + len, id, tp); 1497 rc = ngx_quic_parse_transport_param(p, p + len, id, tp);
1498 1498
1499 if (rc == NGX_ERROR) { 1499 if (rc == NGX_ERROR) {
1500 ngx_log_error(NGX_LOG_INFO, log, 0, 1500 ngx_log_error(NGX_LOG_INFO, log, 0,
1501 "quic failed to parse" 1501 "quic failed to parse"
1502 " transport param id 0x%xi data", id); 1502 " transport param id 0x%xL data", id);
1503 return NGX_ERROR; 1503 return NGX_ERROR;
1504 } 1504 }
1505 1505
1506 if (rc == NGX_DECLINED) { 1506 if (rc == NGX_DECLINED) {
1507 ngx_log_error(NGX_LOG_INFO, log, 0, 1507 ngx_log_error(NGX_LOG_INFO, log, 0,
1508 "quic unknown transport param id 0x%xi,skipped", id); 1508 "quic unknown transport param id 0x%xL, skipped", id);
1509 } 1509 }
1510 1510
1511 p += len; 1511 p += len;
1512 } 1512 }
1513 1513