version 1.1.1.1, 2012/02/21 16:55:18
|
version 1.1.1.1.2.1, 2013/07/22 00:22:30
|
Line 21
|
Line 21
|
#include <sys/param.h> |
#include <sys/param.h> |
#include <sys/types.h> |
#include <sys/types.h> |
#include <sys/socket.h> |
#include <sys/socket.h> |
|
#include <sys/ioctl.h> |
#include <sys/time.h> |
#include <sys/time.h> |
#include <netinet/in.h> |
#include <netinet/in.h> |
#include <arpa/inet.h> |
#include <arpa/inet.h> |
Line 29
|
Line 30
|
#include <string.h> |
#include <string.h> |
#include <unistd.h> |
#include <unistd.h> |
#include <errno.h> |
#include <errno.h> |
|
#include <net/bpf.h> |
#include <pcap.h> |
#include <pcap.h> |
#include <pthread.h> |
#include <pthread.h> |
#include <time.h> |
#include <time.h> |
Line 118 show_dump_open(ph, ns)
|
Line 120 show_dump_open(ph, ns)
|
bpf_u_int32 net; |
bpf_u_int32 net; |
bpf_u_int32 mask; |
bpf_u_int32 mask; |
char name[100], buf[256]; |
char name[100], buf[256]; |
|
int v = 1; |
|
|
/* sanity check */ |
/* sanity check */ |
if (!ph || !ns) return -1; |
if (!ph || !ns) return -1; |
Line 139 show_dump_open(ph, ns)
|
Line 142 show_dump_open(ph, ns)
|
if (buf[0] != '\0') |
if (buf[0] != '\0') |
screen_status("%s: %s", ph->name, buf); |
screen_status("%s: %s", ph->name, buf); |
if (!live_pcap) return -1; |
if (!live_pcap) return -1; |
#ifdef notdef |
|
if (pcap_setnonblock(live_pcap, 1, buf) < 0) { |
if (pcap_setnonblock(live_pcap, 1, buf) < 0) { |
screen_status("%s: %s", ph->name, buf); |
screen_status("%s: %s", ph->name, buf); |
show_dump_close(); |
show_dump_close(); |
return -1; |
return -1; |
} |
} |
#endif | if (ioctl(pcap_fileno(live_pcap), BIOCIMMEDIATE, &v) < 0) { |
| screen_status("%s: %s", ph->name, strerror(errno)); |
| show_dump_close(); |
| return -1; |
| } |
/* setup filter expression */ |
/* setup filter expression */ |
if (pcap_lookupnet(strcpy(name, ph->name), &net, &mask, buf) < 0) { |
if (pcap_lookupnet(strcpy(name, ph->name), &net, &mask, buf) < 0) { |
/* ignore error */ |
/* ignore error */ |