diff options
author | Hauke Mehrtens <hauke@hauke-m.de> | 2013-11-11 22:02:14 +0000 |
---|---|---|
committer | Hauke Mehrtens <hauke@hauke-m.de> | 2013-11-11 22:02:14 +0000 |
commit | 3c2904bfb8ead3dd48fdfee728a66ec06561481d (patch) | |
tree | 2bc2722b77d4007345421875bd4dc20c531e139d /package/kernel | |
parent | 4ba2f2f7318837f6beaa4b5472b272f6f092254c (diff) | |
download | mtk-20170518-3c2904bfb8ead3dd48fdfee728a66ec06561481d.zip mtk-20170518-3c2904bfb8ead3dd48fdfee728a66ec06561481d.tar.gz mtk-20170518-3c2904bfb8ead3dd48fdfee728a66ec06561481d.tar.bz2 |
broadcom-wl: add support for setting H/W address
Some devices initialize with a default address (common to all H/W).
The address needs to be changeable so that a unique address can be
assigned to each AP.
Signed-off-by: Nathan Hintz <nlhintz@hotmail.com>
SVN-Revision: 38757
Diffstat (limited to 'package/kernel')
-rw-r--r-- | package/kernel/broadcom-wl/files/lib/wifi/broadcom.sh | 15 | ||||
-rw-r--r-- | package/kernel/broadcom-wl/src/wlc.c | 7 |
2 files changed, 18 insertions, 4 deletions
diff --git a/package/kernel/broadcom-wl/files/lib/wifi/broadcom.sh b/package/kernel/broadcom-wl/files/lib/wifi/broadcom.sh index 0dd25a3..892a415 100644 --- a/package/kernel/broadcom-wl/files/lib/wifi/broadcom.sh +++ b/package/kernel/broadcom-wl/files/lib/wifi/broadcom.sh @@ -97,7 +97,6 @@ disable_broadcom() { local device="$1" set_wifi_down "$device" wlc ifname "$device" down - wlc ifname "$device" bssid `wlc ifname "$device" default_bssid` ( include /lib/network @@ -131,7 +130,7 @@ enable_broadcom() { config_get_bool frameburst "$device" frameburst config_get macfilter "$device" macfilter config_get maclist "$device" maclist - config_get macaddr "$device" macaddr + config_get macaddr "$device" macaddr $(wlc ifname "$device" default_bssid) config_get txpower "$device" txpower config_get frag "$device" frag config_get rts "$device" rts @@ -199,7 +198,7 @@ enable_broadcom() { local _c=0 local nas="$(which nas)" - local if_up nas_cmd + local if_pre_up if_up nas_cmd local vif vif_pre_up vif_post_up vif_do_up vif_txpower for vif in $vifs; do @@ -340,7 +339,10 @@ enable_broadcom() { local ifname config_get ifname "$vif" ifname - #append if_up "ifconfig $ifname up" ";$N" + local if_cmd="if_pre_up" + [ "$ifname" != "${ifname##${device}-}" ] && if_cmd="if_up" + append $if_cmd "macaddr=\$(wlc ifname '$ifname' cur_etheraddr)" ";$N" + append $if_cmd "ifconfig '$ifname' \${macaddr:+hw ether \$macaddr}" ";$N" local net_cfg="$(find_net_config "$vif")" [ -z "$net_cfg" ] || { @@ -362,6 +364,8 @@ enable_broadcom() { wlc ifname "$device" stdin <<EOF $ifdown +${macaddr:+bssid $macaddr} +${macaddr:+cur_etheraddr $macaddr} band ${band:-0} ${nmode:+nmode $nmode} ${nmode:+${nreqd:+nreqd $nreqd}} @@ -393,6 +397,9 @@ slottime ${slottime:--1} ${frameburst:+frameburst $frameburst} $vif_pre_up +EOF + eval "$if_pre_up" + wlc ifname "$device" stdin <<EOF up $vif_post_up EOF diff --git a/package/kernel/broadcom-wl/src/wlc.c b/package/kernel/broadcom-wl/src/wlc.c index 9f4abc0..21754a7 100644 --- a/package/kernel/broadcom-wl/src/wlc.c +++ b/package/kernel/broadcom-wl/src/wlc.c @@ -892,6 +892,13 @@ static const struct wlc_call wlc_calls[] = { .desc = "BSSID" }, { + .name = "cur_etheraddr", + .param = MAC, + .handler = wlc_iovar, + .data.str = "cur_etheraddr", + .desc = "Current MAC Address" + }, + { .name = "default_bssid", .param = MAC, .handler = wlc_iovar, |