1
0

0018-Tidy-all_addr-union-merge-log-and-rcode-fields.patch 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. From bde46476ee06c96e821653dfdb8fa11fe7326998 Mon Sep 17 00:00:00 2001
  2. From: Simon Kelley <simon@thekelleys.org.uk>
  3. Date: Mon, 31 Dec 2018 23:28:24 +0000
  4. Subject: [PATCH 18/32] Tidy all_addr union, merge log and rcode fields.
  5. Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
  6. ---
  7. src/cache.c | 2 +-
  8. src/dnsmasq.h | 6 +-----
  9. src/forward.c | 2 +-
  10. src/rfc1035.c | 6 +++---
  11. 4 files changed, 6 insertions(+), 10 deletions(-)
  12. --- a/src/cache.c
  13. +++ b/src/cache.c
  14. @@ -1926,7 +1926,7 @@ void log_query(unsigned int flags, char
  15. sprintf(daemon->addrbuff, arg, addr->addr.log.keytag, addr->addr.log.algo, addr->addr.log.digest);
  16. else if (flags & F_RCODE)
  17. {
  18. - unsigned int rcode = addr->addr.rcode.rcode;
  19. + unsigned int rcode = addr->addr.log.rcode;
  20. if (rcode == SERVFAIL)
  21. dest = "SERVFAIL";
  22. --- a/src/dnsmasq.h
  23. +++ b/src/dnsmasq.h
  24. @@ -279,12 +279,8 @@ struct all_addr {
  25. struct in6_addr addr6;
  26. /* for log_query */
  27. struct {
  28. - unsigned short keytag, algo, digest;
  29. + unsigned short keytag, algo, digest, rcode;
  30. } log;
  31. - /* for log_query */
  32. - struct {
  33. - unsigned int rcode;
  34. - } rcode;
  35. /* for cache_insert of DNSKEY, DS */
  36. struct {
  37. unsigned short class, type;
  38. --- a/src/forward.c
  39. +++ b/src/forward.c
  40. @@ -658,7 +658,7 @@ static size_t process_reply(struct dns_h
  41. if (rcode != NOERROR && rcode != NXDOMAIN)
  42. {
  43. struct all_addr a;
  44. - a.addr.rcode.rcode = rcode;
  45. + a.addr.log.rcode = rcode;
  46. log_query(F_UPSTREAM | F_RCODE, "error", &a, NULL);
  47. return resize_packet(header, n, pheader, plen);
  48. --- a/src/rfc1035.c
  49. +++ b/src/rfc1035.c
  50. @@ -950,7 +950,7 @@ size_t setup_reply(struct dns_header *he
  51. else if (flags == F_SERVFAIL)
  52. {
  53. struct all_addr a;
  54. - a.addr.rcode.rcode = SERVFAIL;
  55. + a.addr.log.rcode = SERVFAIL;
  56. log_query(F_CONFIG | F_RCODE, "error", &a, NULL);
  57. SET_RCODE(header, SERVFAIL);
  58. }
  59. @@ -975,7 +975,7 @@ size_t setup_reply(struct dns_header *he
  60. else /* nowhere to forward to */
  61. {
  62. struct all_addr a;
  63. - a.addr.rcode.rcode = REFUSED;
  64. + a.addr.log.rcode = REFUSED;
  65. log_query(F_CONFIG | F_RCODE, "error", &a, NULL);
  66. SET_RCODE(header, REFUSED);
  67. }
  68. @@ -1374,7 +1374,7 @@ size_t answer_request(struct dns_header
  69. notimp = 1, auth = 0;
  70. if (!dryrun)
  71. {
  72. - addr.addr.rcode.rcode = NOTIMP;
  73. + addr.addr.log.rcode = NOTIMP;
  74. log_query(F_CONFIG | F_RCODE, name, &addr, NULL);
  75. }
  76. ans = 1, sec_data = 0;