Last active
July 26, 2016 13:00
-
-
Save stkchp/aa61ed5ac23f22a80bb7da54d62c3ce7 to your computer and use it in GitHub Desktop.
Revisions
-
stkchp revised this gist
Jul 7, 2016 . 1 changed file with 45 additions and 21 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,26 +1,50 @@ --- dnsmasq-2.76/src/rfc1035.c +++ dnsmasq-2.76/src/rfc1035.c @@ -1624,13 +1624,15 @@ ans = 1; if (!dryrun) { - log_query(crecp->flags & ~F_REVERSE, name, &crecp->addr.addr, - record_source(crecp->uid)); + if (type != T_A) { + log_query(crecp->flags & ~F_REVERSE, name, &crecp->addr.addr, + record_source(crecp->uid)); - if (add_resource_record(header, limit, &trunc, nameoffset, &ansp, - crec_ttl(crecp, now), NULL, type, C_IN, - type == T_A ? "4" : "6", &crecp->addr)) - anscount++; + if (add_resource_record(header, limit, &trunc, nameoffset, &ansp, + crec_ttl(crecp, now), NULL, type, C_IN, + type == T_A ? "4" : "6", &crecp->addr)) + anscount++; + } } } } while ((crecp = cache_find_by_name(crecp, name, now, flag | F_CNAME))); @@ -1640,10 +1642,12 @@ ans = 1; if (!dryrun) { - log_query(F_FORWARD | F_CONFIG | flag, name, &addr, NULL); - if (add_resource_record(header, limit, &trunc, nameoffset, &ansp, - daemon->local_ttl, NULL, type, C_IN, type == T_A ? "4" : "6", &addr)) - anscount++; + if (type != T_A) { + log_query(F_FORWARD | F_CONFIG | flag, name, &addr, NULL); + if (add_resource_record(header, limit, &trunc, nameoffset, &ansp, + daemon->local_ttl, NULL, type, C_IN, type == T_A ? "4" : "6", &addr)) + anscount++; + } } } } @@ -1781,6 +1785,8 @@ if (!dryrun) log_query(F_CONFIG | F_NEG, name, &addr, NULL); } + if (qtype == T_A) + ans = 1, nxdomain = 0; } if (!ans) -
stkchp created this gist
Jul 6, 2016 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,26 @@ --- dnsmasq-2.76/src/forward.c +++ dnsmasq-2.76/src/forward.c @@ -781,8 +781,8 @@ daemon->log_display_id = forward->log_id; daemon->log_source_addr = &forward->source; - if (daemon->ignore_addr && RCODE(header) == NOERROR && - check_for_ignored_address(header, n, daemon->ignore_addr)) + if (RCODE(header) == NOERROR && + check_for_ignored_address(header, n, NULL)) return; /* Note: if we send extra options in the EDNS0 header, we can't recreate --- dnsmasq-2.76/src/rfc1035.c +++ dnsmasq-2.76/src/rfc1035.c @@ -1037,9 +1037,7 @@ if (!CHECK_LEN(header, p, qlen, INADDRSZ)) return 0; - for (baddrp = baddr; baddrp; baddrp = baddrp->next) - if (memcmp(&baddrp->addr, p, INADDRSZ) == 0) - return 1; + return 1; } if (!ADD_RDLEN(header, p, qlen, rdlen))