ping tests: Add tests for IP header options
The function pr_pack() prints out a packet, if the IP packet contains
options, these are printed as well.
Test the functionality fixed in
70960bb86a
.
Reviewed by: markj
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D38470
This commit is contained in:
parent
1dc1f6bd31
commit
076b718d9e
@ -780,6 +780,248 @@ def test_ping_46(self, expected):
|
|||||||
},
|
},
|
||||||
id="_0_0",
|
id="_0_0",
|
||||||
),
|
),
|
||||||
|
pytest.param(
|
||||||
|
{
|
||||||
|
"src": "192.0.2.1",
|
||||||
|
"dst": "192.0.2.2",
|
||||||
|
"icmp_type": 0,
|
||||||
|
"icmp_code": 0,
|
||||||
|
"opts": "EOL",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"returncode": 0,
|
||||||
|
"stdout": """\
|
||||||
|
PING 192.0.2.2 (192.0.2.2): 56 data bytes
|
||||||
|
64 bytes from: icmp_seq=0 ttl= time= ms
|
||||||
|
wrong total length 88 instead of 84
|
||||||
|
|
||||||
|
--- 192.0.2.2 ping statistics ---
|
||||||
|
1 packets transmitted, 1 packets received, 0.0% packet loss
|
||||||
|
round-trip min/avg/max/stddev = /// ms
|
||||||
|
""",
|
||||||
|
"stderr": "",
|
||||||
|
"redacted": True,
|
||||||
|
},
|
||||||
|
id="_0_0_opts_EOL",
|
||||||
|
),
|
||||||
|
pytest.param(
|
||||||
|
{
|
||||||
|
"src": "192.0.2.1",
|
||||||
|
"dst": "192.0.2.2",
|
||||||
|
"icmp_type": 0,
|
||||||
|
"icmp_code": 0,
|
||||||
|
"opts": "LSRR",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"returncode": 0,
|
||||||
|
"stdout": """\
|
||||||
|
PING 192.0.2.2 (192.0.2.2): 56 data bytes
|
||||||
|
64 bytes from: icmp_seq=0 ttl= time= ms
|
||||||
|
LSRR: 192.0.2.10
|
||||||
|
192.0.2.20
|
||||||
|
192.0.2.30
|
||||||
|
192.0.2.40
|
||||||
|
192.0.2.50
|
||||||
|
192.0.2.60
|
||||||
|
192.0.2.70
|
||||||
|
192.0.2.80
|
||||||
|
192.0.2.90
|
||||||
|
|
||||||
|
--- 192.0.2.2 ping statistics ---
|
||||||
|
1 packets transmitted, 1 packets received, 0.0% packet loss
|
||||||
|
round-trip min/avg/max/stddev = /// ms
|
||||||
|
""",
|
||||||
|
"stderr": "",
|
||||||
|
"redacted": True,
|
||||||
|
},
|
||||||
|
id="_0_0_opts_LSRR",
|
||||||
|
),
|
||||||
|
pytest.param(
|
||||||
|
{
|
||||||
|
"src": "192.0.2.1",
|
||||||
|
"dst": "192.0.2.2",
|
||||||
|
"icmp_type": 0,
|
||||||
|
"icmp_code": 0,
|
||||||
|
"opts": "LSRR-trunc",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"returncode": 0,
|
||||||
|
"stdout": """\
|
||||||
|
PING 192.0.2.2 (192.0.2.2): 56 data bytes
|
||||||
|
64 bytes from: icmp_seq=0 ttl= time= ms
|
||||||
|
LSRR: (truncated route)
|
||||||
|
|
||||||
|
|
||||||
|
--- 192.0.2.2 ping statistics ---
|
||||||
|
1 packets transmitted, 1 packets received, 0.0% packet loss
|
||||||
|
round-trip min/avg/max/stddev = /// ms
|
||||||
|
""",
|
||||||
|
"stderr": "",
|
||||||
|
"redacted": True,
|
||||||
|
},
|
||||||
|
id="_0_0_opts_LSRR_trunc",
|
||||||
|
),
|
||||||
|
pytest.param(
|
||||||
|
{
|
||||||
|
"src": "192.0.2.1",
|
||||||
|
"dst": "192.0.2.2",
|
||||||
|
"icmp_type": 0,
|
||||||
|
"icmp_code": 0,
|
||||||
|
"opts": "SSRR",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"returncode": 0,
|
||||||
|
"stdout": """\
|
||||||
|
PING 192.0.2.2 (192.0.2.2): 56 data bytes
|
||||||
|
64 bytes from: icmp_seq=0 ttl= time= ms
|
||||||
|
SSRR: 192.0.2.10
|
||||||
|
192.0.2.20
|
||||||
|
192.0.2.30
|
||||||
|
192.0.2.40
|
||||||
|
192.0.2.50
|
||||||
|
192.0.2.60
|
||||||
|
192.0.2.70
|
||||||
|
192.0.2.80
|
||||||
|
192.0.2.90
|
||||||
|
|
||||||
|
--- 192.0.2.2 ping statistics ---
|
||||||
|
1 packets transmitted, 1 packets received, 0.0% packet loss
|
||||||
|
round-trip min/avg/max/stddev = /// ms
|
||||||
|
""",
|
||||||
|
"stderr": "",
|
||||||
|
"redacted": True,
|
||||||
|
},
|
||||||
|
id="_0_0_opts_SSRR",
|
||||||
|
),
|
||||||
|
pytest.param(
|
||||||
|
{
|
||||||
|
"src": "192.0.2.1",
|
||||||
|
"dst": "192.0.2.2",
|
||||||
|
"icmp_type": 0,
|
||||||
|
"icmp_code": 0,
|
||||||
|
"opts": "SSRR-trunc",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"returncode": 0,
|
||||||
|
"stdout": """\
|
||||||
|
PING 192.0.2.2 (192.0.2.2): 56 data bytes
|
||||||
|
64 bytes from: icmp_seq=0 ttl= time= ms
|
||||||
|
SSRR: (truncated route)
|
||||||
|
|
||||||
|
|
||||||
|
--- 192.0.2.2 ping statistics ---
|
||||||
|
1 packets transmitted, 1 packets received, 0.0% packet loss
|
||||||
|
round-trip min/avg/max/stddev = /// ms
|
||||||
|
""",
|
||||||
|
"stderr": "",
|
||||||
|
"redacted": True,
|
||||||
|
},
|
||||||
|
id="_0_0_opts_SSRR_trunc",
|
||||||
|
),
|
||||||
|
pytest.param(
|
||||||
|
{
|
||||||
|
"src": "192.0.2.1",
|
||||||
|
"dst": "192.0.2.2",
|
||||||
|
"icmp_type": 0,
|
||||||
|
"icmp_code": 0,
|
||||||
|
"opts": "RR",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"returncode": 0,
|
||||||
|
"stdout": """\
|
||||||
|
PING 192.0.2.2 (192.0.2.2): 56 data bytes
|
||||||
|
64 bytes from: icmp_seq=0 ttl= time= ms
|
||||||
|
RR: 192.0.2.10
|
||||||
|
192.0.2.20
|
||||||
|
192.0.2.30
|
||||||
|
192.0.2.40
|
||||||
|
192.0.2.50
|
||||||
|
192.0.2.60
|
||||||
|
192.0.2.70
|
||||||
|
192.0.2.80
|
||||||
|
192.0.2.90
|
||||||
|
|
||||||
|
--- 192.0.2.2 ping statistics ---
|
||||||
|
1 packets transmitted, 1 packets received, 0.0% packet loss
|
||||||
|
round-trip min/avg/max/stddev = /// ms
|
||||||
|
""",
|
||||||
|
"stderr": "",
|
||||||
|
"redacted": True,
|
||||||
|
},
|
||||||
|
id="_0_0_opts_RR",
|
||||||
|
),
|
||||||
|
pytest.param(
|
||||||
|
{
|
||||||
|
"src": "192.0.2.1",
|
||||||
|
"dst": "192.0.2.2",
|
||||||
|
"icmp_type": 0,
|
||||||
|
"icmp_code": 0,
|
||||||
|
"opts": "RR-same",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"returncode": 0,
|
||||||
|
"stdout": """\
|
||||||
|
PING 192.0.2.2 (192.0.2.2): 56 data bytes
|
||||||
|
64 bytes from: icmp_seq=0 ttl= time= ms (same route)
|
||||||
|
|
||||||
|
--- 192.0.2.2 ping statistics ---
|
||||||
|
1 packets transmitted, 1 packets received, 0.0% packet loss
|
||||||
|
round-trip min/avg/max/stddev = /// ms
|
||||||
|
""",
|
||||||
|
"stderr": "",
|
||||||
|
"redacted": True,
|
||||||
|
},
|
||||||
|
id="_0_0_opts_RR_same",
|
||||||
|
),
|
||||||
|
pytest.param(
|
||||||
|
{
|
||||||
|
"src": "192.0.2.1",
|
||||||
|
"dst": "192.0.2.2",
|
||||||
|
"icmp_type": 0,
|
||||||
|
"icmp_code": 0,
|
||||||
|
"opts": "RR-trunc",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"returncode": 0,
|
||||||
|
"stdout": """\
|
||||||
|
PING 192.0.2.2 (192.0.2.2): 56 data bytes
|
||||||
|
64 bytes from: icmp_seq=0 ttl= time= ms
|
||||||
|
RR: (truncated route)
|
||||||
|
|
||||||
|
--- 192.0.2.2 ping statistics ---
|
||||||
|
1 packets transmitted, 1 packets received, 0.0% packet loss
|
||||||
|
round-trip min/avg/max/stddev = /// ms
|
||||||
|
""",
|
||||||
|
"stderr": "",
|
||||||
|
"redacted": True,
|
||||||
|
},
|
||||||
|
id="_0_0_opts_RR_trunc",
|
||||||
|
),
|
||||||
|
pytest.param(
|
||||||
|
{
|
||||||
|
"src": "192.0.2.1",
|
||||||
|
"dst": "192.0.2.2",
|
||||||
|
"icmp_type": 0,
|
||||||
|
"icmp_code": 0,
|
||||||
|
"opts": "NOP",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"returncode": 0,
|
||||||
|
"stdout": """\
|
||||||
|
PING 192.0.2.2 (192.0.2.2): 56 data bytes
|
||||||
|
64 bytes from: icmp_seq=0 ttl= time= ms
|
||||||
|
wrong total length 88 instead of 84
|
||||||
|
NOP
|
||||||
|
|
||||||
|
--- 192.0.2.2 ping statistics ---
|
||||||
|
1 packets transmitted, 1 packets received, 0.0% packet loss
|
||||||
|
round-trip min/avg/max/stddev = /// ms
|
||||||
|
""",
|
||||||
|
"stderr": "",
|
||||||
|
"redacted": True,
|
||||||
|
},
|
||||||
|
id="_0_0_opts_NOP",
|
||||||
|
),
|
||||||
pytest.param(
|
pytest.param(
|
||||||
{
|
{
|
||||||
"src": "192.0.2.1",
|
"src": "192.0.2.1",
|
||||||
@ -867,7 +1109,6 @@ def test_ping_46(self, expected):
|
|||||||
"stderr": "",
|
"stderr": "",
|
||||||
"redacted": True,
|
"redacted": True,
|
||||||
},
|
},
|
||||||
marks=pytest.mark.skip("XXX currently failing"),
|
|
||||||
id="_0_0_opts_unk",
|
id="_0_0_opts_unk",
|
||||||
),
|
),
|
||||||
pytest.param(
|
pytest.param(
|
||||||
|
Loading…
Reference in New Issue
Block a user