Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F146231240
D37210.id112389.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D37210.id112389.diff
View Options
diff --git a/sbin/ping/tests/Makefile b/sbin/ping/tests/Makefile
--- a/sbin/ping/tests/Makefile
+++ b/sbin/ping/tests/Makefile
@@ -6,9 +6,13 @@
PACKAGE= tests
ATF_TESTS_SH+= ping_test
+# Exclusive because each injection test case uses the same IP addresses
+TEST_METADATA.ping_test+= is_exclusive="true"
+
${PACKAGE}FILES+= ping_c1_s56_t1.out
${PACKAGE}FILES+= ping_6_c1_s8_t1.out
${PACKAGE}FILES+= ping_c1_s56_t1_S127.out
${PACKAGE}FILES+= ping_c1_s8_t1_S1.out
+${PACKAGE}FILES+= injection.py
.include <bsd.test.mk>
diff --git a/sbin/ping/tests/ping_test.sh b/sbin/ping/tests/ping_test.sh
--- a/sbin/ping/tests/ping_test.sh
+++ b/sbin/ping/tests/ping_test.sh
@@ -125,6 +125,47 @@
atf_check -s exit:1 -e ignore ping6 -4 -6
}
+atf_test_case "inject_opts" "cleanup"
+inject_opts_head() {
+ atf_set "descr" "Inejct an ECHO REPLY with IP options"
+ atf_set "require.user" "root"
+ atf_set "require.progs" "scapy"
+}
+inject_opts_body() {
+ atf_check -s exit:0 -o ignore python3 $(atf_get_srcdir)/injection.py opts
+}
+inject_opts_cleanup() {
+ ifconfig `cat tun.txt` destroy
+}
+
+atf_test_case "inject_pip" "cleanup"
+inject_pip_head() {
+ atf_set "descr" "Inject an ICMP error with a quoted packet with IP options"
+ atf_set "require.user" "root"
+ atf_set "require.progs" "scapy"
+}
+inject_pip_body() {
+ atf_check -s exit:2 -o ignore python3 $(atf_get_srcdir)/injection.py pip
+}
+inject_pip_cleanup() {
+ ifconfig `cat tun.txt` destroy
+}
+
+# This is redundant with the ping_ tests, but it serves to ensure that scapy.py
+# is working correctly.
+atf_test_case "inject_reply" "cleanup"
+inject_reply_head() {
+ atf_set "descr" "Basic ping test with packet injection"
+ atf_set "require.user" "root"
+ atf_set "require.progs" "scapy"
+}
+inject_reply_body() {
+ atf_check -s exit:0 -o ignore python3 $(atf_get_srcdir)/injection.py reply
+}
+inject_reply_cleanup() {
+ ifconfig `cat tun.txt` destroy
+}
+
atf_init_test_cases() {
atf_add_test_case ping_c1_s56_t1
@@ -136,6 +177,9 @@
atf_add_test_case ping6_c1t4
atf_add_test_case ping_46
atf_add_test_case ping6_46
+ atf_add_test_case inject_opts
+ atf_add_test_case inject_pip
+ atf_add_test_case inject_reply
}
check_ping_statistics() {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Mar 1, 11:25 PM (54 m, 3 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29128862
Default Alt Text
D37210.id112389.diff (2 KB)
Attached To
Mode
D37210: Add test cases for ping with IP options in the response
Attached
Detach File
Event Timeline
Log In to Comment