- device = pcap_lookupdev(ebuf);
- if (device == NULL) {
- error("couldn't find interface to use: %s",
- ebuf);
- }
+ if (pcap_findalldevs(&devlist, ebuf) == -1)
+ error("%s", ebuf);
+ if (devlist == NULL)
+ error("no interfaces available for capture");
+ device = strdup(devlist->name);
+ pcap_freealldevs(devlist);