Maintained by: NLnet Labs

[Unbound-users] python module example documentation bug and crasher

Paul Wouters
Sun Jan 19 08:04:39 CET 2014


I looked at:

http://www.unbound.net/documentation/pythonmod/examples/example0.html#complete-source-code

When loading that module, unbound always SERVFAIL's. Thinking that this
section was wrongly returning MODULE_ERROR:

  if event == MODULE_EVENT_PASS:
       log_info("pythonmod: event_pass")
       qstate.ext_state[id] = MODULE_ERROR
       return True

I changed it to MODULE_FINISHED. However, that lead to a crash in
unbound:

(gdb) l
2738			return;
2739		}
2740		/* Fetch and validate the keyEntry that corresponds to
the 
2741		 * current trust anchor. */
2742		if(rcode == LDNS_RCODE_NOERROR) {
2743			dnskey_rrset =
reply_find_rrset_section_an(msg->rep,
2744				ta->name, ta->namelen,
LDNS_RR_TYPE_DNSKEY,
2745				ta->dclass);
2746		}
2747		if(ta->autr) {
(gdb) p *ta
$1 = {node = {parent = 0x7ffff8263140, left = 0x7ffff82010c0, right =
0x7ffff82010c0, key = 0x7ffff8263730, color = 1 '\001'}, lock = {
     __data = {__lock = 1, __count = 0, __owner = 31031, __nusers = 1,
__kind = 0, __spins = 0, __list = {__prev = 0x0, __next = 0x0}},
     __size = "\001\000\000\000\000\000\000\000\067y\000\000\001", '\000'
<repeats 26 times>, __align = 1}, name = 0x7ffff8254470 "",
   namelen = 1, namelabs = 1, parent = 0x0, keylist = 0x0, autr =
0x7ffff82637e0, numDS = 0, numDNSKEY = 1, ds_rrset = 0x0,
   dnskey_rrset = 0x7ffff8263310, dclass = 1}
(gdb) p msg
$2 = (struct dns_msg *) 0x0
(gdb)


When changed to MODULE_WAIT_MODULE it seemed to work.

Paul