1Net::DNS::RR::OPT(3) User Contributed Perl Documentation Net::DNS::RR::OPT(3)
2
3
4
6 Net::DNS::RR::OPT - DNS OPT resource record
7
9 use Net::DNS;
10 $packet = Net::DNS::Packet->new( ... );
11
12 $packet->header->do(1); # extended flag
13
14 $packet->edns->size(1280); # UDP payload size
15
16 $packet->edns->option( COOKIE => 'rawbytes' );
17
18 $packet->edns->print;
19
20 ;; EDNS version 0
21 ;; flags: 8000
22 ;; rcode: NOERROR
23 ;; size: 1280
24 ;; option: COOKIE => ( 7261776279746573 )
25 ;; DAU => ( 8, 10, 13, 14, 15, 16 )
26 ;; DHU => ( 1, 2, 4 )
27 ;; EXTENDED-ERROR => ( INFO-CODE => 123, EXTRA-TEXT => )
28
30 EDNS OPT pseudo resource record.
31
32 The OPT record supports EDNS protocol extensions and is not intended to
33 be created, accessed or modified directly by user applications.
34
35 All EDNS features are performed indirectly by operations on the objects
36 returned by the $packet->header and $packet->edns creator methods. The
37 underlying mechanisms are entirely hidden from the user.
38
40 The available methods are those inherited from the base class augmented
41 by the type-specific methods defined in this package.
42
43 Use of undocumented package features or direct access to internal data
44 structures is discouraged and could result in program termination or
45 other unpredictable behaviour.
46
47 version
48 $version = $rr->version;
49 $rr->version( $version );
50
51 The version of EDNS supported by this OPT record.
52
53 size
54 $size = $packet->edns->size;
55 $more = $packet->edns->size(1280);
56
57 size() advertises the maximum size (octets) of UDP packet that can be
58 reassembled in the network stack of the originating host.
59
60 rcode
61 $extended_rcode = $packet->header->rcode;
62 $incomplete_rcode = $packet->edns->rcode;
63
64 The 12 bit extended RCODE. The most significant 8 bits reside in the
65 OPT record. The least significant 4 bits can only be obtained from the
66 packet header.
67
68 flags
69 $edns_flags = $packet->edns->flags;
70
71 $do = $packet->header->do;
72 $packet->header->do(1);
73
74 16 bit field containing EDNS extended header flags.
75
76 options, option
77 @option = $packet->edns->options;
78
79 $octets = $packet->edns->option($option_code);
80
81 $packet->edns->option( COOKIE => $octets );
82 $packet->edns->option( 10 => $octets );
83
84 When called in a list context, options() returns a list of option codes
85 found in the OPT record.
86
87 When called in a scalar context with a single argument, option()
88 returns the uninterpreted octet string corresponding to the specified
89 option. The method returns undef if the specified option is absent.
90
91 Options can be added or replaced by providing the (name => value) pair.
92 The option is deleted if the value is undefined.
93
94 When option() is called in a list context with a single argument, the
95 returned values provide a structured interpretation appropriate to the
96 specified option.
97
98 For example:
99
100 @algorithms = $packet->edns->option('DAU');
101
102 For some options, a hash table is more convenient:
103
104 %hash_table = $packet->edns->option(15);
105 $info_code = $hash_table{'INFO-CODE'};
106 $extra_text = $hash_table{'EXTRA-TEXT'};
107
108 Similar forms of array or hash syntax may be used to construct the
109 option value:
110
111 $packet->edns->option( DHU => [1, 2, 4] );
112
113 $packet->edns->option( EXPIRE => {'EXPIRE-TIMER' => 604800} );
114
116 Copyright (c)2001,2002 RIPE NCC. Author Olaf M. Kolkman.
117
118 Portions Copyright (c)2012,2017-2022 Dick Franks.
119
120 All rights reserved.
121
122 Package template (c)2009,2012 O.M.Kolkman and R.W.Franks.
123
125 Permission to use, copy, modify, and distribute this software and its
126 documentation for any purpose and without fee is hereby granted,
127 provided that the original copyright notices appear in all copies and
128 that both copyright notice and this permission notice appear in
129 supporting documentation, and that the name of the author not be used
130 in advertising or publicity pertaining to distribution of the software
131 without specific prior written permission.
132
133 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
134 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
135 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
136 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
137 CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
138 TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
139 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
140
142 perl, Net::DNS, Net::DNS::RR, RFC6891, RFC3225
143
144
145
146perl v5.36.0 2022-07-22 Net::DNS::RR::OPT(3)