Merge pull request #161 from sgh7/master

[server] daemon exits if listened-to interface goes down
This commit is contained in:
Michael Rash 2015-07-17 22:37:59 -04:00
commit c25f951b42

View File

@ -31,6 +31,7 @@
#if USE_LIBPCAP #if USE_LIBPCAP
#include <pcap.h> #include <pcap.h>
#include <errno.h>
#endif #endif
#include "fwknopd_common.h" #include "fwknopd_common.h"
@ -288,10 +289,20 @@ pcap_capture(fko_srv_options_t *opts)
* giving up). * giving up).
*/ */
else if(res == -1) else if(res == -1)
{
if(errno == ENETDOWN)
{
log_msg(LOG_ERR, "[*] Fatal error from pcap_dispatch: %s",
pcap_geterr(pcap)
);
clean_exit(opts, FW_CLEANUP, EXIT_FAILURE);
}
else
{ {
log_msg(LOG_ERR, "[*] Error from pcap_dispatch: %s", log_msg(LOG_ERR, "[*] Error from pcap_dispatch: %s",
pcap_geterr(pcap) pcap_geterr(pcap)
); );
}
if(pcap_errcnt++ > MAX_PCAP_ERRORS_BEFORE_BAIL) if(pcap_errcnt++ > MAX_PCAP_ERRORS_BEFORE_BAIL)
{ {