}
}
+ if (device == NULL) {
+ device = pcap_lookupdev(ebuf);
+ if (device == NULL)
+ error("pcap_lookupdev failed: %s", ebuf);
+ }
if (useactivate) {
pd = pcap_create(device, ebuf);
if (pd == NULL)
- error("%s", ebuf);
+ error("%s: pcap_create failed: %s", device, ebuf);
status = pcap_set_snaplen(pd, snaplen);
if (status != 0)
error("%s: pcap_set_snaplen failed: %s",
*/
warning("%s: %s\n(%s)", device,
pcap_statustostr(status), pcap_geterr(pd));
- }
+ } else
+ printf("%s opened successfully\n", device);
} else {
*ebuf = '\0';
pd = pcap_open_live(device, 65535, 0, 1000, ebuf);
error("%s", ebuf);
else if (*ebuf)
warning("%s", ebuf);
+ else
+ printf("%s opened successfully\n", device);
}
pcap_close(pd);
exit(status < 0 ? 1 : 0);