Skip to content

Commit d2a4f98

Browse files
authored
Merge pull request #1855 from private-octopus/multipath-draft-13
Return Protocol Violation for unexpected multipath frames
2 parents bb1c16b + bfd616a commit d2a4f98

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

picoquic/frames.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5319,7 +5319,7 @@ const uint8_t* picoquic_decode_immediate_ack_frame(const uint8_t* bytes, const u
53195319
/* This code assumes that the frame type is already skipped */
53205320
if (bytes != NULL && bytes < bytes_max){
53215321
if (!cnx->is_ack_frequency_negotiated) {
5322-
picoquic_connection_error(cnx, PICOQUIC_TRANSPORT_FRAME_FORMAT_ERROR,
5322+
picoquic_connection_error(cnx, PICOQUIC_TRANSPORT_PROTOCOL_VIOLATION,
53235323
picoquic_frame_type_immediate_ack);
53245324
bytes = NULL;
53255325
}
@@ -5434,7 +5434,7 @@ const uint8_t* picoquic_decode_path_abandon_frame(const uint8_t* bytes, const ui
54345434

54355435
if (!cnx->is_multipath_enabled) {
54365436
/* Frame is unexpected */
5437-
picoquic_connection_error_ex(cnx, PICOQUIC_TRANSPORT_FRAME_FORMAT_ERROR,
5437+
picoquic_connection_error_ex(cnx, PICOQUIC_TRANSPORT_PROTOCOL_VIOLATION,
54385438
picoquic_frame_type_path_abandon, "multipath not negotiated");
54395439
}
54405440
else if ((bytes = picoquic_parse_path_abandon_frame(bytes, bytes_max, &unique_path_id, &reason)) == NULL) {
@@ -5604,7 +5604,7 @@ const uint8_t* picoquic_decode_path_available_or_backup_frame(const uint8_t* byt
56045604

56055605
if (!cnx->is_multipath_enabled) {
56065606
/* Frame is unexpected */
5607-
picoquic_connection_error_ex(cnx, PICOQUIC_TRANSPORT_FRAME_FORMAT_ERROR,
5607+
picoquic_connection_error_ex(cnx, PICOQUIC_TRANSPORT_PROTOCOL_VIOLATION,
56085608
frame_id64, "multipath not negotiated");
56095609
}
56105610
else if ((bytes = picoquic_parse_path_available_or_backup_frame(bytes, bytes_max, &path_id, &sequence)) == NULL) {
@@ -5715,7 +5715,7 @@ const uint8_t* picoquic_decode_max_path_id_frame(const uint8_t* bytes, const uin
57155715

57165716
if (!cnx->is_multipath_enabled) {
57175717
/* Frame is unexpected */
5718-
picoquic_connection_error_ex(cnx, PICOQUIC_TRANSPORT_FRAME_FORMAT_ERROR,
5718+
picoquic_connection_error_ex(cnx, PICOQUIC_TRANSPORT_PROTOCOL_VIOLATION,
57195719
picoquic_frame_type_max_path_id, "unique path_id not negotiated");
57205720
}
57215721
else if ((bytes = picoquic_parse_max_path_id_frame(bytes, bytes_max, &max_path_id)) == NULL) {
@@ -5831,7 +5831,7 @@ const uint8_t* picoquic_decode_paths_blocked_frame(const uint8_t* bytes, const u
58315831

58325832
if (!cnx->is_multipath_enabled) {
58335833
/* Frame is unexpected */
5834-
picoquic_connection_error_ex(cnx, PICOQUIC_TRANSPORT_FRAME_FORMAT_ERROR,
5834+
picoquic_connection_error_ex(cnx, PICOQUIC_TRANSPORT_PROTOCOL_VIOLATION,
58355835
picoquic_frame_type_paths_blocked, "multipath extension not negotiated");
58365836
}
58375837
else if ((bytes = picoquic_parse_paths_blocked_frame(bytes, bytes_max, &max_path_id)) == NULL) {
@@ -5970,7 +5970,7 @@ const uint8_t* picoquic_decode_path_cid_blocked_frame(const uint8_t* bytes, cons
59705970

59715971
if (!cnx->is_multipath_enabled) {
59725972
/* Frame is unexpected */
5973-
picoquic_connection_error_ex(cnx, PICOQUIC_TRANSPORT_FRAME_FORMAT_ERROR,
5973+
picoquic_connection_error_ex(cnx, PICOQUIC_TRANSPORT_PROTOCOL_VIOLATION,
59745974
picoquic_frame_type_path_cid_blocked, "multipath extension not negotiated");
59755975
}
59765976
else if ((bytes = picoquic_parse_path_cid_blocked_frame(bytes, bytes_max, &unique_path_id, &next_sequence_number)) == NULL) {
@@ -6166,7 +6166,7 @@ const uint8_t* picoquic_decode_observed_address_frame(picoquic_cnx_t* cnx, const
61666166

61676167
if (!cnx->is_address_discovery_receiver) {
61686168
/* Frame is unexpected */
6169-
picoquic_connection_error_ex(cnx, PICOQUIC_TRANSPORT_FRAME_FORMAT_ERROR,
6169+
picoquic_connection_error_ex(cnx, PICOQUIC_TRANSPORT_PROTOCOL_VIOLATION,
61706170
ftype, "address discovery not negotiated as receiver");
61716171
}
61726172
else if ((bytes = picoquic_parse_observed_address_frame(bytes, bytes_max, ftype, &sequence, &addr, &port)) == NULL) {
@@ -6615,7 +6615,7 @@ int picoquic_decode_frames(picoquic_cnx_t* cnx, picoquic_path_t * path_x, const
66156615
break;
66166616
default:
66176617
/* Not implemented yet! */
6618-
picoquic_connection_error(cnx, PICOQUIC_TRANSPORT_FRAME_FORMAT_ERROR, frame_id64);
6618+
picoquic_connection_error(cnx, PICOQUIC_TRANSPORT_PROTOCOL_VIOLATION, frame_id64);
66196619
bytes = NULL;
66206620
break;
66216621
}

picoquictest/skip_frame_test.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -681,7 +681,7 @@ test_skip_frames_t test_frame_error_list[] = {
681681
TEST_SKIP_ITEM_OLD_MPATH("bad_bdp", test_frame_type_bdp_bad, 1, 0, 3, ERR_F, 0, 1),
682682
TEST_SKIP_ITEM_OLD_MPATH("bad_bdp_addr", test_frame_type_bdp_bad_addr, 1, 0, 3, ERR_F, 0, 1),
683683
TEST_SKIP_ITEM_OLD_MPATH("bad_bdp_length", test_frame_type_bdp_bad_length, 1, 0, 3, ERR_F, 1, 1),
684-
TEST_SKIP_ITEM_OLD("bad_frame_id", test_frame_type_bad_frame_id, 1, 0, 3, ERR_F, 1)
684+
TEST_SKIP_ITEM_OLD("bad_frame_id", test_frame_type_bad_frame_id, 1, 0, 3, ERR_P, 1)
685685
};
686686

687687
size_t nb_test_frame_error_list = sizeof(test_frame_error_list) / sizeof(test_skip_frames_t);
@@ -1159,7 +1159,7 @@ int parse_frame_test()
11591159
}
11601160

11611161
t_ret = parse_test_packet(qclient, (struct sockaddr*) & saddr, simulated_time,
1162-
buffer, byte_max, test_frame_error_list[i].epoch, &ack_needed, &err, test_skip_list[i].mpath);
1162+
buffer, byte_max, test_frame_error_list[i].epoch, &ack_needed, &err, test_frame_error_list[i].mpath);
11631163

11641164
if (t_ret == 0) {
11651165
DBG_PRINTF("Parse error frame <%s> does not fails, ret = %d\n", test_frame_error_list[i].name, t_ret);

0 commit comments

Comments
 (0)