Skip to content

Commit ec46476

Browse files
committed
Add missing ETH payloads
1 parent 1b1defe commit ec46476

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

protocols/ip_test.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,11 @@ func TestIPv4PacketFromBytes(t *testing.T) {
119119
destinationMAC: net.HardwareAddr([]byte{0x00, 0x1A, 0xA0, 0xBB, 0xCC, 0xDD}),
120120
sourceMAC: net.HardwareAddr([]byte{0x00, 0x1A, 0xB0, 0xCC, 0xDD, 0xEE}),
121121
etherType: 0x0800,
122+
payload: []byte{
123+
0x45, 0x00, 0x00, 0x3c, 0x1c, 0x46, 0x40, 0x00,
124+
0x40, 0x06, 0xb1, 0xe6, 0xc0, 0xa8, 0x00, 0x68,
125+
0xc0, 0xa8, 0x00, 0x01,
126+
},
122127
},
123128
header: ipv4Header{
124129
version: 4,
@@ -156,6 +161,11 @@ func TestIPv4PacketFromBytes(t *testing.T) {
156161
destinationMAC: net.HardwareAddr([]byte{0x00, 0x1A, 0xA0, 0xBB, 0xCC, 0xDD}),
157162
sourceMAC: net.HardwareAddr([]byte{0x00, 0x1A, 0xB0, 0xCC, 0xDD, 0xEE}),
158163
etherType: 0x0800,
164+
payload: []byte{
165+
0x46, 0x00, 0x00, 0x3c, 0x1c, 0x46, 0x40, 0x00,
166+
0x40, 0x06, 0xb1, 0xe6, 0xc0, 0xa8, 0x00, 0x68,
167+
0xc0, 0xa8, 0x00, 0x01, 0x01, 0x02, 0x03, 0x04,
168+
},
159169
},
160170
header: ipv4Header{
161171
version: 4,
@@ -344,6 +354,13 @@ func TestIPv6PacketFromBytes(t *testing.T) {
344354
destinationMAC: net.HardwareAddr([]byte{0x00, 0x1A, 0xA0, 0xBB, 0xCC, 0xDD}),
345355
sourceMAC: net.HardwareAddr([]byte{0x00, 0x1A, 0xB0, 0xCC, 0xDD, 0xEE}),
346356
etherType: 0x86DD,
357+
payload: []byte{
358+
0x60, 0x00, 0x00, 0x00, 0x00, 0x14, 0x11, 0x40,
359+
0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
360+
0x02, 0x1c, 0x7e, 0xff, 0xfe, 0xe4, 0x2c, 0x00,
361+
0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
362+
0x02, 0x1c, 0x7e, 0xff, 0xfe, 0xe4, 0x2c, 0x01,
363+
},
347364
},
348365
header: ipv6Header{
349366
version: 6,

0 commit comments

Comments
 (0)