--- embedaddon/dnsmasq/src/dns-protocol.h 2014/06/15 16:31:38 1.1.1.2 +++ embedaddon/dnsmasq/src/dns-protocol.h 2023/09/27 11:02:07 1.1.1.5 @@ -1,4 +1,4 @@ -/* dnsmasq is Copyright (c) 2000-2014 Simon Kelley +/* dnsmasq is Copyright (c) 2000-2022 Simon Kelley This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -16,6 +16,8 @@ #define NAMESERVER_PORT 53 #define TFTP_PORT 69 +#define MIN_PORT 1024 /* first non-reserved port */ +#define MAX_PORT 65535u #define IN6ADDRSZ 16 #define INADDRSZ 4 @@ -74,25 +76,61 @@ #define T_AXFR 252 #define T_MAILB 253 #define T_ANY 255 +#define T_CAA 257 #define EDNS0_OPTION_MAC 65001 /* dyndns.org temporary assignment */ #define EDNS0_OPTION_CLIENT_SUBNET 8 /* IANA */ +#define EDNS0_OPTION_EDE 15 /* IANA - RFC 8914 */ +#define EDNS0_OPTION_NOMDEVICEID 65073 /* Nominum temporary assignment */ +#define EDNS0_OPTION_NOMCPEID 65074 /* Nominum temporary assignment */ +#define EDNS0_OPTION_UMBRELLA 20292 /* Cisco Umbrella temporary assignment */ +/* RFC-8914 extended errors, negative values are our definitions */ +#define EDE_UNSET -1 /* No extended DNS error available */ +#define EDE_OTHER 0 /* Other */ +#define EDE_USUPDNSKEY 1 /* Unsupported DNSKEY algo */ +#define EDE_USUPDS 2 /* Unsupported DS Digest */ +#define EDE_STALE 3 /* Stale answer */ +#define EDE_FORGED 4 /* Forged answer */ +#define EDE_DNSSEC_IND 5 /* DNSSEC Indeterminate */ +#define EDE_DNSSEC_BOGUS 6 /* DNSSEC Bogus */ +#define EDE_SIG_EXP 7 /* Signature Expired */ +#define EDE_SIG_NYV 8 /* Signature Not Yet Valid */ +#define EDE_NO_DNSKEY 9 /* DNSKEY missing */ +#define EDE_NO_RRSIG 10 /* RRSIGs missing */ +#define EDE_NO_ZONEKEY 11 /* No Zone Key Bit Set */ +#define EDE_NO_NSEC 12 /* NSEC Missing */ +#define EDE_CACHED_ERR 13 /* Cached Error */ +#define EDE_NOT_READY 14 /* Not Ready */ +#define EDE_BLOCKED 15 /* Blocked */ +#define EDE_CENSORED 16 /* Censored */ +#define EDE_FILTERED 17 /* Filtered */ +#define EDE_PROHIBITED 18 /* Prohibited */ +#define EDE_STALE_NXD 19 /* Stale NXDOMAIN */ +#define EDE_NOT_AUTH 20 /* Not Authoritative */ +#define EDE_NOT_SUP 21 /* Not Supported */ +#define EDE_NO_AUTH 22 /* No Reachable Authority */ +#define EDE_NETERR 23 /* Network error */ +#define EDE_INVALID_DATA 24 /* Invalid Data */ + + + + struct dns_header { u16 id; u8 hb3,hb4; u16 qdcount,ancount,nscount,arcount; }; -#define HB3_QR 0x80 +#define HB3_QR 0x80 /* Query */ #define HB3_OPCODE 0x78 -#define HB3_AA 0x04 -#define HB3_TC 0x02 -#define HB3_RD 0x01 +#define HB3_AA 0x04 /* Authoritative Answer */ +#define HB3_TC 0x02 /* TrunCated */ +#define HB3_RD 0x01 /* Recursion Desired */ -#define HB4_RA 0x80 -#define HB4_AD 0x20 -#define HB4_CD 0x10 +#define HB4_RA 0x80 /* Recursion Available */ +#define HB4_AD 0x20 /* Authenticated Data */ +#define HB4_CD 0x10 /* Checking Disabled */ #define HB4_RCODE 0x0f #define OPCODE(x) (((x)->hb3 & HB3_OPCODE) >> 3) @@ -142,3 +180,11 @@ struct dns_header { #define ADD_RDLEN(header, pp, plen, len) \ (!CHECK_LEN(header, pp, plen, len) ? 0 : (((pp) += (len)), 1)) + +/* Escape character in our presentation format for names. + Cannot be '.' or /000 and must be !isprint(). + Note that escaped chars are stored as + + to ensure that the escaped form of /000 doesn't include /000 +*/ +#define NAME_ESCAPE 1