summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Bergamini <damien@cvs.openbsd.org>2004-10-27 21:17:19 +0000
committerDamien Bergamini <damien@cvs.openbsd.org>2004-10-27 21:17:19 +0000
commitff22d06b8cf8e4cc0ab88caaebe70f515c331770 (patch)
treea91e306d72beb1692d6b11791338c07afd1f8782
parent2d7e55def81bd27b8cec81f265d2716dad163699 (diff)
Add authmode support (imported from iwi).
-rw-r--r--sys/dev/pci/if_ipw.c24
-rw-r--r--sys/dev/pci/if_ipwvar.h4
2 files changed, 23 insertions, 5 deletions
diff --git a/sys/dev/pci/if_ipw.c b/sys/dev/pci/if_ipw.c
index 495c0fa7fab..720007bf6fb 100644
--- a/sys/dev/pci/if_ipw.c
+++ b/sys/dev/pci/if_ipw.c
@@ -1,4 +1,4 @@
-/* $Id: if_ipw.c,v 1.7 2004/10/27 21:16:45 damien Exp $ */
+/* $Id: if_ipw.c,v 1.8 2004/10/27 21:17:18 damien Exp $ */
/*-
* Copyright (c) 2004
@@ -228,6 +228,9 @@ ipw_attach(struct device *parent, struct device *self, void *aux)
ic->ic_channels[i].ic_flags = IEEE80211_CHAN_B;
}
+ /* default to authmode OPEN */
+ sc->authmode = IEEE80211_AUTH_OPEN;
+
/* IBSS channel undefined for now */
ic->ic_ibss_chan = &ic->ic_channels[0];
@@ -963,11 +966,23 @@ ipw_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
ipw_reset(sc);
break;
+ case SIOCG80211AUTH:
+ ((struct ieee80211_auth *)data)->i_authtype = sc->authmode;
+ break;
+
+ case SIOCS80211AUTH:
+ /* only super-user can do that! */
+ if ((error = suser(curproc, 0)) != 0)
+ break;
+
+ sc->authmode = ((struct ieee80211_auth *)data)->i_authtype;
+ break;
+
default:
error = ieee80211_ioctl(ifp, cmd, data);
- if (error != ENETRESET)
- break;
+ }
+ if (error == ENETRESET && cmd != SIOCADDMULTI) {
if ((ifp->if_flags & (IFF_UP | IFF_RUNNING)) ==
(IFF_UP | IFF_RUNNING))
ipw_init(ifp);
@@ -1788,7 +1803,8 @@ ipw_config(struct ipw_softc *sc)
return error;
}
- security.authmode = IPW_AUTH_OPEN;
+ security.authmode = (sc->authmode == IEEE80211_AUTH_SHARED) ?
+ IPW_AUTH_SHARED : IPW_AUTH_OPEN;
security.ciphers = htole32(IPW_CIPHER_NONE);
security.version = htole16(0);
security.replay_counters_number = 0;
diff --git a/sys/dev/pci/if_ipwvar.h b/sys/dev/pci/if_ipwvar.h
index 8c60338934e..d0c21a66b9e 100644
--- a/sys/dev/pci/if_ipwvar.h
+++ b/sys/dev/pci/if_ipwvar.h
@@ -1,4 +1,4 @@
-/* $Id: if_ipwvar.h,v 1.1 2004/10/20 12:50:48 deraadt Exp $ */
+/* $Id: if_ipwvar.h,v 1.2 2004/10/27 21:17:18 damien Exp $ */
/*-
* Copyright (c) 2004
@@ -92,6 +92,8 @@ struct ipw_softc {
pci_chipset_tag_t sc_pct;
bus_size_t sc_sz;
+ int authmode;
+
int sc_tx_timer;
bus_dma_tag_t sc_dmat;