line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# $Id: Redirect.pm 53 2012-01-31 20:27:06Z gomor $ |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
package Net::Frame::Layer::ICMPv4::Redirect; |
5
|
3
|
|
|
3
|
|
7745
|
use strict; use warnings; |
|
3
|
|
|
3
|
|
6
|
|
|
3
|
|
|
|
|
115
|
|
|
3
|
|
|
|
|
17
|
|
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
113
|
|
6
|
|
|
|
|
|
|
|
7
|
3
|
|
|
3
|
|
1204
|
use Net::Frame::Layer qw(:consts :subs); |
|
3
|
|
|
|
|
97163
|
|
|
3
|
|
|
|
|
2350
|
|
8
|
|
|
|
|
|
|
our @ISA = qw(Net::Frame::Layer); |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our @AS = qw( |
11
|
|
|
|
|
|
|
gateway |
12
|
|
|
|
|
|
|
); |
13
|
|
|
|
|
|
|
__PACKAGE__->cgBuildIndices; |
14
|
|
|
|
|
|
|
__PACKAGE__->cgBuildAccessorsScalar(\@AS); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub new { |
17
|
1
|
|
|
1
|
1
|
28
|
my $self = shift->SUPER::new( |
18
|
|
|
|
|
|
|
gateway => '127.0.0.1', |
19
|
|
|
|
|
|
|
@_, |
20
|
|
|
|
|
|
|
); |
21
|
|
|
|
|
|
|
|
22
|
1
|
|
|
|
|
224
|
return $self; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
0
|
|
|
0
|
1
|
0
|
sub getLength { 4 } |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub pack { |
28
|
1
|
|
|
1
|
1
|
8
|
my $self = shift; |
29
|
|
|
|
|
|
|
|
30
|
1
|
50
|
|
|
|
5
|
$self->raw($self->SUPER::pack('a4', inetAton($self->gateway))) |
31
|
|
|
|
|
|
|
or return; |
32
|
|
|
|
|
|
|
|
33
|
1
|
|
|
|
|
85
|
return $self->raw; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub unpack { |
37
|
1
|
|
|
1
|
1
|
15
|
my $self = shift; |
38
|
|
|
|
|
|
|
|
39
|
1
|
50
|
|
|
|
5
|
my ($gateway, $payload) = $self->SUPER::unpack('a4 a*', $self->raw) |
40
|
|
|
|
|
|
|
or return; |
41
|
|
|
|
|
|
|
|
42
|
1
|
|
|
|
|
34
|
$self->gateway(inetNtoa($gateway)); |
43
|
1
|
|
|
|
|
25
|
$self->payload($payload); |
44
|
|
|
|
|
|
|
|
45
|
1
|
|
|
|
|
11
|
return $self; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub encapsulate { |
49
|
1
|
|
|
1
|
1
|
57
|
my $self = shift; |
50
|
|
|
|
|
|
|
|
51
|
1
|
50
|
|
|
|
8
|
return $self->nextLayer if $self->nextLayer; |
52
|
|
|
|
|
|
|
|
53
|
1
|
50
|
|
|
|
18
|
if ($self->payload) { |
54
|
0
|
|
|
|
|
0
|
my $pLen = length($self->payload); |
55
|
0
|
0
|
|
|
|
0
|
if ($pLen < 40) { |
56
|
0
|
|
|
|
|
0
|
$self->payload($self->payload.("\x00" x (40 - $pLen))); |
57
|
|
|
|
|
|
|
} |
58
|
0
|
|
|
|
|
0
|
return 'IPv4'; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
1
|
|
|
|
|
13
|
return NF_LAYER_NONE; |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub print { |
65
|
1
|
|
|
1
|
1
|
6
|
my $self = shift; |
66
|
|
|
|
|
|
|
|
67
|
1
|
|
|
|
|
7
|
my $l = $self->layer; |
68
|
1
|
|
|
|
|
14
|
return sprintf "$l: gateway:%s", $self->gateway; |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
1; |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
__END__ |