98 char errbuf[PCAP_ERRBUF_SIZE];
104 if (pcap_lookupnet(dev, &net, &mask, errbuf) == -1)
106 printf(
"Sorry, Can't get netmask for device %s\n", dev);
114 printf(
"Sorry, occured problem while opening pcap\n");
120 if (pcap_datalink(
handle) != DLT_EN10MB)
122 printf(
"Sorry, pcap has been open on a NOT ethernet device\n");
128 if (pcap_compile(
handle, &
fp, filter_expr, 0, net) == -1)
130 printf(
"Sorry, pcap can't paser filter%s: %s\n", filter_expr, pcap_geterr(
handle));
135 if (pcap_setfilter(
handle, &
fp) == -1)
137 printf(
"Sorry, pcap couldn't install filter %s: %s\n", filter_expr, pcap_geterr(
handle));