Fix panic("ifpromisc failed") when shutting down a bpf tap when the attached

interface is no longer IFF_UP.
The test for IFF_UP in ifpromisc is only useful while enabling IFF_PROMISC
and the higher levels of the bpf code do not allow for the possibility of
failure while shutting down.  This is a trivial change.
Also, fixes PR#522.
This commit is contained in:
Peter Wemm 1995-07-31 10:35:36 +00:00
parent d3eede9d32
commit f0448ae4a2
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=9819

View file

@ -37,7 +37,7 @@
*
* @(#)bpf.c 8.2 (Berkeley) 3/28/94
*
* $Id: bpf.c,v 1.8 1995/06/15 18:10:57 pst Exp $
* $Id: bpf.c,v 1.9 1995/07/16 10:13:08 bde Exp $
*/
#include "bpfilter.h"
@ -1314,14 +1314,14 @@ ifpromisc(ifp, pswitch)
int pswitch;
{
struct ifreq ifr;
/*
* If the device is not configured up, we cannot put it in
* promiscuous mode.
*/
if ((ifp->if_flags & IFF_UP) == 0)
return (ENETDOWN);
if (pswitch) {
/*
* If the device is not configured up, we cannot put it in
* promiscuous mode.
*/
if ((ifp->if_flags & IFF_UP) == 0)
return (ENETDOWN);
if (ifp->if_pcount++ != 0)
return (0);
ifp->if_flags |= IFF_PROMISC;