summaryrefslogtreecommitdiff
path: root/sys/dev/pcmcia
diff options
context:
space:
mode:
authorMarcus Glocker <mglocker@cvs.openbsd.org>2007-08-09 21:24:03 +0000
committerMarcus Glocker <mglocker@cvs.openbsd.org>2007-08-09 21:24:03 +0000
commit74588e2bdbfb7bef1354d82701f8c6f7b4439c0b (patch)
tree50a9f1e90bccc3f1ce27c40877b720ff82628edb /sys/dev/pcmcia
parent527fb7b308023118049671212e98cc250c613b31 (diff)
If an association has failed, set the device back to INIT state.
Diffstat (limited to 'sys/dev/pcmcia')
-rw-r--r--sys/dev/pcmcia/if_malo.c18
-rw-r--r--sys/dev/pcmcia/if_malovar.h3
2 files changed, 15 insertions, 6 deletions
diff --git a/sys/dev/pcmcia/if_malo.c b/sys/dev/pcmcia/if_malo.c
index 5d06b5fa08d..27af1fb5d48 100644
--- a/sys/dev/pcmcia/if_malo.c
+++ b/sys/dev/pcmcia/if_malo.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_malo.c,v 1.48 2007/08/09 15:10:41 mglocker Exp $ */
+/* $OpenBSD: if_malo.c,v 1.49 2007/08/09 21:24:02 mglocker Exp $ */
/*
* Copyright (c) 2007 Marcus Glocker <mglocker@openbsd.org>
@@ -608,10 +608,12 @@ cmalo_init(struct ifnet *ifp)
cmalo_intr_mask(sc, 1);
}
+ /* reset association state flag */
+ sc->sc_flags &= ~MALO_ASSOC_FAILED;
+
/* get current channel */
ic->ic_bss->ni_chan = ic->ic_ibss_chan;
sc->sc_curchan = ieee80211_chan2ieee(ic, ic->ic_bss->ni_chan);
-
DPRINTF(1, "%s: current channel is %d\n",
sc->sc_dev.dv_xname, sc->sc_curchan);
@@ -648,10 +650,13 @@ cmalo_init(struct ifnet *ifp)
ifp->if_flags |= IFF_RUNNING;
ifp->if_flags &= ~IFF_OACTIVE;
+ /* start network */
if (ic->ic_opmode != IEEE80211_M_MONITOR)
ieee80211_new_state(ic, IEEE80211_S_SCAN, -1);
-
- ieee80211_new_state(ic, IEEE80211_S_RUN, -1);
+ if (sc->sc_flags & MALO_ASSOC_FAILED)
+ ieee80211_new_state(ic, IEEE80211_S_INIT, -1);
+ else
+ ieee80211_new_state(ic, IEEE80211_S_RUN, -1);
/* we are not context save anymore for FW commands */
sc->sc_cmd_ctxsave = 0;
@@ -1730,7 +1735,10 @@ cmalo_cmd_rsp_assoc(struct malo_softc *sc)
if (body->status) {
DPRINTF(1, "%s: association failed (status %d)!\n",
sc->sc_dev.dv_xname, body->status);
- }
+ sc->sc_flags |= MALO_ASSOC_FAILED;
+ } else
+ DPRINTF(1, "%s: association successful\n",
+ sc->sc_dev.dv_xname, body->status);
return (0);
}
diff --git a/sys/dev/pcmcia/if_malovar.h b/sys/dev/pcmcia/if_malovar.h
index ae7c7c8f620..b630445b99e 100644
--- a/sys/dev/pcmcia/if_malovar.h
+++ b/sys/dev/pcmcia/if_malovar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_malovar.h,v 1.23 2007/08/09 14:50:06 mglocker Exp $ */
+/* $OpenBSD: if_malovar.h,v 1.24 2007/08/09 21:24:02 mglocker Exp $ */
/*
* Copyright (c) 2007 Marcus Glocker <mglocker@openbsd.org>
@@ -41,6 +41,7 @@
/* device flags */
#define MALO_DEVICE_ATTACHED (1 << 0)
#define MALO_FW_LOADED (1 << 1)
+#define MALO_ASSOC_FAILED (1 << 2)
/*
* FW command structures