1# test divert-reply with icmp with out and in packet
2# create a divert-reply out rule on the remote machine
3# client sends a ICMP echo packet from the remote machine
4# kernel reflects the ICMP echo packet at the local machine
5# client receives the ICMP echo reply packet at the remote machine
6
7use strict;
8use warnings;
9use Socket;
10
11our %args = (
12    socktype => Socket::SOCK_RAW,
13    protocol => sub { shift->{af} eq "inet" ? "icmp" : "icmp6" },
14    client => {
15	func => sub {
16	    my $self = shift;
17	    write_icmp_echo($self);
18	    read_icmp_echo($self, "reply");
19	},
20	out => "ICMP6?",
21	in => "ICMP6? reply",
22    },
23    # no server as our kernel does the icmp reply automatically
24    divert => "reply",
25);
26