line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# $Id: SLL.pm,v 7609c9d085d3 2018/03/15 15:17:19 gomor $ |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
package Net::Frame::Layer::SLL; |
5
|
2
|
|
|
2
|
|
6586
|
use strict; |
|
2
|
|
|
|
|
13
|
|
|
2
|
|
|
|
|
56
|
|
6
|
2
|
|
|
2
|
|
10
|
use warnings; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
61
|
|
7
|
|
|
|
|
|
|
|
8
|
2
|
|
|
2
|
|
475
|
use Net::Frame::Layer qw(:consts); |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
423
|
|
9
|
|
|
|
|
|
|
require Exporter; |
10
|
|
|
|
|
|
|
our @ISA = qw(Net::Frame::Layer Exporter); |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our %EXPORT_TAGS = ( |
13
|
|
|
|
|
|
|
consts => [qw( |
14
|
|
|
|
|
|
|
NF_SLL_HDR_LEN |
15
|
|
|
|
|
|
|
NF_SLL_PACKET_TYPE_SENT_BY_US |
16
|
|
|
|
|
|
|
NF_SLL_PACKET_TYPE_UNICAST_TO_US |
17
|
|
|
|
|
|
|
NF_SLL_ADDRESS_TYPE_512 |
18
|
|
|
|
|
|
|
NF_SLL_PROTOCOL_IPv4 |
19
|
|
|
|
|
|
|
NF_SLL_PROTOCOL_X25 |
20
|
|
|
|
|
|
|
NF_SLL_PROTOCOL_ARP |
21
|
|
|
|
|
|
|
NF_SLL_PROTOCOL_CGMP |
22
|
|
|
|
|
|
|
NF_SLL_PROTOCOL_80211 |
23
|
|
|
|
|
|
|
NF_SLL_PROTOCOL_PPPIPCP |
24
|
|
|
|
|
|
|
NF_SLL_PROTOCOL_RARP |
25
|
|
|
|
|
|
|
NF_SLL_PROTOCOL_DDP |
26
|
|
|
|
|
|
|
NF_SLL_PROTOCOL_AARP |
27
|
|
|
|
|
|
|
NF_SLL_PROTOCOL_PPPCCP |
28
|
|
|
|
|
|
|
NF_SLL_PROTOCOL_WCP |
29
|
|
|
|
|
|
|
NF_SLL_PROTOCOL_8021Q |
30
|
|
|
|
|
|
|
NF_SLL_PROTOCOL_IPX |
31
|
|
|
|
|
|
|
NF_SLL_PROTOCOL_STP |
32
|
|
|
|
|
|
|
NF_SLL_PROTOCOL_IPv6 |
33
|
|
|
|
|
|
|
NF_SLL_PROTOCOL_WLCCP |
34
|
|
|
|
|
|
|
NF_SLL_PROTOCOL_MPLS |
35
|
|
|
|
|
|
|
NF_SLL_PROTOCOL_PPPoED |
36
|
|
|
|
|
|
|
NF_SLL_PROTOCOL_PPPoES |
37
|
|
|
|
|
|
|
NF_SLL_PROTOCOL_8021X |
38
|
|
|
|
|
|
|
NF_SLL_PROTOCOL_AoE |
39
|
|
|
|
|
|
|
NF_SLL_PROTOCOL_80211I |
40
|
|
|
|
|
|
|
NF_SLL_PROTOCOL_LLDP |
41
|
|
|
|
|
|
|
NF_SLL_PROTOCOL_LLTD |
42
|
|
|
|
|
|
|
NF_SLL_PROTOCOL_LOOP |
43
|
|
|
|
|
|
|
NF_SLL_PROTOCOL_VLAN |
44
|
|
|
|
|
|
|
NF_SLL_PROTOCOL_PPPPAP |
45
|
|
|
|
|
|
|
NF_SLL_PROTOCOL_PPPCHAP |
46
|
|
|
|
|
|
|
)], |
47
|
|
|
|
|
|
|
); |
48
|
|
|
|
|
|
|
our @EXPORT_OK = ( |
49
|
|
|
|
|
|
|
@{$EXPORT_TAGS{consts}}, |
50
|
|
|
|
|
|
|
); |
51
|
|
|
|
|
|
|
|
52
|
2
|
|
|
2
|
|
19
|
use constant NF_SLL_HDR_LEN => 16; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
154
|
|
53
|
2
|
|
|
2
|
|
14
|
use constant NF_SLL_PACKET_TYPE_SENT_BY_US => 4; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
109
|
|
54
|
2
|
|
|
2
|
|
12
|
use constant NF_SLL_PACKET_TYPE_UNICAST_TO_US => 0; |
|
2
|
|
|
|
|
13
|
|
|
2
|
|
|
|
|
113
|
|
55
|
2
|
|
|
2
|
|
13
|
use constant NF_SLL_ADDRESS_TYPE_512 => 512; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
119
|
|
56
|
2
|
|
|
2
|
|
15
|
use constant NF_SLL_PROTOCOL_IPv4 => 0x0800; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
104
|
|
57
|
2
|
|
|
2
|
|
15
|
use constant NF_SLL_PROTOCOL_X25 => 0x0805; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
132
|
|
58
|
2
|
|
|
2
|
|
14
|
use constant NF_SLL_PROTOCOL_ARP => 0x0806; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
110
|
|
59
|
2
|
|
|
2
|
|
16
|
use constant NF_SLL_PROTOCOL_CGMP => 0x2001; |
|
2
|
|
|
|
|
13
|
|
|
2
|
|
|
|
|
111
|
|
60
|
2
|
|
|
2
|
|
15
|
use constant NF_SLL_PROTOCOL_80211 => 0x2452; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
128
|
|
61
|
2
|
|
|
2
|
|
25
|
use constant NF_SLL_PROTOCOL_PPPIPCP => 0x8021; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
107
|
|
62
|
2
|
|
|
2
|
|
13
|
use constant NF_SLL_PROTOCOL_RARP => 0x8035; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
130
|
|
63
|
2
|
|
|
2
|
|
24
|
use constant NF_SLL_PROTOCOL_DDP => 0x809b; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
112
|
|
64
|
2
|
|
|
2
|
|
13
|
use constant NF_SLL_PROTOCOL_AARP => 0x80f3; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
98
|
|
65
|
2
|
|
|
2
|
|
13
|
use constant NF_SLL_PROTOCOL_PPPCCP => 0x80fd; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
110
|
|
66
|
2
|
|
|
2
|
|
12
|
use constant NF_SLL_PROTOCOL_WCP => 0x80ff; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
100
|
|
67
|
2
|
|
|
2
|
|
12
|
use constant NF_SLL_PROTOCOL_8021Q => 0x8100; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
80
|
|
68
|
2
|
|
|
2
|
|
10
|
use constant NF_SLL_PROTOCOL_IPX => 0x8137; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
90
|
|
69
|
2
|
|
|
2
|
|
19
|
use constant NF_SLL_PROTOCOL_STP => 0x8181; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
91
|
|
70
|
2
|
|
|
2
|
|
11
|
use constant NF_SLL_PROTOCOL_IPv6 => 0x86dd; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
98
|
|
71
|
2
|
|
|
2
|
|
19
|
use constant NF_SLL_PROTOCOL_WLCCP => 0x872d; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
105
|
|
72
|
2
|
|
|
2
|
|
12
|
use constant NF_SLL_PROTOCOL_MPLS => 0x8847; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
98
|
|
73
|
2
|
|
|
2
|
|
13
|
use constant NF_SLL_PROTOCOL_PPPoED => 0x8863; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
91
|
|
74
|
2
|
|
|
2
|
|
11
|
use constant NF_SLL_PROTOCOL_PPPoES => 0x8864; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
84
|
|
75
|
2
|
|
|
2
|
|
11
|
use constant NF_SLL_PROTOCOL_8021X => 0x888e; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
94
|
|
76
|
2
|
|
|
2
|
|
11
|
use constant NF_SLL_PROTOCOL_AoE => 0x88a2; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
100
|
|
77
|
2
|
|
|
2
|
|
17
|
use constant NF_SLL_PROTOCOL_80211I => 0x88c7; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
90
|
|
78
|
2
|
|
|
2
|
|
11
|
use constant NF_SLL_PROTOCOL_LLDP => 0x88cc; |
|
2
|
|
|
|
|
10
|
|
|
2
|
|
|
|
|
111
|
|
79
|
2
|
|
|
2
|
|
28
|
use constant NF_SLL_PROTOCOL_LLTD => 0x88d9; |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
131
|
|
80
|
2
|
|
|
2
|
|
14
|
use constant NF_SLL_PROTOCOL_LOOP => 0x9000; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
102
|
|
81
|
2
|
|
|
2
|
|
15
|
use constant NF_SLL_PROTOCOL_VLAN => 0x9100; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
124
|
|
82
|
2
|
|
|
2
|
|
15
|
use constant NF_SLL_PROTOCOL_PPPPAP => 0xc023; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
131
|
|
83
|
2
|
|
|
2
|
|
15
|
use constant NF_SLL_PROTOCOL_PPPCHAP => 0xc223; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
252
|
|
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
our @AS = qw( |
86
|
|
|
|
|
|
|
packetType |
87
|
|
|
|
|
|
|
addressType |
88
|
|
|
|
|
|
|
addressLength |
89
|
|
|
|
|
|
|
source |
90
|
|
|
|
|
|
|
protocol |
91
|
|
|
|
|
|
|
); |
92
|
|
|
|
|
|
|
__PACKAGE__->cgBuildIndices; |
93
|
|
|
|
|
|
|
__PACKAGE__->cgBuildAccessorsScalar(\@AS); |
94
|
|
|
|
|
|
|
|
95
|
2
|
|
|
2
|
|
78
|
no strict 'vars'; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
1353
|
|
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
sub new { |
98
|
|
|
|
|
|
|
shift->SUPER::new( |
99
|
1
|
|
|
1
|
1
|
20
|
packetType => NF_SLL_PACKET_TYPE_SENT_BY_US, |
100
|
|
|
|
|
|
|
addressType => NF_SLL_ADDRESS_TYPE_512, |
101
|
|
|
|
|
|
|
addressLength => 0, |
102
|
|
|
|
|
|
|
source => 0, |
103
|
|
|
|
|
|
|
protocol => NF_SLL_PROTOCOL_IPv4, |
104
|
|
|
|
|
|
|
@_, |
105
|
|
|
|
|
|
|
); |
106
|
|
|
|
|
|
|
} |
107
|
|
|
|
|
|
|
|
108
|
0
|
|
|
0
|
1
|
0
|
sub getLength { NF_SLL_HDR_LEN } |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
sub pack { |
111
|
1
|
|
|
1
|
1
|
287
|
my $self = shift; |
112
|
|
|
|
|
|
|
|
113
|
1
|
50
|
|
|
|
10
|
$self->[$__raw] = $self->SUPER::pack('nnnH16n', |
114
|
|
|
|
|
|
|
$self->[$__packetType], |
115
|
|
|
|
|
|
|
$self->[$__addressType], |
116
|
|
|
|
|
|
|
$self->[$__addressLength], |
117
|
|
|
|
|
|
|
$self->[$__source], |
118
|
|
|
|
|
|
|
$self->[$__protocol], |
119
|
|
|
|
|
|
|
) or return undef; |
120
|
|
|
|
|
|
|
|
121
|
1
|
|
|
|
|
4
|
$self->[$__raw]; |
122
|
|
|
|
|
|
|
} |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
sub unpack { |
125
|
1
|
|
|
1
|
1
|
4
|
my $self = shift; |
126
|
|
|
|
|
|
|
|
127
|
1
|
50
|
|
|
|
8
|
my ($pt, $at, $al, $s, $p, $payload) = |
128
|
|
|
|
|
|
|
$self->SUPER::unpack('nnnH16n a*', $self->[$__raw]) |
129
|
|
|
|
|
|
|
or return undef; |
130
|
|
|
|
|
|
|
|
131
|
1
|
|
|
|
|
2
|
$self->[$__packetType] = $pt; |
132
|
1
|
|
|
|
|
2
|
$self->[$__addressType] = $at; |
133
|
1
|
|
|
|
|
3
|
$self->[$__addressLength] = $al; |
134
|
1
|
|
|
|
|
2
|
$self->[$__source] = $s; |
135
|
1
|
|
|
|
|
2
|
$self->[$__protocol] = $p; |
136
|
1
|
|
|
|
|
2
|
$self->[$__payload] = $payload; |
137
|
|
|
|
|
|
|
|
138
|
1
|
|
|
|
|
2
|
$self; |
139
|
|
|
|
|
|
|
} |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
our $Next = { |
142
|
|
|
|
|
|
|
NF_SLL_PROTOCOL_IPv4() => 'IPv4', |
143
|
|
|
|
|
|
|
NF_SLL_PROTOCOL_X25() => 'X25', |
144
|
|
|
|
|
|
|
NF_SLL_PROTOCOL_ARP() => 'ARP', |
145
|
|
|
|
|
|
|
NF_SLL_PROTOCOL_CGMP() => 'CGMP', |
146
|
|
|
|
|
|
|
NF_SLL_PROTOCOL_80211() => '80211', |
147
|
|
|
|
|
|
|
NF_SLL_PROTOCOL_PPPIPCP() => 'PPPIPCP', |
148
|
|
|
|
|
|
|
NF_SLL_PROTOCOL_RARP() => 'RARP', |
149
|
|
|
|
|
|
|
NF_SLL_PROTOCOL_DDP () => 'DDP', |
150
|
|
|
|
|
|
|
NF_SLL_PROTOCOL_AARP() => 'AARP', |
151
|
|
|
|
|
|
|
NF_SLL_PROTOCOL_PPPCCP() => 'PPPCCP', |
152
|
|
|
|
|
|
|
NF_SLL_PROTOCOL_WCP() => 'WCP', |
153
|
|
|
|
|
|
|
NF_SLL_PROTOCOL_8021Q() => '8021Q', |
154
|
|
|
|
|
|
|
NF_SLL_PROTOCOL_IPX() => 'IPX', |
155
|
|
|
|
|
|
|
NF_SLL_PROTOCOL_STP() => 'STP', |
156
|
|
|
|
|
|
|
NF_SLL_PROTOCOL_IPv6() => 'IPv6', |
157
|
|
|
|
|
|
|
NF_SLL_PROTOCOL_WLCCP() => 'WLCCP', |
158
|
|
|
|
|
|
|
NF_SLL_PROTOCOL_MPLS() => 'MPLS', |
159
|
|
|
|
|
|
|
NF_SLL_PROTOCOL_PPPoED() => 'PPPoED', |
160
|
|
|
|
|
|
|
NF_SLL_PROTOCOL_PPPoES() => 'PPPoES', |
161
|
|
|
|
|
|
|
NF_SLL_PROTOCOL_8021X() => '8021X', |
162
|
|
|
|
|
|
|
NF_SLL_PROTOCOL_AoE() => 'AoE', |
163
|
|
|
|
|
|
|
NF_SLL_PROTOCOL_80211I() => '80211I', |
164
|
|
|
|
|
|
|
NF_SLL_PROTOCOL_LLDP() => 'LLDP', |
165
|
|
|
|
|
|
|
NF_SLL_PROTOCOL_LLTD() => 'LLTD', |
166
|
|
|
|
|
|
|
NF_SLL_PROTOCOL_LOOP() => 'LOOP', |
167
|
|
|
|
|
|
|
NF_SLL_PROTOCOL_VLAN() => 'VLAN', |
168
|
|
|
|
|
|
|
NF_SLL_PROTOCOL_PPPPAP() => 'PPPPAP', |
169
|
|
|
|
|
|
|
NF_SLL_PROTOCOL_PPPCHAP() => 'PPPCHAP', |
170
|
|
|
|
|
|
|
}; |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
sub encapsulate { |
173
|
1
|
|
|
1
|
1
|
8
|
my $self = shift; |
174
|
|
|
|
|
|
|
|
175
|
1
|
50
|
|
|
|
4
|
return $self->[$__nextLayer] if $self->[$__nextLayer]; |
176
|
|
|
|
|
|
|
|
177
|
1
|
|
50
|
|
|
6
|
return $Next->{$self->[$__protocol]} || NF_LAYER_UNKNOWN; |
178
|
|
|
|
|
|
|
} |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
sub print { |
181
|
1
|
|
|
1
|
1
|
5
|
my $self = shift; |
182
|
|
|
|
|
|
|
|
183
|
1
|
|
|
|
|
5
|
my $l = $self->layer; |
184
|
1
|
|
|
|
|
46
|
sprintf "$l: packetType:0x%04x addressType:0x%04x ". |
185
|
|
|
|
|
|
|
"addressLength:0x%04x\n". |
186
|
|
|
|
|
|
|
"$l: source:%d protocol:0x%04x", |
187
|
|
|
|
|
|
|
$self->[$__packetType], $self->[$__addressType], |
188
|
|
|
|
|
|
|
$self->[$__addressLength], $self->[$__source], $self->[$__protocol]; |
189
|
|
|
|
|
|
|
} |
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
1; |
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
__END__ |