X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;ds=inline;f=lib%2Fnames-net.c;h=335bf682212495d1da20b35b1850ac6d5bb1a91f;hb=d3cd9d2cfad345f878bc8b27c89cb38394ebbf90;hp=167cd1fb10229b489974fd9f53d395bb9ec204a8;hpb=752d4d9ab7e567ea972a16f33d2a210ae90b7051;p=pciutils.git diff --git a/lib/names-net.c b/lib/names-net.c index 167cd1f..335bf68 100644 --- a/lib/names-net.c +++ b/lib/names-net.c @@ -8,23 +8,30 @@ #include #include -#include -#include -#include #include "internal.h" #include "names.h" +#ifdef PCI_USE_DNS + +#include +#include +#include + 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: @@ -51,7 +58,7 @@ char 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(); @@ -88,11 +95,11 @@ char 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