#include <string.h>
#include <stdlib.h>
-#include <netinet/in.h>
-#include <arpa/nameser.h>
-#include <resolv.h>
#include "internal.h"
#include "names.h"
+#ifdef PCI_USE_DNS
+
+#include <netinet/in.h>
+#include <arpa/nameser.h>
+#include <resolv.h>
+
char
*pci_id_net_lookup(struct pci_access *a, int cat, int id1, int id2, int id3, int id4)
{
- char name[256], dnsname[256], txt[256];
+ char name[256], dnsname[256], txt[256], *domain;
byte answer[4096];
const byte *data;
int res, i, j, dlen;
ns_msg m;
ns_rr rr;
+ domain = pci_get_param(a, "net.domain");
+ if (!domain || !domain[0])
+ return NULL;
+
switch (cat)
{
case ID_VENDOR:
default:
return NULL;
}
- sprintf(dnsname, "%s.%s", name, a->id_domain);
+ sprintf(dnsname, "%s.%s", name, domain);
a->debug("Resolving %s\n", dnsname);
res_init();
return NULL;
}
-void
-pci_set_net_domain(struct pci_access *a, char *name, int to_be_freed)
+#else
+
+char *pci_id_net_lookup(struct pci_access *a UNUSED, int cat UNUSED, int id1 UNUSED, int id2 UNUSED, int id3 UNUSED, int id4 UNUSED)
{
- if (a->free_id_domain)
- free(a->id_domain);
- a->id_domain = name;
- a->free_id_domain = to_be_freed;
+ return NULL;
}
+
+#endif