Change the behavior of ifpromisc() slightly. If interface is not IFF_UP,

attempting to enable promisc would result in ENETDOWN.  Change this to
allow the interface to always be placed in promiscuous mode, regardless
of IFF_UP.  When the interface does come up, the IFF_PROMISC flag will
be consulted, and this matches the behavior that disabling promiscuous
mode has.
This commit is contained in:
thorpej 2000-10-01 23:16:07 +00:00
parent 0ae6087eae
commit 8dc841aa19
1 changed files with 6 additions and 5 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: if.c,v 1.70 2000/09/29 00:37:37 mellon Exp $ */
/* $NetBSD: if.c,v 1.71 2000/10/01 23:16:07 thorpej Exp $ */
/*-
* Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
@ -988,14 +988,15 @@ ifpromisc(ifp, pswitch)
flags = ifp->if_flags;
if (pswitch) {
/*
* If the device is not configured up, we cannot put it in
* promiscuous mode.
* Allow the device to be "placed" into promiscuous
* mode even if it is not configured up. It will
* consult IFF_PROMISC when it is is brought up.
*/
if ((ifp->if_flags & IFF_UP) == 0)
return (ENETDOWN);
if (ifp->if_pcount++ != 0)
return (0);
ifp->if_flags |= IFF_PROMISC;
if ((ifp->if_flags & IFF_UP) == 0)
return (0);
} else {
if (--ifp->if_pcount > 0)
return (0);