github.com/gopacket/gopacket@v1.1.0/layers/linux_sll2_test.go (about) 1 package layers 2 3 import ( 4 "testing" 5 6 "github.com/gopacket/gopacket" 7 ) 8 9 var testParseLinkTypeLinuxSLL2 = []byte{ 10 // sll2 11 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x03, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 12 0x00, 0x00, 0x00, 0x00, 13 // ipv4 14 0x45, 0x00, 0x00, 0x3c, 0xaf, 0x93, 0x40, 0x00, 0x40, 0x06, 0x8d, 0x26, 0x7f, 0x00, 0x00, 0x01, 15 0x7f, 0x00, 0x00, 0x01, 16 // tcp 17 0xb8, 0x46, 0x04, 0xd2, 0x4e, 0x2a, 0x3f, 0xda, 0x00, 0x00, 0x00, 0x00, 0xa0, 0x02, 0xff, 0xd7, 18 0xfe, 0x30, 0x00, 0x00, 0x02, 0x04, 0xff, 0xd7, 0x04, 0x02, 0x08, 0x0a, 0xe4, 0x67, 0xf5, 0x17, 19 0x00, 0x00, 0x00, 0x00, 0x01, 0x03, 0x03, 0x07, 20 } 21 22 func TestParseLinkTypeLinuxSLL2(t *testing.T) { 23 p := gopacket.NewPacket(testParseLinkTypeLinuxSLL2, LinkTypeLinuxSLL2, testDecodeOptions) 24 if p.ErrorLayer() != nil { 25 t.Error("Failed to decode packet:", p.ErrorLayer().Error()) 26 } 27 checkLayers(p, []gopacket.LayerType{LayerTypeLinuxSLL2, LayerTypeIPv4, LayerTypeTCP}, t) 28 }