From 80c58504d772519cf04f8fddb876a3f0ce67168f Mon Sep 17 00:00:00 2001 From: mtaylor Date: Wed, 9 Apr 2008 03:24:05 +0000 Subject: [PATCH] This patch cleans up the VAP creation API. The need to use software instead of hardware for beacon timers in AP+STA mode (aka nosbeacon) is now just determined in software, as we always knew whether or not to enable this. The confusing bssid and -bssid parameters are now deprecated. The "uniquebssid" flag is equivalent to "bssid" and can be used to force IEEE80211_CLONE_BSSID flag. If this is not specified, then the BSSID used will be the next unused BSSID in the sequence, which could very well be the parent device's MAC address. "uniquebssid" equates directly to IEEE80211_CLONE_BSSID" flag therefore. git-svn-id: http://madwifi-project.org/svn/madwifi/trunk@3476 0192ed92-7a03-0410-a25b-9323aeb14dbd --- ath/if_ath.c | 12 ++++++++---- net80211/ieee80211.c | 2 +- net80211/ieee80211_ioctl.h | 4 ++-- tools/man/wlanconfig.8 | 13 ++++++++----- tools/wlanconfig.c | 14 ++++++++++---- 5 files changed, 29 insertions(+), 16 deletions(-) diff --git a/ath/if_ath.c b/ath/if_ath.c index c600efc..7572027 100644 --- a/ath/if_ath.c +++ b/ath/if_ath.c @@ -1227,13 +1227,17 @@ ath_vap_create(struct ieee80211com *ic, const char *name, case IEEE80211_M_STA: /* ap+sta for repeater application */ if (sc->sc_nstavaps != 0) /* only one sta regardless */ return NULL; - if ((sc->sc_nvaps != 0) && (!(flags & IEEE80211_NO_STABEACONS))) - return NULL; /* If using station beacons, must first up */ - if (flags & IEEE80211_NO_STABEACONS) { + /* If we already have an AP VAP, we can still add a station VAP + * but we must not attempt to re-use the hardware beacon timers + * since the AP is already using them, and we must stay in AP + * opmode. */ + if (sc->sc_nvaps != 0) { + flags |= IEEE80211_USE_SW_BEACON_TIMERS; sc->sc_nostabeacons = 1; ic_opmode = IEEE80211_M_HOSTAP; /* Run with chip in AP mode */ - } else + } else { ic_opmode = opmode; + } break; case IEEE80211_M_IBSS: if ((sc->sc_nvaps != 0) && (ic->ic_opmode == IEEE80211_M_STA)) diff --git a/net80211/ieee80211.c b/net80211/ieee80211.c index 4492a3b..0f3815a 100644 --- a/net80211/ieee80211.c +++ b/net80211/ieee80211.c @@ -454,7 +454,7 @@ ieee80211_vap_setup(struct ieee80211com *ic, struct net_device *dev, switch (opmode) { case IEEE80211_M_STA: /* WDS/Repeater */ - if (flags & IEEE80211_NO_STABEACONS) + if (flags & IEEE80211_USE_SW_BEACON_TIMERS) vap->iv_flags_ext |= IEEE80211_FEXT_SWBMISS; break; case IEEE80211_M_IBSS: diff --git a/net80211/ieee80211_ioctl.h b/net80211/ieee80211_ioctl.h index 992f27c..484b703 100644 --- a/net80211/ieee80211_ioctl.h +++ b/net80211/ieee80211_ioctl.h @@ -658,8 +658,8 @@ struct ieee80211_clone_params { char icp_name[IFNAMSIZ]; /* device name */ u_int16_t icp_opmode; /* operating mode */ u_int16_t icp_flags; /* see below */ -#define IEEE80211_CLONE_BSSID 0x0001 /* allocate unique mac/bssid */ -#define IEEE80211_NO_STABEACONS 0x0002 /* Do not setup the station beacon timers */ +#define IEEE80211_CLONE_BSSID 0x0001 /* allocate unique mac/bssid */ +#define IEEE80211_USE_SW_BEACON_TIMERS 0x0002 /* Do not setup the station beacon timers */ }; /* APPIEBUF related definitions */ diff --git a/tools/man/wlanconfig.8 b/tools/man/wlanconfig.8 index 128fdab..ac72199 100644 --- a/tools/man/wlanconfig.8 +++ b/tools/man/wlanconfig.8 @@ -18,7 +18,7 @@ underlying base device which is created when the driver is loaded. .PP .SH "ARGUMENTS" .TP -.B create [nounit] wlandev wlanmode [bssid|-bssid] [nosbeacon] +.B create [nounit] wlandev wlanmode [uniquebssid] Create the interface using the specified and . can either be a full interface name (e.g. 'ath0'), or just the suffix (e.g. 'ath'), in which case, the kernel will automatically append the next vacant integer. [nounit] will turn off the automatic integer increments. .TP .B destroy @@ -49,14 +49,17 @@ Create the station in WDS mode. .PP .SH "OPTIONS" .TP +.B uniquebssid +Create the VAP using a new unique MAC address, different from the underlying device. +.TP .B bssid -Create the VAP using a different MAC address from the underlying device. +Synonym for uniquebssid, for backward compatibility. .TP .B \-bssid -Create the VAP using the MAC address of the underlying device. -.TP +Ignored for backward compatibility. +.TP .B nosbeacon -When both station VAPS and AP VAPs coexist, the station should be created with the nosbeacon flag set in order to disable the use of hardware beacon times for the station. +Ignored for backward compatibility. .PP .SH "LIST ITEMS" .TP diff --git a/tools/wlanconfig.c b/tools/wlanconfig.c index cb6d6f1..179855a 100644 --- a/tools/wlanconfig.c +++ b/tools/wlanconfig.c @@ -284,7 +284,7 @@ static void usage(void) { fprintf(stderr, "usage: wlanconfig athX create [nounit] wlandev wifiY\n"); - fprintf(stderr, " wlanmode [sta|adhoc|ap|monitor|wds|ahdemo] [bssid | -bssid] [nosbeacon]\n"); + fprintf(stderr, " wlanmode [sta|adhoc|ap|monitor|wds|ahdemo] [uniquebssid]\n"); fprintf(stderr, "usage: wlanconfig athX destroy\n"); fprintf(stderr, "usage: wlanconfig athX list [active|ap|caps|chan|freq|keys|scan|sta|wme]\n"); exit(-1); @@ -318,10 +318,16 @@ getflag(const char *s) int flag = 0; cp = (s[0] == '-' ? s + 1 : s); - if (strcmp(cp, "bssid") == 0) + if (strcmp(cp, "bssid") == 0) { + printf("WARNING: the -bssid and bssid flags are deprecated.\n"); flag = IEEE80211_CLONE_BSSID; - if (strcmp(cp, "nosbeacon") == 0) - flag |= IEEE80211_NO_STABEACONS; + } + if (strcmp(cp, "uniquebssid") == 0) + flag = IEEE80211_CLONE_BSSID; + if (strcmp(cp, "nosbeacon") == 0) { + printf("WARNING: the nosbeacon flag has been deprecated.\n"); + return 0; /* deprecated but skip */ + } if (flag == 0) errx(1, "unknown create option %s", s); return (s[0] == '-' ? -flag : flag); -- 2.35.1