void process_dns_reply(dnskey_glob *gs) { dnskey_lookup *dl; struct lwres_async_state *plas; struct rrsetinfo *res; int success; plas = NULL; success = lwres_getrrsetbyname_read(&plas, gs->lwctx, &res); /* cast answer back to dnskey_lookup structure */ dl = (dnskey_lookup *)plas; if(dl == NULL) { return; } if(dl!= NULL && success == LWRES_R_RETRY) { /* XXX we got something from some other weird place! * transmit again, in the hope of getting the right answer */ dns_rexmit(gs, dl, 1); return; } /* perform next step for this one */ lookup_step(gs, dl, res, success); }
foreach(batch_index, n) { const struct rte_lpm6_tbl_entry *tbl; const struct rte_lpm6_tbl_entry *tbl_next; uint32_t tbl24_index; uint8_t first_byte, next_hop; int status; first_byte = LOOKUP_FIRST_BYTE; tbl24_index = (ips[batch_index][0] << BYTES2_SIZE) | (ips[batch_index][1] << BYTE_SIZE) | ips[batch_index][2]; /* Calculate pointer to the first entry to be inspected */ tbl = &lpm->tbl24[tbl24_index]; do { FPP_EXPENSIVE(tbl); /* Continue inspecting following levels until success or failure */ status = lookup_step(lpm, tbl, &tbl_next, ips[batch_index], first_byte++, &next_hop); tbl = tbl_next; } while (status == 1); if (status < 0) next_hops[batch_index] = -1; else next_hops[batch_index] = next_hop; }