source: npl/internetserver/djbdns/ignoreip-1.05.patch

Last change on this file was c5c522c, checked in by Edwin Eefting <edwin@datux.nl>, 8 years ago

initial commit, transferred from cleaned syn3 svn tree

  • Property mode set to 100755
File size: 2.3 KB
  • dnscache.c

    This patch changes djbdns's dnscache program so that it will ignore the
    IP address given in the IGNOREIP environment variable.  I wrote this
    patch because of Verisign's oh-so helpful wildcard A records for *.COM
    and *.NET.  Install the patch like this:
        patch <djbdns-1.05-ignoreip.patch
        svc -d /service/dnscache
        make setup check
        svc -u /service/dnscache
    
    Configure it to ignore Verisign's wildcard record like this:
        echo 64.94.110.11 >/service/dnscache/env/IGNOREIP
        svc -t /service/dnscache
    
    If IGNOREIP isn't found in the environment variable space, nothing is
    ignored.
    
    --
    --My blog is at angry-economist.russnelson.com  | Free markets express in the
    Crynwr sells support for free software  | PGPok | practical world our belief
    521 Pleasant Valley Rd. | +1 315 268 1925 voice | that there is that of God
    Potsdam, NY 13676-3213  | +1 315 268 9201 FAX   | in all people. -Chris V.
    
    
    diff -u orig/dnscache.c ./dnscache.c
    old new  
    2323#include "okclient.h"
    2424#include "droproot.h"
    2525
     26char ignoreip[4];
     27
    2628static int packetquery(char *buf,unsigned int len,char **q,char qtype[2],char qclass[2],char id[2])
    2729{
    2830  unsigned int pos;
     
    431433  if (!cache_init(cachesize))
    432434    strerr_die3x(111,FATAL,"not enough memory for cache of size ",x);
    433435
     436  x = env_get("IGNOREIP");
     437  if (x)
     438    if (!ip4_scan(x,ignoreip))
     439      strerr_die3x(111,FATAL,"unable to parse IGNOREIP address ",x);
     440
    434441  if (env_get("HIDETTL"))
    435442    response_hidettl();
    436443  if (env_get("FORWARDONLY"))
  • query.c

    diff -u orig/query.c ./query.c
    old new  
    1313#include "response.h"
    1414#include "query.h"
    1515
     16extern char ignoreip[];
     17
    1618static int flagforwardonly = 0;
    1719
    1820void query_forwardonly(void)
     
    643645        pos = dns_packet_copy(buf,len,pos,header,10); if (!pos) goto DIE;
    644646        if (byte_equal(header + 8,2,"\0\4")) {
    645647          pos = dns_packet_copy(buf,len,pos,header,4); if (!pos) goto DIE;
     648          /*          if (*ignoreip) if (byte_equal(header,4,ignoreip)) goto NXDOMAIN;*/
     649          if (*ignoreip) if (byte_equal(header,4,ignoreip)) goto NXDOMAIN;
    646650          save_data(header,4);
    647651          log_rr(whichserver,t1,DNS_T_A,header,4,ttl);
    648652        }
Note: See TracBrowser for help on using the repository browser.