summaryrefslogtreecommitdiff
path: root/sys/netinet/ip_carp.c
diff options
context:
space:
mode:
authorRyan Thomas McBride <mcbride@cvs.openbsd.org>2004-12-08 08:16:45 +0000
committerRyan Thomas McBride <mcbride@cvs.openbsd.org>2004-12-08 08:16:45 +0000
commit0e7001333aa1ea960666eb4666debbbf19696b23 (patch)
treed26fb2cecd6aa7235b530d2ab14edc7038558e5d /sys/netinet/ip_carp.c
parent22906c768e21d33b937ea1ffbe0abaa2b29299eb (diff)
Remove code duplication duplication. Use carpdetach() in carp_clone_destroy().
Diffstat (limited to 'sys/netinet/ip_carp.c')
-rw-r--r--sys/netinet/ip_carp.c22
1 files changed, 3 insertions, 19 deletions
diff --git a/sys/netinet/ip_carp.c b/sys/netinet/ip_carp.c
index aeb476625a7..66f7d55a168 100644
--- a/sys/netinet/ip_carp.c
+++ b/sys/netinet/ip_carp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_carp.c,v 1.75 2004/12/08 07:05:18 mcbride Exp $ */
+/* $OpenBSD: ip_carp.c,v 1.76 2004/12/08 08:16:44 mcbride Exp $ */
/*
* Copyright (c) 2002 Michael Shalayeff. All rights reserved.
@@ -731,26 +731,10 @@ carp_clone_create(ifc, unit)
int
carp_clone_destroy(struct ifnet *ifp)
{
- struct carp_softc *sc = ifp->if_softc;
- struct carp_if *cif;
-
- timeout_del(&sc->sc_ad_tmo);
- timeout_del(&sc->sc_md_tmo);
- timeout_del(&sc->sc_md6_tmo);
-
- if (sc->sc_carpdev != NULL) {
- cif = (struct carp_if *)sc->sc_carpdev->if_carp;
- TAILQ_REMOVE(&cif->vhif_vrs, sc, sc_list);
- if (!--cif->vhif_nvrs) {
- ifpromisc(sc->sc_carpdev, 0);
- sc->sc_carpdev->if_carp = NULL;
- FREE(cif, M_IFADDR);
- }
- }
-
+ carpdetach(ifp->if_softc);
ether_ifdetach(ifp);
if_detach(ifp);
- free(sc, M_DEVBUF);
+ free(ifp->if_softc, M_DEVBUF);
return (0);
}