Skip to content

Commit 4627bc1

Browse files
committed
tests: use PF_DIVERT/SOCK_RAW instead of PF_INET/SOCK_RAW/IPPROTO_DIVERT
1 parent f70a2e2 commit 4627bc1

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

tests/sys/common/divert.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
import argparse
3737

3838

39-
IPPROTO_DIVERT = 258
39+
PF_DIVERT = 44
4040

4141

4242
def parse_args():
@@ -52,22 +52,22 @@ def parse_args():
5252

5353
def ipdivert_ip_output_remote_success(args):
5454
packet = sc.IP(dst=args.dip) / sc.ICMP(type='echo-request')
55-
with socket.socket(socket.AF_INET, socket.SOCK_RAW, IPPROTO_DIVERT) as s:
55+
with socket.socket(PF_DIVERT, socket.SOCK_RAW, 0) as s:
5656
s.bind(('0.0.0.0', args.divert_port))
5757
s.sendto(bytes(packet), ('0.0.0.0', 0))
5858

5959

6060
def ipdivert_ip6_output_remote_success(args):
6161
packet = sc.IPv6(dst=args.dip) / sc.ICMPv6EchoRequest()
62-
with socket.socket(socket.AF_INET, socket.SOCK_RAW, IPPROTO_DIVERT) as s:
62+
with socket.socket(PF_DIVERT, socket.SOCK_RAW, 0) as s:
6363
s.bind(('0.0.0.0', args.divert_port))
6464
s.sendto(bytes(packet), ('0.0.0.0', 0))
6565

6666

6767
def ipdivert_ip_input_local_success(args):
6868
"""Sends IPv4 packet to OS stack as inbound local packet."""
6969
packet = sc.IP(dst=args.dip,src=args.sip) / sc.ICMP(type='echo-request')
70-
with socket.socket(socket.AF_INET, socket.SOCK_RAW, IPPROTO_DIVERT) as s:
70+
with socket.socket(PF_DIVERT, socket.SOCK_RAW, 0) as s:
7171
s.bind(('0.0.0.0', args.divert_port))
7272
s.sendto(bytes(packet), (args.dip, 0))
7373

tools/regression/netinet/ipdivert/ipdivert.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ ipdivert_create(const char *test)
7676
{
7777
int s;
7878

79-
s = socket(PF_INET, SOCK_RAW, IPPROTO_DIVERT);
79+
s = socket(PF_DIVERT, SOCK_RAW, 0);
8080
if (s < 0)
8181
fail(test, "socket");
8282
return (s);

0 commit comments

Comments
 (0)