}
void
-cache_answer(struct interface *iface, uint8_t *base, int blen, char *name, struct dns_answer *a, uint8_t *rdata)
+cache_answer(struct interface *iface, uint8_t *base, int blen, char *name, struct dns_answer *a, uint8_t *rdata, int flush)
{
struct dns_srv_data *dsd = (struct dns_srv_data *) rdata;
struct cache_record *r;
int host_len = 0;
static char *rdata_buffer = (char *) mdns_buf;
- if (!(a->class & CLASS_IN))
- return;
-
nlen = strlen(name);
switch (a->type) {
void cache_scan(void);
void cache_cleanup(void);
void cache_answer(struct interface *iface, uint8_t *base, int blen,
- char *name, struct dns_answer *a, uint8_t *rdata);
+ char *name, struct dns_answer *a, uint8_t *rdata, int flush);
int cache_host_is_known(char *record);
char *cache_lookup_name(const char *key);
void cache_dump_records(struct blob_buf *buf, const char *name);
return -1;
}
+ if ((a->class & ~CLASS_FLUSH) != CLASS_IN)
+ return -1;
+
rdata = *b;
if (a->rdlength > *rlen) {
fprintf(stderr, "dropping: bad question\n");
*b += a->rdlength;
if (cache)
- cache_answer(iface, buffer, len, name, a, rdata);
+ cache_answer(iface, buffer, len, name, a, rdata, a->class & CLASS_FLUSH);
return 0;
}
#define MCAST_ADDR6 "ff02::fb"
#define MCAST_PORT 5353
+#define CLASS_FLUSH 0x8000
#define CLASS_UNICAST 0x8000
#define CLASS_IN 0x0001