/[pxelator]/lib/PXElator/dnsd.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /lib/PXElator/dnsd.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 147 by dpavlin, Mon Aug 3 19:59:08 2009 UTC revision 148 by dpavlin, Wed Aug 5 13:25:19 2009 UTC
# Line 25  sub reply_handler { Line 25  sub reply_handler {
25          print "Received query from $peerhost to ". $conn->{"sockhost"}. "\n";          print "Received query from $peerhost to ". $conn->{"sockhost"}. "\n";
26          $query->print;          $query->print;
27    
28          if ( $qtype eq "A" && $qname eq "pxelator" ) {          if ( $qname =~ s{\Q$server::domain_name\E$}{} ) {
29                  my ($ttl, $rdata) = (3600, "172.16.10.1");                  warn "local $qname $qtype";
30                  push @ans, Net::DNS::RR->new("$qname $ttl $qclass $qtype $rdata");                  if ( $qtype eq "A" && $qname eq "pxelator." ) {
31                  $rcode = "NOERROR";                          my ($ttl, $rdata) = (3600, "172.16.10.1");
32          } elsif ( $qname eq "foo.example.com" ) {                          push @ans, Net::DNS::RR->new("$qname $ttl $qclass $qtype $rdata");
33                  $rcode = "NOERROR";                          $rcode = "NOERROR";
34                    } else {
35                            $rcode = "NXDOMAIN";
36                    }
37    
38          } elsif ( my $packet = $res->query( $qname, $qtype ) ) {          } elsif ( my $packet = $res->query( $qname, $qtype ) ) {
39    
# Line 43  sub reply_handler { Line 46  sub reply_handler {
46                  $rcode = "NXDOMAIN";                  $rcode = "NXDOMAIN";
47          }          }
48    
49            warn "rcode: $rcode ",dump( @ans );
50    
51          # mark the answer as authoritive (by setting the 'aa' flag          # mark the answer as authoritive (by setting the 'aa' flag
52          return ($rcode, \@ans, \@auth, \@add, { aa => 1 });          return ($rcode, \@ans, \@auth, \@add, { aa => 1 });
53  }  }
# Line 54  sub start { Line 59  sub start {
59                  Verbose      => $debug,                  Verbose      => $debug,
60          ) || die "couldn't create nameserver object\n";          ) || die "couldn't create nameserver object\n";
61    
62            warn "DNS $server::domain_name";
63    
64          $ns->main_loop;          $ns->main_loop;
65  }  }
66    
67  1;  1;

Legend:
Removed from v.147  
changed lines
  Added in v.148

  ViewVC Help
Powered by ViewVC 1.1.26