--- embedaddon/trafshow/show_dump.c 2012/02/21 16:55:18 1.1.1.1 +++ embedaddon/trafshow/show_dump.c 2013/07/22 00:22:30 1.1.1.1.2.1 @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -29,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -118,6 +120,7 @@ show_dump_open(ph, ns) bpf_u_int32 net; bpf_u_int32 mask; char name[100], buf[256]; + int v = 1; /* sanity check */ if (!ph || !ns) return -1; @@ -139,13 +142,16 @@ show_dump_open(ph, ns) if (buf[0] != '\0') screen_status("%s: %s", ph->name, buf); if (!live_pcap) return -1; -#ifdef notdef if (pcap_setnonblock(live_pcap, 1, buf) < 0) { screen_status("%s: %s", ph->name, buf); show_dump_close(); 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 */ if (pcap_lookupnet(strcpy(name, ph->name), &net, &mask, buf) < 0) { /* ignore error */