| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Net::DNS::Update; |
|
2
|
|
|
|
|
|
|
|
|
3
|
84
|
|
|
84
|
|
1203
|
use strict; |
|
|
84
|
|
|
|
|
630
|
|
|
|
84
|
|
|
|
|
5448
|
|
|
4
|
84
|
|
|
84
|
|
797
|
use warnings; |
|
|
84
|
|
|
|
|
404
|
|
|
|
84
|
|
|
|
|
9529
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = (qw$Id: Update.pm 1895 2023-01-16 13:38:08Z willem $)[2]; |
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 NAME |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
Net::DNS::Update - DNS dynamic update packet |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
use Net::DNS; |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
$update = Net::DNS::Update->new( 'example.com', 'IN' ); |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
$update->push( prereq => nxrrset('host.example.com. AAAA') ); |
|
20
|
|
|
|
|
|
|
$update->push( update => rr_add('host.example.com. 86400 AAAA 2001::DB8::F00') ); |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
Net::DNS::Update is a subclass of Net::DNS::Packet, to be used for |
|
25
|
|
|
|
|
|
|
making DNS dynamic updates. |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
Programmers should refer to RFC2136 for dynamic update semantics. |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=cut |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
|
|
32
|
84
|
|
|
84
|
|
847
|
use integer; |
|
|
84
|
|
|
|
|
708
|
|
|
|
84
|
|
|
|
|
1324
|
|
|
33
|
84
|
|
|
84
|
|
3381
|
use Carp; |
|
|
84
|
|
|
|
|
375
|
|
|
|
84
|
|
|
|
|
13341
|
|
|
34
|
|
|
|
|
|
|
|
|
35
|
84
|
|
|
84
|
|
865
|
use base qw(Net::DNS::Packet); |
|
|
84
|
|
|
|
|
428
|
|
|
|
84
|
|
|
|
|
22139
|
|
|
36
|
|
|
|
|
|
|
|
|
37
|
84
|
|
|
84
|
|
809
|
use Net::DNS::Resolver; |
|
|
84
|
|
|
|
|
311
|
|
|
|
84
|
|
|
|
|
45885
|
|
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=head1 METHODS |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=head2 new |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
$update = Net::DNS::Update->new; |
|
45
|
|
|
|
|
|
|
$update = Net::DNS::Update->new( 'example.com' ); |
|
46
|
|
|
|
|
|
|
$update = Net::DNS::Update->new( 'example.com', 'IN' ); |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
Returns a Net::DNS::Update object suitable for performing a DNS |
|
49
|
|
|
|
|
|
|
dynamic update. Specifically, it creates a packet with the header |
|
50
|
|
|
|
|
|
|
opcode set to UPDATE and the zone record type to SOA (per RFC 2136, |
|
51
|
|
|
|
|
|
|
Section 2.3). |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
Programs must use the push() method to add RRs to the prerequisite |
|
54
|
|
|
|
|
|
|
and update sections before performing the update. |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
Arguments are the zone name and the class. The zone and class may |
|
57
|
|
|
|
|
|
|
be undefined or omitted and default to the default domain from the |
|
58
|
|
|
|
|
|
|
resolver configuration and IN respectively. |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=cut |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub new { |
|
63
|
47
|
|
|
47
|
1
|
25284
|
my ( $class, $zone, @rrclass ) = @_; |
|
64
|
|
|
|
|
|
|
|
|
65
|
47
|
100
|
|
|
|
182
|
my ($domain) = grep { defined && length } ( $zone, Net::DNS::Resolver->searchlist ); |
|
|
52
|
|
|
|
|
256
|
|
|
66
|
|
|
|
|
|
|
|
|
67
|
47
|
|
|
|
|
186
|
my $self = __PACKAGE__->SUPER::new( $domain, 'SOA', @rrclass ); |
|
68
|
|
|
|
|
|
|
|
|
69
|
47
|
|
|
|
|
126
|
my $header = $self->header; |
|
70
|
47
|
|
|
|
|
168
|
$header->opcode('UPDATE'); |
|
71
|
47
|
|
|
|
|
161
|
$header->qr(0); |
|
72
|
47
|
|
|
|
|
124
|
$header->rd(0); |
|
73
|
|
|
|
|
|
|
|
|
74
|
47
|
|
|
|
|
138
|
return $self; |
|
75
|
|
|
|
|
|
|
} |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head2 push |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
$ancount = $update->push( prereq => $rr ); |
|
81
|
|
|
|
|
|
|
$nscount = $update->push( update => $rr ); |
|
82
|
|
|
|
|
|
|
$arcount = $update->push( additional => $rr ); |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
$nscount = $update->push( update => $rr1, $rr2, $rr3 ); |
|
85
|
|
|
|
|
|
|
$nscount = $update->push( update => @rr ); |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
Adds RRs to the specified section of the update packet. |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
Returns the number of resource records in the specified section. |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
Section names may be abbreviated to the first three characters. |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=cut |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
sub push { |
|
96
|
4
|
|
|
4
|
1
|
10
|
my ( $self, $section, @rr ) = @_; |
|
97
|
4
|
|
|
|
|
12
|
my ($zone) = $self->zone; |
|
98
|
4
|
|
|
|
|
10
|
my $zclass = $zone->zclass; |
|
99
|
4
|
100
|
|
|
|
13
|
for (@rr) { $_->class( $_->class =~ /ANY|NONE/ ? () : $zclass ) } |
|
|
4
|
|
|
|
|
11
|
|
|
100
|
4
|
|
|
|
|
22
|
return $self->SUPER::push( $section, @rr ); |
|
101
|
|
|
|
|
|
|
} |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=head2 unique_push |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
$ancount = $update->unique_push( prereq => $rr ); |
|
107
|
|
|
|
|
|
|
$nscount = $update->unique_push( update => $rr ); |
|
108
|
|
|
|
|
|
|
$arcount = $update->unique_push( additional => $rr ); |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
$nscount = $update->unique_push( update => $rr1, $rr2, $rr3 ); |
|
111
|
|
|
|
|
|
|
$nscount = $update->unique_push( update => @rr ); |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
Adds RRs to the specified section of the update packet provided |
|
114
|
|
|
|
|
|
|
that the RRs are not already present in the same section. |
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
Returns the number of resource records in the specified section. |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
Section names may be abbreviated to the first three characters. |
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=cut |
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
sub unique_push { |
|
123
|
91
|
|
|
91
|
1
|
413
|
my ( $self, $section, @rr ) = @_; |
|
124
|
91
|
|
|
|
|
188
|
my ($zone) = $self->zone; |
|
125
|
91
|
|
|
|
|
193
|
my $zclass = $zone->zclass; |
|
126
|
91
|
100
|
|
|
|
156
|
for (@rr) { $_->class( $_->class =~ /ANY|NONE/ ? () : $zclass ) } |
|
|
136
|
|
|
|
|
281
|
|
|
127
|
91
|
|
|
|
|
243
|
return $self->SUPER::unique_push( $section, @rr ); |
|
128
|
|
|
|
|
|
|
} |
|
129
|
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
1; |
|
132
|
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
__END__ |