res_debug.c (170244) | res_debug.c (186090) |
---|---|
1/* 2 * Copyright (c) 1985 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 77 unchanged lines hidden (view full) --- 86 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 87 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 88 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT 89 * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 90 */ 91 92#if defined(LIBC_SCCS) && !defined(lint) 93static const char sccsid[] = "@(#)res_debug.c 8.1 (Berkeley) 6/4/93"; | 1/* 2 * Copyright (c) 1985 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 77 unchanged lines hidden (view full) --- 86 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 87 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 88 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT 89 * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 90 */ 91 92#if defined(LIBC_SCCS) && !defined(lint) 93static const char sccsid[] = "@(#)res_debug.c 8.1 (Berkeley) 6/4/93"; |
94static const char rcsid[] = "$Id: res_debug.c,v 1.10.18.5 2005/07/28 07:38:11 marka Exp $"; | 94static const char rcsid[] = "$Id: res_debug.c,v 1.10.18.6 2008/04/03 23:15:15 marka Exp $"; |
95#endif /* LIBC_SCCS and not lint */ 96#include <sys/cdefs.h> | 95#endif /* LIBC_SCCS and not lint */ 96#include <sys/cdefs.h> |
97__FBSDID("$FreeBSD: head/lib/libc/resolv/res_debug.c 170244 2007-06-03 17:20:27Z ume $"); | 97__FBSDID("$FreeBSD: head/lib/libc/resolv/res_debug.c 186090 2008-12-14 19:39:53Z ume $"); |
98 99#include "port_before.h" 100 101#include <sys/types.h> 102#include <sys/param.h> 103#include <sys/socket.h> 104 105#include <netinet/in.h> --- 76 unchanged lines hidden (view full) --- 182 fprintf(file, ";; %s SECTION:\n", 183 p_section(section, opcode)); 184 if (section == ns_s_qd) 185 fprintf(file, ";;\t%s, type = %s, class = %s\n", 186 ns_rr_name(rr), 187 p_type(ns_rr_type(rr)), 188 p_class(ns_rr_class(rr))); 189 else if (section == ns_s_ar && ns_rr_type(rr) == ns_t_opt) { | 98 99#include "port_before.h" 100 101#include <sys/types.h> 102#include <sys/param.h> 103#include <sys/socket.h> 104 105#include <netinet/in.h> --- 76 unchanged lines hidden (view full) --- 182 fprintf(file, ";; %s SECTION:\n", 183 p_section(section, opcode)); 184 if (section == ns_s_qd) 185 fprintf(file, ";;\t%s, type = %s, class = %s\n", 186 ns_rr_name(rr), 187 p_type(ns_rr_type(rr)), 188 p_class(ns_rr_class(rr))); 189 else if (section == ns_s_ar && ns_rr_type(rr) == ns_t_opt) { |
190 u_int16_t optcode, optlen, rdatalen = ns_rr_rdlen(rr); |
|
190 u_int32_t ttl = ns_rr_ttl(rr); | 191 u_int32_t ttl = ns_rr_ttl(rr); |
192 |
|
191 fprintf(file, 192 "; EDNS: version: %u, udp=%u, flags=%04x\n", 193 (ttl>>16)&0xff, ns_rr_class(rr), ttl&0xffff); | 193 fprintf(file, 194 "; EDNS: version: %u, udp=%u, flags=%04x\n", 195 (ttl>>16)&0xff, ns_rr_class(rr), ttl&0xffff); |
196 197 while (rdatalen >= 4) { 198 const u_char *cp = ns_rr_rdata(rr); 199 int i; 200 201 GETSHORT(optcode, cp); 202 GETSHORT(optlen, cp); 203 204 if (optcode == NS_OPT_NSID) { 205 fputs("; NSID: ", file); 206 if (optlen == 0) { 207 fputs("; NSID\n", file); 208 } else { 209 fputs("; NSID: ", file); 210 for (i = 0; i < optlen; i++) 211 fprintf(file, "%02x ", 212 cp[i]); 213 fputs(" (",file); 214 for (i = 0; i < optlen; i++) 215 fprintf(file, "%c", 216 isprint(cp[i])? 217 cp[i] : '.'); 218 fputs(")\n", file); 219 } 220 } else { 221 if (optlen == 0) { 222 fprintf(file, "; OPT=%u\n", 223 optcode); 224 } else { 225 fprintf(file, "; OPT=%u: ", 226 optcode); 227 for (i = 0; i < optlen; i++) 228 fprintf(file, "%02x ", 229 cp[i]); 230 fputs(" (",file); 231 for (i = 0; i < optlen; i++) 232 fprintf(file, "%c", 233 isprint(cp[i]) ? 234 cp[i] : '.'); 235 fputs(")\n", file); 236 } 237 } 238 rdatalen -= 4 + optlen; 239 } |
|
194 } else { 195 n = ns_sprintrr(handle, &rr, NULL, NULL, 196 buf, buflen); 197 if (n < 0) { 198 if (errno == ENOSPC) { 199 free(buf); 200 buf = NULL; 201 if (buflen < 131072) 202 buf = malloc(buflen += 1024); 203 if (buf == NULL) { 204 fprintf(file, | 240 } else { 241 n = ns_sprintrr(handle, &rr, NULL, NULL, 242 buf, buflen); 243 if (n < 0) { 244 if (errno == ENOSPC) { 245 free(buf); 246 buf = NULL; 247 if (buflen < 131072) 248 buf = malloc(buflen += 1024); 249 if (buf == NULL) { 250 fprintf(file, |
205 ";; memory allocation failure\n"); | 251 ";; memory allocation failure\n"); |
206 return; 207 } 208 continue; 209 } 210 fprintf(file, ";; ns_sprintrr: %s\n", 211 strerror(errno)); 212 goto cleanup; 213 } --- 160 unchanged lines hidden (view full) --- 374/*% 375 * Names of message sections. 376 */ 377static const struct res_sym __p_default_section_syms[] = { 378 {ns_s_qd, "QUERY", (char *)0}, 379 {ns_s_an, "ANSWER", (char *)0}, 380 {ns_s_ns, "AUTHORITY", (char *)0}, 381 {ns_s_ar, "ADDITIONAL", (char *)0}, | 252 return; 253 } 254 continue; 255 } 256 fprintf(file, ";; ns_sprintrr: %s\n", 257 strerror(errno)); 258 goto cleanup; 259 } --- 160 unchanged lines hidden (view full) --- 420/*% 421 * Names of message sections. 422 */ 423static const struct res_sym __p_default_section_syms[] = { 424 {ns_s_qd, "QUERY", (char *)0}, 425 {ns_s_an, "ANSWER", (char *)0}, 426 {ns_s_ns, "AUTHORITY", (char *)0}, 427 {ns_s_ar, "ADDITIONAL", (char *)0}, |
382 {0, (char *)0, (char *)0} | 428 {0, (char *)0, (char *)0} |
383}; 384 385static const struct res_sym __p_update_section_syms[] = { 386 {S_ZONE, "ZONE", (char *)0}, 387 {S_PREREQ, "PREREQUISITE", (char *)0}, 388 {S_UPDATE, "UPDATE", (char *)0}, 389 {S_ADDT, "ADDITIONAL", (char *)0}, | 429}; 430 431static const struct res_sym __p_update_section_syms[] = { 432 {S_ZONE, "ZONE", (char *)0}, 433 {S_PREREQ, "PREREQUISITE", (char *)0}, 434 {S_UPDATE, "UPDATE", (char *)0}, 435 {S_ADDT, "ADDITIONAL", (char *)0}, |
390 {0, (char *)0, (char *)0} | 436 {0, (char *)0, (char *)0} |
391}; 392 393const struct res_sym __p_key_syms[] = { 394 {NS_ALG_MD5RSA, "RSA", "RSA KEY with MD5 hash"}, 395 {NS_ALG_DH, "DH", "Diffie Hellman"}, 396 {NS_ALG_DSA, "DSA", "Digital Signature Algorithm"}, 397 {NS_ALG_EXPIRE_ONLY, "EXPIREONLY", "No algorithm"}, 398 {NS_ALG_PRIVATE_OID, "PRIVATE", "Algorithm obtained from OID"}, --- 211 unchanged lines hidden (view full) --- 610 case RES_STAYOPEN: return "styopn"; 611 case RES_DNSRCH: return "dnsrch"; 612 case RES_INSECURE1: return "insecure1"; 613 case RES_INSECURE2: return "insecure2"; 614 case RES_NOALIASES: return "noaliases"; 615 case RES_USE_INET6: return "inet6"; 616#ifdef RES_USE_EDNS0 /*%< KAME extension */ 617 case RES_USE_EDNS0: return "edns0"; | 437}; 438 439const struct res_sym __p_key_syms[] = { 440 {NS_ALG_MD5RSA, "RSA", "RSA KEY with MD5 hash"}, 441 {NS_ALG_DH, "DH", "Diffie Hellman"}, 442 {NS_ALG_DSA, "DSA", "Digital Signature Algorithm"}, 443 {NS_ALG_EXPIRE_ONLY, "EXPIREONLY", "No algorithm"}, 444 {NS_ALG_PRIVATE_OID, "PRIVATE", "Algorithm obtained from OID"}, --- 211 unchanged lines hidden (view full) --- 656 case RES_STAYOPEN: return "styopn"; 657 case RES_DNSRCH: return "dnsrch"; 658 case RES_INSECURE1: return "insecure1"; 659 case RES_INSECURE2: return "insecure2"; 660 case RES_NOALIASES: return "noaliases"; 661 case RES_USE_INET6: return "inet6"; 662#ifdef RES_USE_EDNS0 /*%< KAME extension */ 663 case RES_USE_EDNS0: return "edns0"; |
664 case RES_NSID: return "nsid"; |
|
618#endif 619#ifdef RES_USE_DNAME 620 case RES_USE_DNAME: return "dname"; 621#endif 622#ifdef RES_USE_DNSSEC 623 case RES_USE_DNSSEC: return "dnssec"; 624#endif 625#ifdef RES_NOTLDQUERY --- 557 unchanged lines hidden --- | 665#endif 666#ifdef RES_USE_DNAME 667 case RES_USE_DNAME: return "dname"; 668#endif 669#ifdef RES_USE_DNSSEC 670 case RES_USE_DNSSEC: return "dnssec"; 671#endif 672#ifdef RES_NOTLDQUERY --- 557 unchanged lines hidden --- |