Skip to content

Commit

Permalink
Add more packet data logs
Browse files Browse the repository at this point in the history
  • Loading branch information
rom1v committed Jul 1, 2020
1 parent ee562d7 commit 83b8749
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ public IPv4Packet(ByteBuffer raw) {
this.raw = raw;
raw.rewind();

if (Log.isVerboseEnabled()) {
Log.v(TAG, "IPv4Packet: " + Binary.buildPacketString(raw));
}

ipv4Header = new IPv4Header(raw.duplicate());
if (!ipv4Header.isSupported()) {
Log.d(TAG, "Unsupported IPv4 headers");
Expand Down
4 changes: 4 additions & 0 deletions relay-rust/src/relay/ipv4_packet_buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,12 @@
* limitations under the License.
*/

use super::binary;
use super::byte_buffer::ByteBuffer;
use super::ipv4_header;
use super::ipv4_packet::{Ipv4Packet, MAX_PACKET_LENGTH};

use log::*;
use std::io;

pub struct Ipv4PacketBuffer {
Expand All @@ -36,6 +39,7 @@ impl Ipv4PacketBuffer {

fn available_packet_length(&self) -> Option<u16> {
let data = self.buf.peek();
trace!("Parse packet: {}", binary::build_packet_string(data));
if let Some((version, length)) = ipv4_header::peek_version_length(data) {
assert!(version == 4, "Not an Ipv4 packet, version={}", version);
if length as usize <= data.len() {
Expand Down

0 comments on commit 83b8749

Please sign in to comment.