summaryrefslogtreecommitdiff
path: root/sys/netinet
diff options
context:
space:
mode:
authorPatrick Latifi <pat@cvs.openbsd.org>2004-12-08 17:06:13 +0000
committerPatrick Latifi <pat@cvs.openbsd.org>2004-12-08 17:06:13 +0000
commit157a73eff774014ffb079b2baeb65cafcd5f4700 (patch)
treed870909a04f8895f6ea62d410741308be79b4075 /sys/netinet
parentf2120ac63bde84542bee3561875a26beae9eb6e6 (diff)
* knf
* M_WAITOK -> M_NOWAIT * FREE() only when necessary * join_multicast6 for ip6 addresses mcbride ok
Diffstat (limited to 'sys/netinet')
-rw-r--r--sys/netinet/ip_carp.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/sys/netinet/ip_carp.c b/sys/netinet/ip_carp.c
index 66f7d55a168..f35081bc8c1 100644
--- a/sys/netinet/ip_carp.c
+++ b/sys/netinet/ip_carp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_carp.c,v 1.76 2004/12/08 08:16:44 mcbride Exp $ */
+/* $OpenBSD: ip_carp.c,v 1.77 2004/12/08 17:06:12 pat Exp $ */
/*
* Copyright (c) 2002 Michael Shalayeff. All rights reserved.
@@ -1391,7 +1391,8 @@ carp_setrun(struct carp_softc *sc, sa_family_t af)
}
void
-carp_multicast_cleanup(struct carp_softc *sc) {
+carp_multicast_cleanup(struct carp_softc *sc)
+{
struct ip_moptions *imo = &sc->sc_imo;
struct ip6_moptions *im6o = &sc->sc_im6o;
@@ -1432,8 +1433,8 @@ carp_set_ifp(struct carp_softc *sc, struct ifnet *ifp)
if (ifp->if_carp == NULL) {
MALLOC(ncif, struct carp_if *, sizeof(*cif),
- M_IFADDR, M_WAITOK);
- if (!ncif)
+ M_IFADDR, M_NOWAIT);
+ if (ncif == NULL)
return (ENOBUFS);
if ((error = ifpromisc(ifp, 1))) {
FREE(ncif, M_IFADDR);
@@ -1456,13 +1457,16 @@ carp_set_ifp(struct carp_softc *sc, struct ifnet *ifp)
/* join multicast groups */
if (sc->sc_naddrs < 0 &&
(error = carp_join_multicast(sc, ifp)) != 0) {
- FREE(ncif, M_IFADDR);
+ if (ncif != NULL)
+ FREE(ncif, M_IFADDR);
return (error);
}
if (sc->sc_naddrs6 < 0 &&
- (error = carp_join_multicast(sc, ifp)) != 0) {
- FREE(ncif, M_IFADDR);
+ (error = carp_join_multicast6(sc, ifp)) != 0) {
+ if (ncif != NULL)
+ FREE(ncif, M_IFADDR);
+ carp_multicast_cleanup(sc);
return (error);
}