File tree Expand file tree Collapse file tree 3 files changed +20
-17
lines changed
Expand file tree Collapse file tree 3 files changed +20
-17
lines changed Original file line number Diff line number Diff line change 1919 along with systemd; If not, see <http://www.gnu.org/licenses/>.
2020***/
2121
22+ #include <sys/socket.h>
23+
2224#include "dns-type.h"
2325#include "string-util.h"
2426
@@ -183,6 +185,23 @@ bool dns_type_is_obsolete(uint16_t type) {
183185 DNS_TYPE_NULL );
184186}
185187
188+ int dns_type_to_af (uint16_t t ) {
189+ switch (t ) {
190+
191+ case DNS_TYPE_A :
192+ return AF_INET ;
193+
194+ case DNS_TYPE_AAAA :
195+ return AF_INET6 ;
196+
197+ case DNS_TYPE_ANY :
198+ return AF_UNSPEC ;
199+
200+ default :
201+ return - EINVAL ;
202+ }
203+ }
204+
186205const char * dns_class_to_string (uint16_t class ) {
187206
188207 switch (class ) {
Original file line number Diff line number Diff line change @@ -133,6 +133,7 @@ bool dns_type_is_dnssec(uint16_t type);
133133bool dns_type_is_obsolete (uint16_t type );
134134bool dns_type_may_wildcard (uint16_t type );
135135bool dns_type_apex_only (uint16_t type );
136+ int dns_type_to_af (uint16_t t );
136137
137138bool dns_class_is_pseudo (uint16_t class );
138139bool dns_class_is_valid_rr (uint16_t class );
Original file line number Diff line number Diff line change @@ -595,23 +595,6 @@ static DnsProtocol SYNTHESIZE_PROTOCOL(uint64_t flags) {
595595 return DNS_PROTOCOL_DNS ;
596596}
597597
598- static int dns_type_to_af (uint16_t t ) {
599- switch (t ) {
600-
601- case DNS_TYPE_A :
602- return AF_INET ;
603-
604- case DNS_TYPE_AAAA :
605- return AF_INET6 ;
606-
607- case DNS_TYPE_ANY :
608- return AF_UNSPEC ;
609-
610- default :
611- return - EINVAL ;
612- }
613- }
614-
615598static int synthesize_localhost_rr (DnsQuery * q , const DnsResourceKey * key , DnsAnswer * * answer ) {
616599 int r ;
617600
You can’t perform that action at this time.
0 commit comments