Commit Graph

4 Commits

Author SHA1 Message Date
gVisor bot 0e013d8b00 Don't ignore override if it is longer than layerStates
PiperOrigin-RevId: 307708653
2020-04-21 16:55:28 -07:00
Eyal Soha 3d3bf9603d Use hex.Dump for Layer.String() of byte slices.
PiperOrigin-RevId: 306726587
2020-04-15 14:59:15 -07:00
gVisor bot 21e438d257 Dereference pointers in Layer's Stringer impl
Dereference any fields which are pointers before string formatting so that the
value pointed to ends up in the string representation.

Tested:
  Added TestLayerStringFormat to
  //third_party/gvisor/test/packetimpact/testbench:testbench_test
PiperOrigin-RevId: 305627821
2020-04-08 23:30:09 -07:00
Eyal Soha 7482902364 Implement Stringer for Layer
Tested:
  Sample output for printing 3 different Layer structs:

  &testbench.Ether{SrcAddr:02:42:c4:77:5d:14 DstAddr:02:42:c4:77:5d:0a}
  &testbench.IPv4{SrcAddr:196.119.93.20 DstAddr:224.0.0.1}
  &testbench.UDP{SrcPort:0xc00033b260 DstPort:0xc00033b280}

  Sample output for printing a Layers struct (word-wrapped):
  [&testbench.Ether{SrcAddr:02:42:c4:77:5d:14 DstAddr:02:42:c4:77:5d:0a}
   &testbench.IPv4{SrcAddr:196.119.93.20 DstAddr:224.0.0.1}
   &testbench.UDP{SrcPort:0xc00033b260 DstPort:0xc00033b280}
   &testbench.Payload{Bytes:[104 101 108 108 111 32 119 111 114 108 100]}]

PiperOrigin-RevId: 305014376
2020-04-06 06:25:24 -07:00