Skip to content

Commit

Permalink
net-test: packetdrill: fix packet_buffer_to_string() length calculation
Browse files Browse the repository at this point in the history
packet_buffer_to_string() needs to accont for the fact that
packet->ip_bytes does not capture the full length of the packet (in
remote mode there will be layer 2 ethernet headers as well).

Change-Id: If2c95e68071545a27078141b6ba5f98cd2c46fb9
  • Loading branch information
nealcardwell committed Jan 24, 2014
1 parent 0573742 commit 79b8727
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion gtests/net/packetdrill/packet_to_string.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ static void endpoints_to_string(FILE *s, const struct packet *packet)
static void packet_buffer_to_string(FILE *s, struct packet *packet)
{
char *hex = NULL;
hex_dump(packet->buffer, packet->ip_bytes, &hex);
hex_dump(packet->buffer, packet_end(packet) - packet->buffer, &hex);
fputc('\n', s);
fprintf(s, "%s", hex);
free(hex);
Expand Down

0 comments on commit 79b8727

Please sign in to comment.