| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Net::ISC::DHCPd::Config::Subnet; |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=head1 NAME |
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
Net::ISC::DHCPd::Config::Subnet - Subnet config parameter |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
See L<Net::ISC::DHCPd::Config::Role> for methods and attributes without |
|
10
|
|
|
|
|
|
|
documentation. |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
An instance from this class, comes from / will produce: |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
subnet $address_attribute_value \ |
|
15
|
|
|
|
|
|
|
netmask $address_attribute_value { |
|
16
|
|
|
|
|
|
|
$options_attribute_value |
|
17
|
|
|
|
|
|
|
$filename_attribute_value |
|
18
|
|
|
|
|
|
|
$range_attribute_value |
|
19
|
|
|
|
|
|
|
$pool_attribute_value |
|
20
|
|
|
|
|
|
|
$hosts_attribute_value |
|
21
|
|
|
|
|
|
|
} |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
See L<Net::ISC::DHCPd::Config/SYNOPSIS>. |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=cut |
|
28
|
|
|
|
|
|
|
|
|
29
|
24
|
|
|
24
|
|
21684
|
use Moose; |
|
|
24
|
|
|
|
|
61
|
|
|
|
24
|
|
|
|
|
211
|
|
|
30
|
24
|
|
|
24
|
|
203463
|
use NetAddr::IP; |
|
|
24
|
|
|
|
|
791172
|
|
|
|
24
|
|
|
|
|
149
|
|
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
with 'Net::ISC::DHCPd::Config::Role'; |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=head2 children |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
See L<Net::ISC::DHCPd::Config/children>. |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=cut |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub children { |
|
41
|
76
|
|
|
76
|
1
|
650
|
return qw/ |
|
42
|
|
|
|
|
|
|
Net::ISC::DHCPd::Config::Host |
|
43
|
|
|
|
|
|
|
Net::ISC::DHCPd::Config::Pool |
|
44
|
|
|
|
|
|
|
Net::ISC::DHCPd::Config::Range |
|
45
|
|
|
|
|
|
|
Net::ISC::DHCPd::Config::Filename |
|
46
|
|
|
|
|
|
|
Net::ISC::DHCPd::Config::Option |
|
47
|
|
|
|
|
|
|
Net::ISC::DHCPd::Config::KeyValue |
|
48
|
|
|
|
|
|
|
Net::ISC::DHCPd::Config::Block |
|
49
|
|
|
|
|
|
|
/; |
|
50
|
|
|
|
|
|
|
} |
|
51
|
|
|
|
|
|
|
__PACKAGE__->create_children(__PACKAGE__->children()); |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head2 options |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
A list of parsed L<Net::ISC::DHCPd::Config::Option> objects. |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head2 ranges |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
A list of parsed L<Net::ISC::DHCPd::Config::Range> objects. |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head2 hosts |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
A list of parsed L<Net::ISC::DHCPd::Config::Host> objects. |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head2 filenames |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
A list of parsed L<Net::ISC::DHCPd::Config::Filename> objects. There can |
|
70
|
|
|
|
|
|
|
be only be one node in this list. |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=cut |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
before add_filename => sub { |
|
75
|
|
|
|
|
|
|
if(0 < int @{ $_[0]->filenames }) { |
|
76
|
|
|
|
|
|
|
confess 'Subnet cannot have more than one filename'; |
|
77
|
|
|
|
|
|
|
} |
|
78
|
|
|
|
|
|
|
}; |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head2 pools |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
A list of parsed L<Net::ISC::DHCPd::Config::Pool> objects. |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=head2 address |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
This attribute holds an instance of L<NetAddr::IP>, and represents |
|
87
|
|
|
|
|
|
|
the ip address of this subnet. |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=cut |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
has address => ( |
|
92
|
|
|
|
|
|
|
is => 'ro', |
|
93
|
|
|
|
|
|
|
isa => 'NetAddr::IP', |
|
94
|
|
|
|
|
|
|
); |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=head2 regex |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
See L<Net::ISC::DHCPd::Config/regex>. |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=cut |
|
101
|
|
|
|
|
|
|
|
|
102
|
129
|
|
|
129
|
1
|
1039
|
sub regex { qr{^ \s* subnet \s+ (\S+) \s+ netmask \s+ (\S+) }x } |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=head1 METHODS |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=head2 captured_to_args |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
See L<Net::ISC::DHCPd::Config::Role/captured_to_args>. |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=cut |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
sub captured_to_args { |
|
113
|
14
|
|
|
14
|
1
|
201
|
return { address => NetAddr::IP->new(join "/", @_) }; |
|
114
|
|
|
|
|
|
|
} |
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=head2 generate |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
See L<Net::ISC::DHCPd::Config::Role/generate>. |
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=cut |
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
sub generate { |
|
123
|
3
|
|
|
3
|
1
|
6
|
my $self = shift; |
|
124
|
3
|
|
|
|
|
116
|
my $net = $self->address; |
|
125
|
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
return( |
|
127
|
3
|
|
|
|
|
58
|
'subnet ' .$net->addr .' netmask ' .$net->mask .' {', |
|
128
|
|
|
|
|
|
|
$self->_generate_config_from_children, |
|
129
|
|
|
|
|
|
|
'}', |
|
130
|
|
|
|
|
|
|
); |
|
131
|
|
|
|
|
|
|
} |
|
132
|
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
|
134
|
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=head1 AUTHOR |
|
136
|
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
See L<Net::ISC::DHCPd>. |
|
138
|
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
=cut |
|
140
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
|
141
|
|
|
|
|
|
|
1; |