From edbc9d7f6bcda5f36e29ba134aba8acea12c43c0 Mon Sep 17 00:00:00 2001 From: bluhm Date: Thu, 21 Dec 2017 23:27:17 +0000 Subject: [PATCH] Add some comments what the tests are doing. --- .../net/pf_divert/args-icmp-reply-reuse.pl | 7 ++++++ .../sys/net/pf_divert/args-icmp-reply-to.pl | 4 ++++ regress/sys/net/pf_divert/args-icmp-to.pl | 3 +++ .../sys/net/pf_divert/args-rip-reply-to.pl | 22 +++++-------------- regress/sys/net/pf_divert/args-rip-reply.pl | 3 +++ regress/sys/net/pf_divert/args-rip-to.pl | 3 +++ regress/sys/net/pf_divert/args-tcp-reply.pl | 3 +++ regress/sys/net/pf_divert/args-tcp-to.pl | 3 +++ .../sys/net/pf_divert/args-udp-packet-in.pl | 4 ++++ .../sys/net/pf_divert/args-udp-packet-out.pl | 4 ++++ .../sys/net/pf_divert/args-udp-reply-to.pl | 4 ++++ regress/sys/net/pf_divert/args-udp-reply.pl | 3 +++ regress/sys/net/pf_divert/args-udp-to.pl | 3 +++ 13 files changed, 50 insertions(+), 16 deletions(-) diff --git a/regress/sys/net/pf_divert/args-icmp-reply-reuse.pl b/regress/sys/net/pf_divert/args-icmp-reply-reuse.pl index f8cd4553ee8..5310e05d165 100644 --- a/regress/sys/net/pf_divert/args-icmp-reply-reuse.pl +++ b/regress/sys/net/pf_divert/args-icmp-reply-reuse.pl @@ -1,4 +1,11 @@ # test divert-reply with icmp and socket reuse +# create a divert-reply out rule on the remote machine +# client sends a ICMP echo packet from the remote machine +# kernel reflects the ICMP echo packet at the local machine +# client receives the ICMP echo reply packet at the remote machine +# client sends a different ICMP echo packet from the remote machine +# kernel reflects the ICMP echo packet at the local machine +# client receives the ICMP echo reply packet at the remote machine use strict; use warnings; diff --git a/regress/sys/net/pf_divert/args-icmp-reply-to.pl b/regress/sys/net/pf_divert/args-icmp-reply-to.pl index 29667a153b1..c15437c39dd 100644 --- a/regress/sys/net/pf_divert/args-icmp-reply-to.pl +++ b/regress/sys/net/pf_divert/args-icmp-reply-to.pl @@ -1,4 +1,8 @@ # test divert-reply with icmp with out and in packet +# create a divert-reply out rule on the remote machine +# client sends a ICMP echo packet from the remote machine +# kernel reflects the ICMP echo packet at the local machine +# client receives the ICMP echo reply packet at the remote machine use strict; use warnings; diff --git a/regress/sys/net/pf_divert/args-icmp-to.pl b/regress/sys/net/pf_divert/args-icmp-to.pl index 45d3a74ae17..4993da25768 100644 --- a/regress/sys/net/pf_divert/args-icmp-to.pl +++ b/regress/sys/net/pf_divert/args-icmp-to.pl @@ -1,4 +1,7 @@ # test divert-to with icmp +# create a divert-to in rule on the remote machine +# client sends a ICMP echo packet from the local machine +# server receives the ICMP echo packet at the remote machine use strict; use warnings; diff --git a/regress/sys/net/pf_divert/args-rip-reply-to.pl b/regress/sys/net/pf_divert/args-rip-reply-to.pl index b8e3a0aaaff..72ffb8ca90b 100644 --- a/regress/sys/net/pf_divert/args-rip-reply-to.pl +++ b/regress/sys/net/pf_divert/args-rip-reply-to.pl @@ -1,4 +1,8 @@ # test divert-reply with raw ip with out and in packet +# create a divert-reply out rule on the remote machine +# client sends a proto 245 packet from the remote machine +# server reflects the proto 245 packet at the local machine +# client receives the proto 245 packet at the remote machine use strict; use warnings; @@ -7,21 +11,7 @@ use Socket; our %args = ( socktype => Socket::SOCK_RAW, protocol => 254, - client => { - func => sub { - my $self = shift; - write_datagram($self); - read_datagram($self); - }, - }, - server => { - func => sub { - my $self = shift; - read_datagram($self); - $self->{toaddr} = $self->{fromaddr}; - $self->{toport} = $self->{fromport}; - write_datagram($self); - }, - }, + client => { func => \&write_read_datagram }, + server => { func => \&read_write_datagram }, divert => "reply", ); diff --git a/regress/sys/net/pf_divert/args-rip-reply.pl b/regress/sys/net/pf_divert/args-rip-reply.pl index 0744f48fe76..4beb86185ed 100644 --- a/regress/sys/net/pf_divert/args-rip-reply.pl +++ b/regress/sys/net/pf_divert/args-rip-reply.pl @@ -1,4 +1,7 @@ # test divert-reply with raw ip +# create a divert-reply out rule on the remote machine +# client sends a proto 254 packet from the remote machine +# server receives the proto 254 packet at the local machine use strict; use warnings; diff --git a/regress/sys/net/pf_divert/args-rip-to.pl b/regress/sys/net/pf_divert/args-rip-to.pl index 19ba8fa6100..c90c885a356 100644 --- a/regress/sys/net/pf_divert/args-rip-to.pl +++ b/regress/sys/net/pf_divert/args-rip-to.pl @@ -1,4 +1,7 @@ # test divert-to with raw ip +# create a divert-to in rule on the remote machine +# client sends a proto 254 packet from the local machine +# server receives the proto 254 packet at the remote machine use strict; use warnings; diff --git a/regress/sys/net/pf_divert/args-tcp-reply.pl b/regress/sys/net/pf_divert/args-tcp-reply.pl index 8bf599cb01a..7510ba7064d 100644 --- a/regress/sys/net/pf_divert/args-tcp-reply.pl +++ b/regress/sys/net/pf_divert/args-tcp-reply.pl @@ -1,4 +1,7 @@ # test divert-reply with tcp +# create a divert-reply out rule on the remote machine +# client writes into TCP stream and reads from it on the remote machine +# server writes into TCP stream and reads from it on the local machine use strict; use warnings; diff --git a/regress/sys/net/pf_divert/args-tcp-to.pl b/regress/sys/net/pf_divert/args-tcp-to.pl index b99b0772760..fdc9dee1c2f 100644 --- a/regress/sys/net/pf_divert/args-tcp-to.pl +++ b/regress/sys/net/pf_divert/args-tcp-to.pl @@ -1,4 +1,7 @@ # test divert-to with tcp +# create a divert-to in rule on the remote machine +# client writes into TCP stream and reads from it on the local machine +# server writes into TCP stream and reads from it on the remote machine use strict; use warnings; diff --git a/regress/sys/net/pf_divert/args-udp-packet-in.pl b/regress/sys/net/pf_divert/args-udp-packet-in.pl index f3597c2098d..8ec9ee62c3b 100644 --- a/regress/sys/net/pf_divert/args-udp-packet-in.pl +++ b/regress/sys/net/pf_divert/args-udp-packet-in.pl @@ -1,4 +1,8 @@ # test divert-packet input rule with udp +# create a divert-packet in rule on the remote machine +# client sends a UDP packet from the local machine +# packet process reflects the UDP packet on divert socket on the remote machine +# server receives the UDP packet at the remote machine use strict; use warnings; diff --git a/regress/sys/net/pf_divert/args-udp-packet-out.pl b/regress/sys/net/pf_divert/args-udp-packet-out.pl index e5f3dd2f19c..375b03ac8e4 100644 --- a/regress/sys/net/pf_divert/args-udp-packet-out.pl +++ b/regress/sys/net/pf_divert/args-udp-packet-out.pl @@ -1,4 +1,8 @@ # test divert-packet output rule with udp +# create a divert-packet out rule on the remote machine +# client sends a UDP packet from the remote machine +# packet process reflects the UDP packet on divert socket on the remote machine +# server receives the UDP packet at the local machine use strict; use warnings; diff --git a/regress/sys/net/pf_divert/args-udp-reply-to.pl b/regress/sys/net/pf_divert/args-udp-reply-to.pl index 0886bda24c3..f842542472a 100644 --- a/regress/sys/net/pf_divert/args-udp-reply-to.pl +++ b/regress/sys/net/pf_divert/args-udp-reply-to.pl @@ -1,4 +1,8 @@ # test divert-reply with udp with out and in packet +# create a divert-reply out rule on the remote machine +# client sends a UDP packet from the remote machine +# server reflects the UDP packet at the local machine +# client receives the UDP packet at the remote machine use strict; use warnings; diff --git a/regress/sys/net/pf_divert/args-udp-reply.pl b/regress/sys/net/pf_divert/args-udp-reply.pl index e78d572cb17..b22b45cbac7 100644 --- a/regress/sys/net/pf_divert/args-udp-reply.pl +++ b/regress/sys/net/pf_divert/args-udp-reply.pl @@ -1,4 +1,7 @@ # test divert-reply with udp +# create a divert-reply out rule on the remote machine +# client sends a UDP packet from the remote machine +# server receives the UDP packet at the local machine use strict; use warnings; diff --git a/regress/sys/net/pf_divert/args-udp-to.pl b/regress/sys/net/pf_divert/args-udp-to.pl index 2469dc42de5..1400f718172 100644 --- a/regress/sys/net/pf_divert/args-udp-to.pl +++ b/regress/sys/net/pf_divert/args-udp-to.pl @@ -1,4 +1,7 @@ # test divert-to with udp +# create a divert-to in rule on the remote machine +# client sends a UDP packet from the local machine +# server receives the UDP packet at the remote machine use strict; use warnings; -- 2.20.1