From d3ac8cfdf8c457c11bb8541dbac8ae5662bb076d Mon Sep 17 00:00:00 2001 From: Mike Belopuhov Date: Wed, 16 Nov 2011 11:59:29 +0000 Subject: Improve flag setting ioctl so that bulk updates are requested only when we're going up, not when we set PROMISC or any other flag. Fixes spontaneous CARP failovers when running tcpdump on pfsync. ok henning, mcbride, camield --- sys/net/if_pfsync.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sys/net/if_pfsync.c b/sys/net/if_pfsync.c index 1d0c4205137..660a60f68c9 100644 --- a/sys/net/if_pfsync.c +++ b/sys/net/if_pfsync.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_pfsync.c,v 1.173 2011/11/09 12:36:03 camield Exp $ */ +/* $OpenBSD: if_pfsync.c,v 1.174 2011/11/16 11:59:28 mikeb Exp $ */ /* * Copyright (c) 2002 Michael Shalayeff @@ -1290,10 +1290,13 @@ pfsyncioctl(struct ifnet *ifp, u_long cmd, caddr_t data) #endif case SIOCSIFFLAGS: s = splnet(); - if (ifp->if_flags & IFF_UP) { + if ((ifp->if_flags & IFF_RUNNING) == 0 && + (ifp->if_flags & IFF_UP)) { ifp->if_flags |= IFF_RUNNING; pfsync_request_full_update(sc); - } else { + } + if ((ifp->if_flags & IFF_RUNNING) && + (ifp->if_flags & IFF_UP) == 0) { ifp->if_flags &= ~IFF_RUNNING; /* drop everything */ -- cgit v1.2.3