summaryrefslogtreecommitdiff
path: root/regress/sys/net/pf_divert/args-rip-reply-to.pl
blob: b8e3a0aaaffd54ec6f6d7fd4b219e8730edeab8d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# test divert-reply with raw ip with out and in packet

use strict;
use warnings;
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);
	},
    },
    divert => "reply",
);