From: Ted Lemon Date: Thu, 5 Apr 2001 20:47:34 +0000 (+0000) Subject: If we get an EIO on read, the interface is gone, so delete it. X-Git-Tag: V3-BETA-2-PATCH-24~16 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=89000b2e131ca53173304aacf0cd190a0e50bce3;p=thirdparty%2Fdhcp.git If we get an EIO on read, the interface is gone, so delete it. --- diff --git a/common/bpf.c b/common/bpf.c index c7809f250..5e8214bf6 100644 --- a/common/bpf.c +++ b/common/bpf.c @@ -47,7 +47,7 @@ #ifndef lint static char copyright[] = -"$Id: bpf.c,v 1.46 2001/02/26 22:21:05 mellon Exp $ Copyright (c) 1995-2000 The Internet Software Consortium. All rights reserved.\n"; +"$Id: bpf.c,v 1.47 2001/04/05 20:47:34 mellon Exp $ Copyright (c) 1995-2000 The Internet Software Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" @@ -254,7 +254,7 @@ void if_register_receive (info) if (v.bv_major != BPF_MAJOR_VERSION || v.bv_minor < BPF_MINOR_VERSION) - log_fatal ("Kernel BPF version out of range - recompile dhcpd!"); + log_fatal ("BPF version mismatch - recompile DHCP!"); /* Set immediate mode so that reads return as soon as a packet comes in, rather than waiting for the input buffer to fill with @@ -422,8 +422,14 @@ ssize_t receive_packet (interface, buf, len, from, hfrom) length = read (interface -> rfdesc, interface -> rbuf, interface -> rbuf_max); - if (length <= 0) + if (length <= 0) { + if (errno == EIO) { + dhcp_interface_remove + ((omapi_object_t *)interface, + (omapi_object_t *)0); + } return length; + } interface -> rbuf_offset = 0; interface -> rbuf_len = BPF_WORDALIGN (length); }