• Bug#170338: arpwatch dies when interface goes down (2/2)

    From Christoph Biedl@1:229/2 to All on Fri Aug 13 16:30:15 2004
    [continued from previous message]

    - (void)alarm(CHECKPOINT);
    - }
    -
    - switch (linktype) {
    -
    - case DLT_EN10MB:
    - status = pcap_loop(pd, 0, process_ether, NULL);
    - break;
    -
    - case DLT_FDDI:
    - status = pcap_loop(pd, 0, process_fddi, NULL);
    - break;
    -
    - default:
    - syslog(LOG_ERR, "bad linktype %d (can't happen)", linktype);
    - exit(1);
    - }
    - if (status < 0) {
    - syslog(LOG_ERR, "pcap_loop: %s", pcap_geterr(pd));
    - exit(1);
    - }
    - pcap_close(pd);
    - if (!dump())
    - exit(1);
    - exit(0);
    + initializing = 0;
    +
    + (void)setsignal(SIGINT, die);
    + (void)setsignal(SIGTERM, die);
    + (void)setsignal(SIGHUP, die);
    + if (rfilename == NULL) {
    + (void)setsignal(SIGQUIT, checkpoint);
    + (void)setsignal(SIGALRM, checkpoint);
    + (void)alarm(CHECKPOINT);
    + }
    +
    + switch (linktype) {
    +
    + case DLT_EN10MB:
    + status = pcap_loop(pd, 0, process_ether, NULL);
    + break;
    +
    + case DLT_FDDI:
    + status = pcap_loop(pd, 0, process_fddi, NULL);
    + break;
    +
    + default:
    + syslog(LOG_ERR, "bad linktype %d (can't happen)", linktype);
    + exit(1);
    + }
    + if (status < 0) {
    + syslog(LOG_ERR, "pcap_loop %s: %s",
    + interface, pcap_geterr(pd));
    + pcap_close(pd);
    + if (!restart)
    + exit(1);
    + syslog(LOG_ERR, "restart in %d secs", restart);
    + /* wait a while, then restart */
    + sleep (restart);
    + continue;
    + }
    + pcap_close(pd);
    + if (!dump())
    + exit(1);
    + exit(0);
    + } while (restart);
    }

    /* Process an ethernet arp/rarp packet */
    @@ -816,9 +844,10 @@
    "[-p] "
    "[-f datafile] "
    "[-i interface] "
    - "[-m addr] "
    + "[-m addr]\n\t"
    "[-n net[/width]] "
    - "[-r file]\n\t"
    + "[-r file] "
    + "[-R seconds]\n\t"
    "[-s sendmail_path] "
    "[-u username] "
    "\n"

    --- SoupGate-Win32 v1.05
    * Origin: you cannot sedate... all the things you hate (1:229/2)