summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormarkus <markus@openbsd.org>2012-10-08 18:33:23 +0000
committermarkus <markus@openbsd.org>2012-10-08 18:33:23 +0000
commit4b27cf5c9ad432d39a7ffff20e714f2ec19625ef (patch)
tree18883d46a83705e260b33ecfc7c58013916cc0cf
parentAdd Huawei E352. (diff)
downloadwireguard-openbsd-4b27cf5c9ad432d39a7ffff20e714f2ec19625ef.tar.xz
wireguard-openbsd-4b27cf5c9ad432d39a7ffff20e714f2ec19625ef.zip
make sure we don't call hook_disestablish() twice e.g. ifconfig -syncdev
followed by ifconfig destroy; ok mikeb
-rw-r--r--sys/net/if_pfsync.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/sys/net/if_pfsync.c b/sys/net/if_pfsync.c
index 5086ac8279b..972acb1bc12 100644
--- a/sys/net/if_pfsync.c
+++ b/sys/net/if_pfsync.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_pfsync.c,v 1.192 2012/09/20 17:37:47 mikeb Exp $ */
+/* $OpenBSD: if_pfsync.c,v 1.193 2012/10/08 18:33:23 markus Exp $ */
/*
* Copyright (c) 2002 Michael Shalayeff
@@ -366,10 +366,12 @@ pfsync_clone_destroy(struct ifnet *ifp)
if (sc->sc_link_demoted)
carp_group_demote_adj(&sc->sc_if, -1, "pfsync destroy");
#endif
- if (sc->sc_lhcookie != NULL)
+ if (sc->sc_lhcookie != NULL) {
hook_disestablish(
sc->sc_sync_if->if_linkstatehooks,
sc->sc_lhcookie);
+ sc->sc_lhcookie = NULL;
+ }
if_detach(ifp);
pfsync_drop(sc);
@@ -1349,10 +1351,12 @@ pfsyncioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
sc->sc_defer = pfsyncr.pfsyncr_defer;
if (pfsyncr.pfsyncr_syncdev[0] == 0) {
- if (sc->sc_lhcookie != NULL)
+ if (sc->sc_lhcookie != NULL) {
hook_disestablish(
sc->sc_sync_if->if_linkstatehooks,
sc->sc_lhcookie);
+ sc->sc_lhcookie = NULL;
+ }
sc->sc_sync_if = NULL;
if (imo->imo_num_memberships > 0) {
in_delmulti(imo->imo_membership[
@@ -1385,10 +1389,12 @@ pfsyncioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
struct in_addr addr;
if (!(sc->sc_sync_if->if_flags & IFF_MULTICAST)) {
- if (sc->sc_lhcookie != NULL)
+ if (sc->sc_lhcookie != NULL) {
hook_disestablish(
sc->sc_sync_if->if_linkstatehooks,
sc->sc_lhcookie);
+ sc->sc_lhcookie = NULL;
+ }
sc->sc_sync_if = NULL;
splx(s);
return (EADDRNOTAVAIL);
@@ -1398,10 +1404,12 @@ pfsyncioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
if ((imo->imo_membership[0] =
in_addmulti(&addr, sc->sc_sync_if)) == NULL) {
- if (sc->sc_lhcookie != NULL)
+ if (sc->sc_lhcookie != NULL) {
hook_disestablish(
sc->sc_sync_if->if_linkstatehooks,
sc->sc_lhcookie);
+ sc->sc_lhcookie = NULL;
+ }
sc->sc_sync_if = NULL;
splx(s);
return (ENOBUFS);