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
|
|
5144
|
use strict; |
|
2
|
|
|
|
|
9
|
|
|
2
|
|
|
|
|
48
|
|
6
|
2
|
|
|
2
|
|
8
|
use warnings; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
52
|
|
7
|
|
|
|
|
|
|
|
8
|
2
|
|
|
2
|
|
411
|
use Net::Frame::Layer qw(:consts); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
395
|
|
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
|
|
14
|
use constant NF_SLL_HDR_LEN => 16; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
118
|
|
53
|
2
|
|
|
2
|
|
11
|
use constant NF_SLL_PACKET_TYPE_SENT_BY_US => 4; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
81
|
|
54
|
2
|
|
|
2
|
|
11
|
use constant NF_SLL_PACKET_TYPE_UNICAST_TO_US => 0; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
71
|
|
55
|
2
|
|
|
2
|
|
9
|
use constant NF_SLL_ADDRESS_TYPE_512 => 512; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
72
|
|
56
|
2
|
|
|
2
|
|
10
|
use constant NF_SLL_PROTOCOL_IPv4 => 0x0800; |
|
2
|
|
|
|
|
11
|
|
|
2
|
|
|
|
|
78
|
|
57
|
2
|
|
|
2
|
|
10
|
use constant NF_SLL_PROTOCOL_X25 => 0x0805; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
76
|
|
58
|
2
|
|
|
2
|
|
9
|
use constant NF_SLL_PROTOCOL_ARP => 0x0806; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
79
|
|
59
|
2
|
|
|
2
|
|
10
|
use constant NF_SLL_PROTOCOL_CGMP => 0x2001; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
65
|
|
60
|
2
|
|
|
2
|
|
9
|
use constant NF_SLL_PROTOCOL_80211 => 0x2452; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
81
|
|
61
|
2
|
|
|
2
|
|
10
|
use constant NF_SLL_PROTOCOL_PPPIPCP => 0x8021; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
74
|
|
62
|
2
|
|
|
2
|
|
9
|
use constant NF_SLL_PROTOCOL_RARP => 0x8035; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
63
|
|
63
|
2
|
|
|
2
|
|
8
|
use constant NF_SLL_PROTOCOL_DDP => 0x809b; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
77
|
|
64
|
2
|
|
|
2
|
|
10
|
use constant NF_SLL_PROTOCOL_AARP => 0x80f3; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
65
|
|
65
|
2
|
|
|
2
|
|
8
|
use constant NF_SLL_PROTOCOL_PPPCCP => 0x80fd; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
80
|
|
66
|
2
|
|
|
2
|
|
11
|
use constant NF_SLL_PROTOCOL_WCP => 0x80ff; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
83
|
|
67
|
2
|
|
|
2
|
|
9
|
use constant NF_SLL_PROTOCOL_8021Q => 0x8100; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
71
|
|
68
|
2
|
|
|
2
|
|
10
|
use constant NF_SLL_PROTOCOL_IPX => 0x8137; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
77
|
|
69
|
2
|
|
|
2
|
|
10
|
use constant NF_SLL_PROTOCOL_STP => 0x8181; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
84
|
|
70
|
2
|
|
|
2
|
|
10
|
use constant NF_SLL_PROTOCOL_IPv6 => 0x86dd; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
75
|
|
71
|
2
|
|
|
2
|
|
9
|
use constant NF_SLL_PROTOCOL_WLCCP => 0x872d; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
87
|
|
72
|
2
|
|
|
2
|
|
10
|
use constant NF_SLL_PROTOCOL_MPLS => 0x8847; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
77
|
|
73
|
2
|
|
|
2
|
|
10
|
use constant NF_SLL_PROTOCOL_PPPoED => 0x8863; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
76
|
|
74
|
2
|
|
|
2
|
|
10
|
use constant NF_SLL_PROTOCOL_PPPoES => 0x8864; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
86
|
|
75
|
2
|
|
|
2
|
|
15
|
use constant NF_SLL_PROTOCOL_8021X => 0x888e; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
71
|
|
76
|
2
|
|
|
2
|
|
9
|
use constant NF_SLL_PROTOCOL_AoE => 0x88a2; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
88
|
|
77
|
2
|
|
|
2
|
|
11
|
use constant NF_SLL_PROTOCOL_80211I => 0x88c7; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
80
|
|
78
|
2
|
|
|
2
|
|
11
|
use constant NF_SLL_PROTOCOL_LLDP => 0x88cc; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
77
|
|
79
|
2
|
|
|
2
|
|
11
|
use constant NF_SLL_PROTOCOL_LLTD => 0x88d9; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
78
|
|
80
|
2
|
|
|
2
|
|
11
|
use constant NF_SLL_PROTOCOL_LOOP => 0x9000; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
66
|
|
81
|
2
|
|
|
2
|
|
8
|
use constant NF_SLL_PROTOCOL_VLAN => 0x9100; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
80
|
|
82
|
2
|
|
|
2
|
|
10
|
use constant NF_SLL_PROTOCOL_PPPPAP => 0xc023; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
86
|
|
83
|
2
|
|
|
2
|
|
10
|
use constant NF_SLL_PROTOCOL_PPPCHAP => 0xc223; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
160
|
|
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
|
|
11
|
no strict 'vars'; |
|
2
|
|
|
|
|
27
|
|
|
2
|
|
|
|
|
913
|
|
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
sub new { |
98
|
|
|
|
|
|
|
shift->SUPER::new( |
99
|
1
|
|
|
1
|
1
|
21
|
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
|
249
|
my $self = shift; |
112
|
|
|
|
|
|
|
|
113
|
1
|
50
|
|
|
|
9
|
$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
|
|
|
|
|
3
|
$self->[$__raw]; |
122
|
|
|
|
|
|
|
} |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
sub unpack { |
125
|
1
|
|
|
1
|
1
|
5
|
my $self = shift; |
126
|
|
|
|
|
|
|
|
127
|
1
|
50
|
|
|
|
6
|
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
|
|
|
|
|
2
|
$self->[$__addressLength] = $al; |
134
|
1
|
|
|
|
|
2
|
$self->[$__source] = $s; |
135
|
1
|
|
|
|
|
1
|
$self->[$__protocol] = $p; |
136
|
1
|
|
|
|
|
3
|
$self->[$__payload] = $payload; |
137
|
|
|
|
|
|
|
|
138
|
1
|
|
|
|
|
1
|
$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
|
17
|
my $self = shift; |
174
|
|
|
|
|
|
|
|
175
|
1
|
50
|
|
|
|
5
|
return $self->[$__nextLayer] if $self->[$__nextLayer]; |
176
|
|
|
|
|
|
|
|
177
|
1
|
|
50
|
|
|
10
|
return $Next->{$self->[$__protocol]} || NF_LAYER_UNKNOWN; |
178
|
|
|
|
|
|
|
} |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
sub print { |
181
|
1
|
|
|
1
|
1
|
5
|
my $self = shift; |
182
|
|
|
|
|
|
|
|
183
|
1
|
|
|
|
|
6
|
my $l = $self->layer; |
184
|
1
|
|
|
|
|
4838
|
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__ |