git: 2e29bf7a2ae6 - main - ping: tests: Cleanup IPOption()s

From: Jose Luis Duran <jlduran_at_FreeBSD.org>
Date: Tue, 05 Nov 2024 02:50:35 UTC
The branch main has been updated by jlduran:

URL: https://cgit.FreeBSD.org/src/commit/?id=2e29bf7a2ae66acb6e65ffc1c923cfb373af67bd

commit 2e29bf7a2ae66acb6e65ffc1c923cfb373af67bd
Author:     Jose Luis Duran <jlduran@FreeBSD.org>
AuthorDate: 2024-11-05 02:46:45 +0000
Commit:     Jose Luis Duran <jlduran@FreeBSD.org>
CommitDate: 2024-11-05 02:46:45 +0000

    ping: tests: Cleanup IPOption()s
    
    Scapy now only accepts known options with IPOption(), so our unknown
    option must be passed raw.
    
    While here, prefer the named options for EOL and NOP.
    
    Reviewed by:    emaste, kp
    Approved by:    emaste (mentor)
    Differential Revision:  https://reviews.freebsd.org/D47160
---
 sbin/ping/tests/test_ping.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/sbin/ping/tests/test_ping.py b/sbin/ping/tests/test_ping.py
index 8ec0f3dc74dc..90df07d0e5b9 100644
--- a/sbin/ping/tests/test_ping.py
+++ b/sbin/ping/tests/test_ping.py
@@ -85,11 +85,11 @@ def generate_ip_options(opts):
     ]
     routers_zero = [0, 0, 0, 0, 0, 0, 0, 0, 0]
     if opts == "EOL":
-        options = sc.IPOption(b"\x00")
+        options = sc.IPOption_EOL()
     elif opts == "NOP":
-        options = sc.IPOption(b"\x01")
+        options = sc.IPOption_NOP()
     elif opts == "NOP-40":
-        options = sc.IPOption(b"\x01" * 40)
+        options = sc.IPOption_NOP() * 40
     elif opts == "RR":
         ToolsHelper.set_sysctl("net.inet.ip.process_options", 0)
         options = sc.IPOption_RR(pointer=40, routers=routers)
@@ -116,7 +116,7 @@ def generate_ip_options(opts):
         options = b"\x9f"
     elif opts == "unk-40":
         ToolsHelper.set_sysctl("net.inet.ip.process_options", 0)
-        options = sc.IPOption(b"\x9f" * 40)
+        options = b"\x9f" * 40
     else:
         options = ""
     return options