diff -Naur p0f/p0f.c p0f-patched/p0f.c
old
|
new
|
|
1813 | 1813 | |
1814 | 1814 | if (use_cache) { |
1815 | 1815 | |
| 1816 | char errbuf[PCAP_ERRBUF_SIZE]; |
| 1817 | if(pcap_setnonblock(pt, 1, errbuf) == -1) { |
| 1818 | debug("[!] Failed to set non blocking mode on device: %s", errbuf); |
| 1819 | } |
| 1820 | |
1816 | 1821 | _s32 mfd,max; |
1817 | 1822 | |
1818 | 1823 | mfd = pcap_fileno(pt); |
1819 | 1824 | |
1820 | 1825 | max = 1 + (mfd > lsock ? mfd : lsock); |
1821 | 1826 | |
| 1827 | struct timeval timeout; |
| 1828 | |
1822 | 1829 | while (1) { |
1823 | 1830 | fd_set f,e; |
1824 | 1831 | |
… |
… |
|
1835 | 1842 | raw socket, even with no SA_RESTART, it's a mess... select() |
1836 | 1843 | is rather neutral. */ |
1837 | 1844 | |
1838 | | select(max,&f,0,&e,0); |
| 1845 | timeout.tv_sec = 1; |
| 1846 | timeout.tv_usec = 0; |
| 1847 | select(max,&f,0,&e,&timeout); |
1839 | 1848 | |
1840 | | if (FD_ISSET(mfd, &f) || FD_ISSET(mfd,&e)) |
| 1849 | // if (FD_ISSET(mfd, &f) || FD_ISSET(mfd,&e)) |
1841 | 1850 | if (pcap_dispatch(pt,-1,(pcap_handler)&parse,0) < 0) break; |
1842 | 1851 | |
1843 | 1852 | if (FD_ISSET(lsock,&f)) { |
diff -Naur p0f/test/p0fq.c p0f-patched/test/p0fq.c
old
|
new
|
|
52 | 52 | d = inet_addr(argv[4]); |
53 | 53 | dp = atoi(argv[5]); |
54 | 54 | |
55 | | if (!sp || !dp || s == INADDR_NONE || d == INADDR_NONE) |
| 55 | if (!dp || s == INADDR_NONE || d == INADDR_NONE) |
56 | 56 | fatal("Bad IP/port values.\n"); |
57 | 57 | |
58 | 58 | sock = socket(PF_UNIX,SOCK_STREAM,0); |