mirror of
https://github.com/freebsd/freebsd-src
synced 2024-11-05 18:22:52 +00:00
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:
parent
d3eede9d32
commit
f0448ae4a2
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=9819
1 changed files with 7 additions and 7 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue