ping: Add test for ident
This commit is contained in:
parent
bee7be8598
commit
3faf8cf679
1 changed files with 4 additions and 0 deletions
|
|
@ -102,6 +102,7 @@ func testPingIPv4ReadIP(t *testing.T, privileged bool, addr string) {
|
||||||
require.NotZero(t, ipHdr.TTL())
|
require.NotZero(t, ipHdr.TTL())
|
||||||
icmpHdr := header.ICMPv4(ipHdr.Payload())
|
icmpHdr := header.ICMPv4(ipHdr.Payload())
|
||||||
require.Equal(t, header.ICMPv4EchoReply, icmpHdr.Type())
|
require.Equal(t, header.ICMPv4EchoReply, icmpHdr.Type())
|
||||||
|
require.Equal(t, request.Ident(), icmpHdr.Ident())
|
||||||
}
|
}
|
||||||
|
|
||||||
func testPingIPv4ReadICMP(t *testing.T, privileged bool, addr string) {
|
func testPingIPv4ReadICMP(t *testing.T, privileged bool, addr string) {
|
||||||
|
|
@ -133,6 +134,7 @@ func testPingIPv4ReadICMP(t *testing.T, privileged bool, addr string) {
|
||||||
|
|
||||||
icmpHdr := header.ICMPv4(response.Bytes())
|
icmpHdr := header.ICMPv4(response.Bytes())
|
||||||
require.Equal(t, header.ICMPv4EchoReply, icmpHdr.Type())
|
require.Equal(t, header.ICMPv4EchoReply, icmpHdr.Type())
|
||||||
|
require.Equal(t, request.Ident(), icmpHdr.Ident())
|
||||||
}
|
}
|
||||||
|
|
||||||
func testPingIPv6ReadIP(t *testing.T, privileged bool, addr string) {
|
func testPingIPv6ReadIP(t *testing.T, privileged bool, addr string) {
|
||||||
|
|
@ -164,6 +166,7 @@ func testPingIPv6ReadIP(t *testing.T, privileged bool, addr string) {
|
||||||
require.NotZero(t, ipHdr.HopLimit())
|
require.NotZero(t, ipHdr.HopLimit())
|
||||||
icmpHdr := header.ICMPv6(ipHdr.Payload())
|
icmpHdr := header.ICMPv6(ipHdr.Payload())
|
||||||
require.Equal(t, header.ICMPv6EchoReply, icmpHdr.Type())
|
require.Equal(t, header.ICMPv6EchoReply, icmpHdr.Type())
|
||||||
|
require.Equal(t, request.Ident(), icmpHdr.Ident())
|
||||||
}
|
}
|
||||||
|
|
||||||
func testPingIPv6ReadICMP(t *testing.T, privileged bool, addr string) {
|
func testPingIPv6ReadICMP(t *testing.T, privileged bool, addr string) {
|
||||||
|
|
@ -192,4 +195,5 @@ func testPingIPv6ReadICMP(t *testing.T, privileged bool, addr string) {
|
||||||
}
|
}
|
||||||
icmpHdr := header.ICMPv6(response.Bytes())
|
icmpHdr := header.ICMPv6(response.Bytes())
|
||||||
require.Equal(t, header.ICMPv6EchoReply, icmpHdr.Type())
|
require.Equal(t, header.ICMPv6EchoReply, icmpHdr.Type())
|
||||||
|
require.Equal(t, request.Ident(), icmpHdr.Ident())
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue