mirror of
https://github.com/miekg/dns.git
synced 2025-10-12 18:31:00 +02:00
Make Funkensturm somewhat better
This commit is contained in:
parent
7cf37d9d6f
commit
9bee591bc0
@ -55,7 +55,9 @@ func (c Cache) lookup(q *dns.Msg) []byte {
|
|||||||
if im, ok := c[q.Question[0].Name]; ok {
|
if im, ok := c[q.Question[0].Name]; ok {
|
||||||
// we have the name
|
// we have the name
|
||||||
if d, ok := im[i]; ok {
|
if d, ok := im[i]; ok {
|
||||||
return d
|
e := make([]byte, len(d))
|
||||||
|
copy(e, d)
|
||||||
|
return e
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
@ -73,6 +75,7 @@ func checkcache(m *dns.Msg, ok bool) (o []byte) {
|
|||||||
o[1] = byte(m.MsgHdr.Id)
|
o[1] = byte(m.MsgHdr.Id)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
println("Cache miss")
|
||||||
var p *dns.Msg
|
var p *dns.Msg
|
||||||
// nothing found
|
// nothing found
|
||||||
for _, c := range qr {
|
for _, c := range qr {
|
||||||
|
@ -99,15 +99,17 @@ func doFunkensturm(pkt *dns.Msg) ([]byte, os.Error) {
|
|||||||
// change is cumulative.
|
// change is cumulative.
|
||||||
ok, ok1 := true, true
|
ok, ok1 := true, true
|
||||||
pkt1 := pkt
|
pkt1 := pkt
|
||||||
for _, m := range f.Matches {
|
if len(f.Matches) > 0 {
|
||||||
pkt1, ok1 = m.Func(pkt1, IN)
|
for _, m := range f.Matches {
|
||||||
switch m.Op {
|
pkt1, ok1 = m.Func(pkt1, IN)
|
||||||
case AND:
|
switch m.Op {
|
||||||
ok = ok && ok1
|
case AND:
|
||||||
case OR:
|
ok = ok && ok1
|
||||||
ok = ok || ok1
|
case OR:
|
||||||
}
|
ok = ok || ok1
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if *verbose { //modified
|
if *verbose { //modified
|
||||||
verboseprint(pkt1, ">> ")
|
verboseprint(pkt1, ">> ")
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user