(t *testing.T)
| 1016 | } |
| 1017 | |
| 1018 | func TestDecodeUDPPacketTooSmall(t *testing.T) { |
| 1019 | data := []byte{ |
| 1020 | 0x00, 0x15, 0x2c, 0x9d, 0xcc, 0x00, 0x00, 0x10, 0xdb, 0xff, 0x10, 0x00, 0x81, 0x00, 0x01, 0xf7, |
| 1021 | 0x08, 0x00, 0x45, 0x60, 0x00, 0x3c, 0x0f, 0xa9, 0x00, 0x00, 0x6e, 0x11, 0x01, 0x0a, 0x47, 0xe6, |
| 1022 | 0xee, 0x2e, 0xac, 0x16, 0x59, 0x73, 0x00, 0x50, 0x00, 0x50, 0x00, 0x28, 0x4d, 0xad, 0x00, 0x67, |
| 1023 | 0x00, 0x01, 0x00, 0x72, 0xd5, 0xc7, 0xf1, 0x07, 0x00, 0x00, 0x01, 0x01, 0x00, 0x0d, 0x00, 0x00, |
| 1024 | 0x00, 0x14, 0x00, 0x00, 0x19, 0xba, |
| 1025 | } |
| 1026 | p := gopacket.NewPacket(data, LinkTypeEthernet, testDecodeOptions) |
| 1027 | checkLayers(p, []gopacket.LayerType{LayerTypeEthernet, LayerTypeDot1Q, LayerTypeIPv4, LayerTypeUDP, gopacket.LayerTypePayload}, t) |
| 1028 | if !p.Metadata().Truncated { |
| 1029 | t.Error("UDP short packet should be truncated") |
| 1030 | } |
| 1031 | } |
| 1032 | |
| 1033 | func TestDecodingLayerParserFullTCPPacket(t *testing.T) { |
| 1034 | dlp := gopacket.NewDecodingLayerParser(LayerTypeEthernet, &Ethernet{}, &IPv4{}, &TCP{}, &gopacket.Payload{}) |
nothing calls this directly
no test coverage detected
searching dependent graphs…