| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "net/quic/core/quic_framer.h" | 5 #include "net/quic/core/quic_framer.h" |
| 6 | 6 |
| 7 #include <cstdint> | 7 #include <cstdint> |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 766 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 777 return false; | 777 return false; |
| 778 } | 778 } |
| 779 | 779 |
| 780 public_header->multipath_flag = | 780 public_header->multipath_flag = |
| 781 (public_flags & PACKET_PUBLIC_FLAGS_MULTIPATH) != 0; | 781 (public_flags & PACKET_PUBLIC_FLAGS_MULTIPATH) != 0; |
| 782 public_header->reset_flag = (public_flags & PACKET_PUBLIC_FLAGS_RST) != 0; | 782 public_header->reset_flag = (public_flags & PACKET_PUBLIC_FLAGS_RST) != 0; |
| 783 public_header->version_flag = | 783 public_header->version_flag = |
| 784 (public_flags & PACKET_PUBLIC_FLAGS_VERSION) != 0; | 784 (public_flags & PACKET_PUBLIC_FLAGS_VERSION) != 0; |
| 785 | 785 |
| 786 if (validate_flags_ && !public_header->version_flag && | 786 if (validate_flags_ && !public_header->version_flag && |
| 787 public_flags > PACKET_PUBLIC_FLAGS_MAX) { | 787 public_flags > (FLAGS_quic_reloadable_flag_quic_remove_multipath_bit |
| 788 ? PACKET_PUBLIC_FLAGS_MAX_WITHOUT_MULTIPATH_FLAG |
| 789 : PACKET_PUBLIC_FLAGS_MAX)) { |
| 788 set_detailed_error("Illegal public flags value."); | 790 set_detailed_error("Illegal public flags value."); |
| 789 return false; | 791 return false; |
| 790 } | 792 } |
| 791 | 793 |
| 792 if (public_header->reset_flag && public_header->version_flag) { | 794 if (public_header->reset_flag && public_header->version_flag) { |
| 793 set_detailed_error("Got version flag in reset packet"); | 795 set_detailed_error("Got version flag in reset packet"); |
| 794 return false; | 796 return false; |
| 795 } | 797 } |
| 796 | 798 |
| 797 switch (public_flags & PACKET_PUBLIC_FLAGS_8BYTE_CONNECTION_ID) { | 799 switch (public_flags & PACKET_PUBLIC_FLAGS_8BYTE_CONNECTION_ID) { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 818 if (!reader->ReadUInt32(&version_tag)) { | 820 if (!reader->ReadUInt32(&version_tag)) { |
| 819 set_detailed_error("Unable to read protocol version."); | 821 set_detailed_error("Unable to read protocol version."); |
| 820 return false; | 822 return false; |
| 821 } | 823 } |
| 822 | 824 |
| 823 // If the version from the new packet is the same as the version of this | 825 // If the version from the new packet is the same as the version of this |
| 824 // framer, then the public flags should be set to something we understand. | 826 // framer, then the public flags should be set to something we understand. |
| 825 // If not, this raises an error. | 827 // If not, this raises an error. |
| 826 last_version_tag_ = version_tag; | 828 last_version_tag_ = version_tag; |
| 827 QuicVersion version = QuicTagToQuicVersion(version_tag); | 829 QuicVersion version = QuicTagToQuicVersion(version_tag); |
| 828 if (version == quic_version_ && public_flags > PACKET_PUBLIC_FLAGS_MAX) { | 830 if (version == quic_version_ && |
| 831 public_flags > (FLAGS_quic_reloadable_flag_quic_remove_multipath_bit |
| 832 ? PACKET_PUBLIC_FLAGS_MAX_WITHOUT_MULTIPATH_FLAG |
| 833 : PACKET_PUBLIC_FLAGS_MAX)) { |
| 829 set_detailed_error("Illegal public flags value."); | 834 set_detailed_error("Illegal public flags value."); |
| 830 return false; | 835 return false; |
| 831 } | 836 } |
| 832 public_header->versions.push_back(version); | 837 public_header->versions.push_back(version); |
| 833 } | 838 } |
| 834 | 839 |
| 835 // A nonce should only be present in packets from the server to the client, | 840 // A nonce should only be present in packets from the server to the client, |
| 836 // which are neither version negotiation nor public reset packets. | 841 // which are neither version negotiation nor public reset packets. |
| 837 if (public_flags & PACKET_PUBLIC_FLAGS_NONCE && | 842 if (public_flags & PACKET_PUBLIC_FLAGS_NONCE && |
| 838 !(public_flags & PACKET_PUBLIC_FLAGS_VERSION) && | 843 !(public_flags & PACKET_PUBLIC_FLAGS_VERSION) && |
| (...skipping 1306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2145 | 2150 |
| 2146 bool QuicFramer::RaiseError(QuicErrorCode error) { | 2151 bool QuicFramer::RaiseError(QuicErrorCode error) { |
| 2147 QUIC_DLOG(INFO) << ENDPOINT << "Error: " << QuicErrorCodeToString(error) | 2152 QUIC_DLOG(INFO) << ENDPOINT << "Error: " << QuicErrorCodeToString(error) |
| 2148 << " detail: " << detailed_error_; | 2153 << " detail: " << detailed_error_; |
| 2149 set_error(error); | 2154 set_error(error); |
| 2150 visitor_->OnError(this); | 2155 visitor_->OnError(this); |
| 2151 return false; | 2156 return false; |
| 2152 } | 2157 } |
| 2153 | 2158 |
| 2154 } // namespace net | 2159 } // namespace net |
| OLD | NEW |