X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=server.c;h=04c7d10821bc8a0c4712f68b716715f5eef879cc;hb=cfc653d0fd2f58ef3f4b5ecb285d5beb5bfaacfb;hp=ecf44577ce2b45861d1cdd2d68359c684b452618;hpb=d553a1c2d1cd3fcdd65ade64940b5bd3efc70675;p=catta diff --git a/server.c b/server.c index ecf4457..04c7d10 100644 --- a/server.c +++ b/server.c @@ -31,14 +31,14 @@ static void handle_query_key(flxServer *s, flxKey *k, flxInterface *i, const flx for (e = s->entries; e; e = e->entry_next) if (flx_key_pattern_match(k, e->record->key)) if (flx_interface_match(i, e->interface, e->protocol)) - flx_interface_post_response(i, e->record, FALSE); + flx_interface_post_response(i, a, e->record, FALSE); } else { /* Handle all other queries */ for (e = g_hash_table_lookup(s->rrset_by_key, k); e; e = e->by_key_next) if (flx_interface_match(i, e->interface, e->protocol)) - flx_interface_post_response(i, e->record, FALSE); + flx_interface_post_response(i, a, e->record, FALSE); } } @@ -61,6 +61,20 @@ static void handle_query(flxServer *s, flxDnsPacket *p, flxInterface *i, const f handle_query_key(s, key, i, a); flx_key_unref(key); } + + /* Known Answer Suppresion */ + for (n = flx_dns_packet_get_field(p, DNS_FIELD_ANCOUNT); n > 0; n --) { + flxRecord *record; + gboolean unique = FALSE; + + if (!(record = flx_dns_packet_consume_record(p, &unique))) { + g_warning("Packet too short (2)"); + return; + } + + flx_packet_scheduler_incoming_known_answer(i->scheduler, record, a); + flx_record_unref(record); + } } static void handle_response(flxServer *s, flxDnsPacket *p, flxInterface *i, const flxAddress *a) { @@ -583,7 +597,7 @@ static void post_response_callback(flxInterfaceMonitor *m, flxInterface *i, gpoi g_assert(i); g_assert(r); - flx_interface_post_response(i, r, FALSE); + flx_interface_post_response(i, NULL, r, FALSE); } void flx_server_post_response(flxServer *s, gint interface, guchar protocol, flxRecord *record) {