summaryrefslogtreecommitdiffstats
path: root/sys/net80211
diff options
context:
space:
mode:
authorsam <sam@FreeBSD.org>2004-03-30 22:53:52 +0000
committersam <sam@FreeBSD.org>2004-03-30 22:53:52 +0000
commit551dbe5269c14d7ffc9efcd174423b3756c882bb (patch)
treebe8a4656a5d0baeec3902f59c479ad2e424f8d2c /sys/net80211
parent49277b7d21d6a18801daed35f00ab1d5be1e03d2 (diff)
downloadFreeBSD-src-551dbe5269c14d7ffc9efcd174423b3756c882bb.zip
FreeBSD-src-551dbe5269c14d7ffc9efcd174423b3756c882bb.tar.gz
Only call if_init when doing SIOCSIFADDR if the interface is not marked
up (IFF_UP). This eliminates extraneous AP scanning. Reviewed by: imp
Diffstat (limited to 'sys/net80211')
-rw-r--r--sys/net80211/ieee80211_ioctl.c60
1 files changed, 60 insertions, 0 deletions
diff --git a/sys/net80211/ieee80211_ioctl.c b/sys/net80211/ieee80211_ioctl.c
index ecd3d3b..99779f2 100644
--- a/sys/net80211/ieee80211_ioctl.c
+++ b/sys/net80211/ieee80211_ioctl.c
@@ -37,6 +37,9 @@ __FBSDID("$FreeBSD$");
* IEEE 802.11 ioctl support (FreeBSD-specific)
*/
+#include "opt_inet.h"
+#include "opt_ipx.h"
+
#include <sys/endian.h>
#include <sys/param.h>
#include <sys/kernel.h>
@@ -49,6 +52,16 @@ __FBSDID("$FreeBSD$");
#include <net/if_media.h>
#include <net/ethernet.h>
+#ifdef INET
+#include <netinet/in.h>
+#include <netinet/if_ether.h>
+#endif
+
+#ifdef IPX
+#include <netipx/ipx.h>
+#include <netipx/ipx_if.h>
+#endif
+
#include <net80211/ieee80211_var.h>
#include <net80211/ieee80211_ioctl.h>
@@ -756,6 +769,7 @@ ieee80211_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
u_int8_t tmpkey[IEEE80211_KEYBUF_SIZE];
char tmpssid[IEEE80211_NWID_LEN];
struct ieee80211_channel *chan;
+ struct ifaddr *ifa; /* XXX */
switch (cmd) {
case SIOCSIFMEDIA:
@@ -861,6 +875,7 @@ ieee80211_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
break;
default:
error = EINVAL;
+ break;
}
break;
case SIOCS80211:
@@ -1026,6 +1041,51 @@ ieee80211_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
else
ifp->if_mtu = ifr->ifr_mtu;
break;
+ case SIOCSIFADDR:
+ /*
+ * XXX Handle this directly so we can supress if_init calls.
+ * XXX This should be done in ether_ioctl but for the moment
+ * XXX there are too many other parts of the system that
+ * XXX set IFF_UP and so supress if_init being called when
+ * XXX it should be.
+ */
+ ifa = (struct ifaddr *) data;
+ switch (ifa->ifa_addr->sa_family) {
+#ifdef INET
+ case AF_INET:
+ if ((ifp->if_flags & IFF_UP) == 0) {
+ ifp->if_flags |= IFF_UP;
+ ifp->if_init(ifp->if_softc);
+ }
+ arp_ifinit(ifp, ifa);
+ break;
+#endif
+#ifdef IPX
+ /*
+ * XXX - This code is probably wrong,
+ * but has been copied many times.
+ */
+ case AF_IPX: {
+ struct ipx_addr *ina = &(IA_SIPX(ifa)->sipx_addr);
+ struct arpcom *ac = (struct arpcom *)ifp;
+
+ if (ipx_nullhost(*ina))
+ ina->x_host = *(union ipx_host *) ac->ac_enaddr;
+ else
+ bcopy((caddr_t) ina->x_host.c_host,
+ (caddr_t) ac->ac_enaddr,
+ sizeof(ac->ac_enaddr));
+ /* fall thru... */
+ }
+#endif
+ default:
+ if ((ifp->if_flags & IFF_UP) == 0) {
+ ifp->if_flags |= IFF_UP;
+ ifp->if_init(ifp->if_softc);
+ }
+ break;
+ }
+ break;
default:
error = ether_ioctl(ifp, cmd, data);
break;
OpenPOWER on IntegriCloud