1 /* SPDX-License-Identifier: GPL-2.0+ WITH Linu 1 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ 2 /* DNS resolver interface definitions. 2 /* DNS resolver interface definitions. 3 * 3 * 4 * Copyright (C) 2018 Red Hat, Inc. All Rights 4 * Copyright (C) 2018 Red Hat, Inc. All Rights Reserved. 5 * Written by David Howells (dhowells@redhat.c 5 * Written by David Howells (dhowells@redhat.com) 6 * 6 * 7 * This program is free software; you can redi 7 * This program is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU Genera 8 * modify it under the terms of the GNU General Public Licence 9 * as published by the Free Software Foundatio 9 * as published by the Free Software Foundation; either version 10 * 2 of the Licence, or (at your option) any l 10 * 2 of the Licence, or (at your option) any later version. 11 */ 11 */ 12 12 13 #ifndef _UAPI_LINUX_DNS_RESOLVER_H 13 #ifndef _UAPI_LINUX_DNS_RESOLVER_H 14 #define _UAPI_LINUX_DNS_RESOLVER_H 14 #define _UAPI_LINUX_DNS_RESOLVER_H 15 15 16 #include <linux/types.h> 16 #include <linux/types.h> 17 17 18 /* 18 /* 19 * Type of payload. 19 * Type of payload. 20 */ 20 */ 21 enum dns_payload_content_type { 21 enum dns_payload_content_type { 22 DNS_PAYLOAD_IS_SERVER_LIST = 0, / 22 DNS_PAYLOAD_IS_SERVER_LIST = 0, /* List of servers, requested by srv=1 */ 23 }; 23 }; 24 24 25 /* 25 /* 26 * Type of address that might be found in an a 26 * Type of address that might be found in an address record. 27 */ 27 */ 28 enum dns_payload_address_type { 28 enum dns_payload_address_type { 29 DNS_ADDRESS_IS_IPV4 = 0, / 29 DNS_ADDRESS_IS_IPV4 = 0, /* 4-byte AF_INET address */ 30 DNS_ADDRESS_IS_IPV6 = 1, / 30 DNS_ADDRESS_IS_IPV6 = 1, /* 16-byte AF_INET6 address */ 31 }; 31 }; 32 32 33 /* 33 /* 34 * Type of protocol used to access a server. 34 * Type of protocol used to access a server. 35 */ 35 */ 36 enum dns_payload_protocol_type { 36 enum dns_payload_protocol_type { 37 DNS_SERVER_PROTOCOL_UNSPECIFIED = 0, 37 DNS_SERVER_PROTOCOL_UNSPECIFIED = 0, 38 DNS_SERVER_PROTOCOL_UDP = 1, / 38 DNS_SERVER_PROTOCOL_UDP = 1, /* Use UDP to talk to the server */ 39 DNS_SERVER_PROTOCOL_TCP = 2, / 39 DNS_SERVER_PROTOCOL_TCP = 2, /* Use TCP to talk to the server */ 40 }; 40 }; 41 41 42 /* 42 /* 43 * Source of record included in DNS resolver p 43 * Source of record included in DNS resolver payload. 44 */ 44 */ 45 enum dns_record_source { 45 enum dns_record_source { 46 DNS_RECORD_UNAVAILABLE = 0, / 46 DNS_RECORD_UNAVAILABLE = 0, /* No source available (empty record) */ 47 DNS_RECORD_FROM_CONFIG = 1, / 47 DNS_RECORD_FROM_CONFIG = 1, /* From local configuration data */ 48 DNS_RECORD_FROM_DNS_A = 2, / 48 DNS_RECORD_FROM_DNS_A = 2, /* From DNS A or AAAA record */ 49 DNS_RECORD_FROM_DNS_AFSDB = 3, / 49 DNS_RECORD_FROM_DNS_AFSDB = 3, /* From DNS AFSDB record */ 50 DNS_RECORD_FROM_DNS_SRV = 4, / 50 DNS_RECORD_FROM_DNS_SRV = 4, /* From DNS SRV record */ 51 DNS_RECORD_FROM_NSS = 5, / 51 DNS_RECORD_FROM_NSS = 5, /* From NSS */ 52 NR__dns_record_source 52 NR__dns_record_source 53 }; 53 }; 54 54 55 /* 55 /* 56 * Status of record included in DNS resolver p 56 * Status of record included in DNS resolver payload. 57 */ 57 */ 58 enum dns_lookup_status { 58 enum dns_lookup_status { 59 DNS_LOOKUP_NOT_DONE = 0, / 59 DNS_LOOKUP_NOT_DONE = 0, /* No lookup has been made */ 60 DNS_LOOKUP_GOOD = 1, / 60 DNS_LOOKUP_GOOD = 1, /* Good records obtained */ 61 DNS_LOOKUP_GOOD_WITH_BAD = 2, / 61 DNS_LOOKUP_GOOD_WITH_BAD = 2, /* Good records, some decoding errors */ 62 DNS_LOOKUP_BAD = 3, / 62 DNS_LOOKUP_BAD = 3, /* Couldn't decode results */ 63 DNS_LOOKUP_GOT_NOT_FOUND = 4, / 63 DNS_LOOKUP_GOT_NOT_FOUND = 4, /* Got a "Not Found" result */ 64 DNS_LOOKUP_GOT_LOCAL_FAILURE = 5, / 64 DNS_LOOKUP_GOT_LOCAL_FAILURE = 5, /* Local failure during lookup */ 65 DNS_LOOKUP_GOT_TEMP_FAILURE = 6, / 65 DNS_LOOKUP_GOT_TEMP_FAILURE = 6, /* Temporary failure during lookup */ 66 DNS_LOOKUP_GOT_NS_FAILURE = 7, / 66 DNS_LOOKUP_GOT_NS_FAILURE = 7, /* Name server failure */ 67 NR__dns_lookup_status 67 NR__dns_lookup_status 68 }; 68 }; 69 69 70 /* 70 /* 71 * Header at the beginning of binary format pa 71 * Header at the beginning of binary format payload. 72 */ 72 */ 73 struct dns_payload_header { 73 struct dns_payload_header { 74 __u8 zero; /* Zer 74 __u8 zero; /* Zero byte: marks this as not being text */ 75 __u8 content; /* enu 75 __u8 content; /* enum dns_payload_content_type */ 76 __u8 version; /* Enc 76 __u8 version; /* Encoding version */ 77 } __packed; 77 } __packed; 78 78 79 /* 79 /* 80 * Header at the beginning of a V1 server list 80 * Header at the beginning of a V1 server list. This is followed directly by 81 * the server records. Each server records be 81 * the server records. Each server records begins with a struct of type 82 * dns_server_list_v1_server. 82 * dns_server_list_v1_server. 83 */ 83 */ 84 struct dns_server_list_v1_header { 84 struct dns_server_list_v1_header { 85 struct dns_payload_header hdr; 85 struct dns_payload_header hdr; 86 __u8 source; /* enu 86 __u8 source; /* enum dns_record_source */ 87 __u8 status; /* enu 87 __u8 status; /* enum dns_lookup_status */ 88 __u8 nr_servers; /* Num 88 __u8 nr_servers; /* Number of server records following this */ 89 } __packed; 89 } __packed; 90 90 91 /* 91 /* 92 * Header at the beginning of each V1 server r 92 * Header at the beginning of each V1 server record. This is followed by the 93 * characters of the name with no NUL-terminat 93 * characters of the name with no NUL-terminator, followed by the address 94 * records for that server. Each address reco 94 * records for that server. Each address record begins with a struct of type 95 * struct dns_server_list_v1_address. 95 * struct dns_server_list_v1_address. 96 */ 96 */ 97 struct dns_server_list_v1_server { 97 struct dns_server_list_v1_server { 98 __u16 name_len; /* Len 98 __u16 name_len; /* Length of name (LE) */ 99 __u16 priority; /* Pri 99 __u16 priority; /* Priority (as SRV record) (LE) */ 100 __u16 weight; /* Wei 100 __u16 weight; /* Weight (as SRV record) (LE) */ 101 __u16 port; /* UDP 101 __u16 port; /* UDP/TCP port number (LE) */ 102 __u8 source; /* enu 102 __u8 source; /* enum dns_record_source */ 103 __u8 status; /* enu 103 __u8 status; /* enum dns_lookup_status */ 104 __u8 protocol; /* enu 104 __u8 protocol; /* enum dns_payload_protocol_type */ 105 __u8 nr_addrs; 105 __u8 nr_addrs; 106 } __packed; 106 } __packed; 107 107 108 /* 108 /* 109 * Header at the beginning of each V1 address 109 * Header at the beginning of each V1 address record. This is followed by the 110 * bytes of the address, 4 for IPV4 and 16 for 110 * bytes of the address, 4 for IPV4 and 16 for IPV6. 111 */ 111 */ 112 struct dns_server_list_v1_address { 112 struct dns_server_list_v1_address { 113 __u8 address_type; /* enu 113 __u8 address_type; /* enum dns_payload_address_type */ 114 } __packed; 114 } __packed; 115 115 116 #endif /* _UAPI_LINUX_DNS_RESOLVER_H */ 116 #endif /* _UAPI_LINUX_DNS_RESOLVER_H */ 117 117
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.