Skip to content

Commit 5b6600d

Browse files
fixed tests
1 parent a9e23c1 commit 5b6600d

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

layers/arp_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ func TestParseARP(t *testing.T) {
6565
SenderIP: netip.AddrFrom4([4]byte{0x7F, 0x00, 0x00, 0x01}),
6666
TargetMAC: net.HardwareAddr{0x43, 0x40, 0x8d, 0x28, 0xca, 0x0b},
6767
TargetIP: netip.AddrFrom4([4]byte{0x7F, 0x00, 0x00, 0x02}),
68+
DstVendor: net.HardwareAddr{0x43, 0x40, 0x8d, 0x28, 0xca, 0x0b}.String(),
69+
SrcVendor: net.HardwareAddr{0x7b, 0x13, 0x0b, 0x87, 0xea, 0x51}.String(),
6870
}
6971
arp := &ARPPacket{}
7072
packet, close := testPacket(t, "arp")

layers/ethernet_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ func TestParseEthernet(t *testing.T) {
2626
SrcMAC: net.HardwareAddr{0x43, 0x40, 0x8d, 0x28, 0xca, 0x0b},
2727
EtherType: &EthernetType{Val: 0x0800, Desc: "IPv4"},
2828
Payload: []byte{},
29+
DstVendor: net.HardwareAddr{0x7b, 0x13, 0x0b, 0x87, 0xea, 0x51}.String(),
30+
SrcVendor: net.HardwareAddr{0x43, 0x40, 0x8d, 0x28, 0xca, 0x0b}.String(),
2931
}
3032
eth := &EthernetFrame{}
3133
packet, close := testPacket(t, "ethernet")

layers/tcp_test.go

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,23 @@ func TestParseTCP(t *testing.T) {
2929
Reserved: 0,
3030
Flags: &TCPFlags{
3131
Raw: 2,
32-
SYN: 1,
32+
Val: []*TCPFlag{
33+
{Val: 0, Desc: "CWR"},
34+
{Val: 0, Desc: "ECE"},
35+
{Val: 0, Desc: "URG"},
36+
{Val: 0, Desc: "ACK"},
37+
{Val: 0, Desc: "PSH"},
38+
{Val: 0, Desc: "RST"},
39+
{Val: 1, Desc: "SYN"},
40+
{Val: 0, Desc: "FIN"},
41+
},
3342
},
3443
WindowSize: 64240,
3544
Checksum: 30263,
3645
Options: []byte{
3746
0x02, 0x04, 0x05, 0xb4, 0x04, 0x02, 0x08, 0x0a, 0xac, 0xf8,
38-
0x48, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x01, 0x03, 0x03, 0x07},
47+
0x48, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x01, 0x03, 0x03, 0x07,
48+
},
3949
payload: []byte{},
4050
}
4151
tcp := &TCPSegment{}

0 commit comments

Comments
 (0)