git: 4627bc1e90fd - main - tests: use PF_DIVERT/SOCK_RAW instead of PF_INET/SOCK_RAW/IPPROTO_DIVERT
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 30 Aug 2022 23:24:58 UTC
The branch main has been updated by glebius:
URL: https://cgit.FreeBSD.org/src/commit/?id=4627bc1e90fd17c8d4f44de6b932d456b67661fc
commit 4627bc1e90fd17c8d4f44de6b932d456b67661fc
Author: Gleb Smirnoff <glebius@FreeBSD.org>
AuthorDate: 2022-08-30 23:23:36 +0000
Commit: Gleb Smirnoff <glebius@FreeBSD.org>
CommitDate: 2022-08-30 23:24:37 +0000
tests: use PF_DIVERT/SOCK_RAW instead of PF_INET/SOCK_RAW/IPPROTO_DIVERT
---
tests/sys/common/divert.py | 8 ++++----
tools/regression/netinet/ipdivert/ipdivert.c | 2 +-
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/tests/sys/common/divert.py b/tests/sys/common/divert.py
index 94e20a03571f..44b1f49ae13f 100755
--- a/tests/sys/common/divert.py
+++ b/tests/sys/common/divert.py
@@ -36,7 +36,7 @@ import scapy.all as sc
import argparse
-IPPROTO_DIVERT = 258
+PF_DIVERT = 44
def parse_args():
@@ -52,14 +52,14 @@ def parse_args():
def ipdivert_ip_output_remote_success(args):
packet = sc.IP(dst=args.dip) / sc.ICMP(type='echo-request')
- with socket.socket(socket.AF_INET, socket.SOCK_RAW, IPPROTO_DIVERT) as s:
+ with socket.socket(PF_DIVERT, socket.SOCK_RAW, 0) as s:
s.bind(('0.0.0.0', args.divert_port))
s.sendto(bytes(packet), ('0.0.0.0', 0))
def ipdivert_ip6_output_remote_success(args):
packet = sc.IPv6(dst=args.dip) / sc.ICMPv6EchoRequest()
- with socket.socket(socket.AF_INET, socket.SOCK_RAW, IPPROTO_DIVERT) as s:
+ with socket.socket(PF_DIVERT, socket.SOCK_RAW, 0) as s:
s.bind(('0.0.0.0', args.divert_port))
s.sendto(bytes(packet), ('0.0.0.0', 0))
@@ -67,7 +67,7 @@ def ipdivert_ip6_output_remote_success(args):
def ipdivert_ip_input_local_success(args):
"""Sends IPv4 packet to OS stack as inbound local packet."""
packet = sc.IP(dst=args.dip,src=args.sip) / sc.ICMP(type='echo-request')
- with socket.socket(socket.AF_INET, socket.SOCK_RAW, IPPROTO_DIVERT) as s:
+ with socket.socket(PF_DIVERT, socket.SOCK_RAW, 0) as s:
s.bind(('0.0.0.0', args.divert_port))
s.sendto(bytes(packet), (args.dip, 0))
diff --git a/tools/regression/netinet/ipdivert/ipdivert.c b/tools/regression/netinet/ipdivert/ipdivert.c
index 0d5849159a9a..37babd68f5f3 100644
--- a/tools/regression/netinet/ipdivert/ipdivert.c
+++ b/tools/regression/netinet/ipdivert/ipdivert.c
@@ -76,7 +76,7 @@ ipdivert_create(const char *test)
{
int s;
- s = socket(PF_INET, SOCK_RAW, IPPROTO_DIVERT);
+ s = socket(PF_DIVERT, SOCK_RAW, 0);
if (s < 0)
fail(test, "socket");
return (s);