1Net::DNS::RR::OPT(3)  User Contributed Perl Documentation Net::DNS::RR::OPT(3)
2
3
4

NAME

6       Net::DNS::RR::OPT - DNS OPT resource record
7

SYNOPSIS

9           use Net::DNS;
10           my $packet = Net::DNS::Packet->new( ... );
11
12           $packet->header->do(1);             # extended header flag
13
14           $packet->edns->UDPsize(1232);       # UDP payload size
15
16           $packet->edns->option( 'NSID'           => {'OPTION-DATA' => 'rawbytes'} );
17           $packet->edns->option( 'DAU'            => [8, 10, 13, 14, 15, 16] );
18           $packet->edns->option( 'TCP-KEEPALIVE'  => 200 );
19           $packet->edns->option( 'EXTENDED-ERROR' => {'INFO-CODE' => 123} );
20           $packet->edns->option( '65023'          => {'BASE16' => '076578616d706c6500'} );
21
22           $packet->edns->print;
23
24               ;; {    "EDNS-VERSION": 0,
25               ;;      "FLAGS":        "8000",
26               ;;      "RCODE":        0,
27               ;;      "UDPSIZE":      1232,
28               ;;      "OPTIONS":      [
29               ;;              {"NSID": "7261776279746573"},
30               ;;              {"DAU": [ 8, 10, 13, 14, 15, 16 ]},
31               ;;              {"TCP-KEEPALIVE": {"TIMEOUT": 200}},
32               ;;              {"EXTENDED-ERROR": {"INFO-CODE": 123, "EXTRA-TEXT": ""}},
33               ;;              {"65023": {"BASE16": "076578616d706c6500"}} ]
34               ;;      }
35

DESCRIPTION

37       EDNS OPT pseudo resource record.
38
39       The OPT record supports EDNS protocol extensions and is not intended to
40       be created, accessed or modified directly by user applications.
41
42       All EDNS features are performed indirectly by operations on the objects
43       returned by the $packet->header and $packet->edns creator methods.  The
44       underlying mechanisms are, or should be, entirely hidden from the user.
45

METHODS

47       The available methods are those inherited from the base class augmented
48       by the type-specific methods defined in this package.
49
50       Use of undocumented package features or direct access to internal data
51       structures is discouraged and could result in program termination or
52       other unpredictable behaviour.
53
54   version
55               $version = $packet->edns->version;
56
57       The version of EDNS supported by this OPT record.
58
59   UDPsize
60               $size = $packet->edns->UDPsize;
61               $packet->edns->UDPsize($size);
62
63       UDPsize() advertises the maximum size (octets) of UDP packet that can
64       be reassembled in the network stack of the originating host.
65
66   rcode
67               $extended_rcode   = $packet->header->rcode;
68
69       The 12 bit extended RCODE. The most significant 8 bits are obtained
70       from the OPT record. The least significant 4 bits reside in the packet
71       header.
72
73   flags
74               $do = $packet->header->do;
75               $packet->header->do(1);
76
77               $edns_flags = $packet->edns->flags;
78
79       16 bit field containing EDNS extended header flags.
80
81   options, option
82               my @option = $packet->edns->options;
83
84       When called in a list context, options() returns a list of option codes
85       found in the OPT record.
86
87               my $octets = $packet->edns->option('COOKIE');
88               my $base16 = unpack 'H*', $octets;
89
90               $packet->edns->option( 'COOKIE' => {'OPTION-DATA' => $octets} );
91               $packet->edns->option( '10'     => {'BASE16'      => $base16} );
92
93       When called in a scalar context with a single argument, option()
94       returns the uninterpreted octet string corresponding to the specified
95       option.  The method returns undef if the option is absent.
96
97       Options can be added or replaced by providing the (name => value) pair.
98       The option is deleted if the value is undefined.
99
100       When called in a list context with a single argument, option() returns
101       a structured representation of the option value.
102
103       For example:
104
105               my ($structure) = $packet->edns->option('DAU');
106               my @algorithms  = @$structure;
107
108               my ($structure) = $packet->edns->option(15);
109               my $info_code   = $$structure{'INFO-CODE'};
110               my $extra_text  = $$structure{'EXTRA-TEXT'};
111
112       Similar forms of array or hash syntax may be used to construct the
113       option value:
114
115               $packet->edns->option( 'DAU' => [8, 10, 13, 14, 15, 16] );
116
117               $packet->edns->option( 'EXTENDED-ERROR' => {'INFO-CODE'  => 123,
118                                                           'EXTRA-TEXT' => ""} );
119
121       Copyright (c)2001,2002 RIPE NCC.  Author Olaf M. Kolkman.
122
123       Portions Copyright (c)2012,2017-2023 Dick Franks.
124
125       All rights reserved.
126
127       Package template (c)2009,2012 O.M.Kolkman and R.W.Franks.
128

LICENSE

130       Permission to use, copy, modify, and distribute this software and its
131       documentation for any purpose and without fee is hereby granted,
132       provided that the original copyright notices appear in all copies and
133       that both copyright notice and this permission notice appear in
134       supporting documentation, and that the name of the author not be used
135       in advertising or publicity pertaining to distribution of the software
136       without specific prior written permission.
137
138       THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
139       OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
140       MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
141       IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
142       CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
143       TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
144       SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
145

SEE ALSO

147       perl Net::DNS Net::DNS::RR RFC6891
148       <https://tools.ietf.org/html/rfc6891> RFC3225
149       <https://tools.ietf.org/html/rfc3225>
150
151
152
153perl v5.36.1                      2023-06-01              Net::DNS::RR::OPT(3)
Impressum