Ticket #11104: p0f.c.patch

File p0f.c.patch, 1.4 KB (added by macports@…, 18 years ago)
  • p0f.c

    diff -Naur p0f/p0f.c p0f-patched/p0f.c
    old new  
    18131813
    18141814  if (use_cache) {
    18151815
     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
    18161821    _s32 mfd,max;
    18171822
    18181823    mfd = pcap_fileno(pt);
    18191824
    18201825    max = 1 + (mfd > lsock ? mfd : lsock);
    18211826
     1827    struct timeval timeout;
     1828
    18221829    while (1) {
    18231830      fd_set f,e;
    18241831
     
    18351842         raw socket, even with no SA_RESTART, it's a mess... select()
    18361843         is rather neutral. */
    18371844
    1838       select(max,&f,0,&e,0);
     1845      timeout.tv_sec = 1;
     1846      timeout.tv_usec = 0;
     1847      select(max,&f,0,&e,&timeout);
    18391848
    1840       if (FD_ISSET(mfd, &f) || FD_ISSET(mfd,&e))
     1849      //      if (FD_ISSET(mfd, &f) || FD_ISSET(mfd,&e))
    18411850        if (pcap_dispatch(pt,-1,(pcap_handler)&parse,0) < 0) break;
    18421851
    18431852      if (FD_ISSET(lsock,&f)) {
  • test/p0fq.c

    diff -Naur p0f/test/p0fq.c p0f-patched/test/p0fq.c
    old new  
    5252  d  = inet_addr(argv[4]);
    5353  dp = atoi(argv[5]);
    5454
    55   if (!sp || !dp || s == INADDR_NONE || d == INADDR_NONE)
     55  if (!dp || s == INADDR_NONE || d == INADDR_NONE)
    5656    fatal("Bad IP/port values.\n");
    5757
    5858  sock = socket(PF_UNIX,SOCK_STREAM,0);