Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

acx-mac80211: problem after mac-change

binarxy
2012-02-13
2013-02-17
1 2 > >> (Page 1 of 2)
  • binarxy
    binarxy
    2012-02-13

    Hello,

    firstly thx Oliver, the driver works nicely (I wanted to throw my card away but you saved it).
    But I got an Problem, when I change my mac I can't associate with my router if I change the mac back it works again.
    It seems the Same Problem was already there in 2007 (see Thread:https://sourceforge.net/projects/acx100/forums/forum/257272/topic/1528943?message=3804495)
    My Kernel version is 2.6.34

     
  • Oliver Winker
    Oliver Winker
    2012-02-14

    Hi binarxy,

    That could indeed be, that the mac address setting is not fully working currently … I'll take look what can be done there.

    Cheers, Oliver

     
  • binarxy
    binarxy
    2012-02-14

    Thx, that you take some of your time. If it helps I have a DWL-G520+ and I could run some test.

     
  • Oliver Winker
    Oliver Winker
    2012-02-19

    Hi binarxy,

    Could you try commit b78ee5 ? I tested it in STA, and it seems to work so far.

    Cheers, Oliver

     
  • binarxy
    binarxy
    2012-02-21

    Hello Oliver,

    I've just tested it and it works! Let me thank you again, I wouldn't know what to do with my card without this driver.

     
  • Oliver Winker
    Oliver Winker
    2012-02-21

    Ok, perfect ;)! Thanks a lot for the feedback!

     
  • With current OpenWrt trunk, this still does not work. I set the MAC in its config file, and afterward, ifconfig reports the new MAC, but dmesg shows the station being activated (AP mode) with the original MAC, and "iwlist scan" from a computer shows it having the original MAC. Since the ACX on AR7 devices tend to have dummy MAC values in the EEPROM, this is not good.

     
  • Oliver Winker
    Oliver Winker
    2012-07-04

    Hi, I'll recheck that again the coming days (possibly next week). Probably not a big deal, since it already worked. BR, Oliver

     
  • Oliver Winker
    Oliver Winker
    2012-07-06

    Hi,

    Could you already try the patch below please ?

    Some basic tests in AP and STA it look ok so far, but I would still like to do some more detailed tests before commiting it.

    BR, Oliver

    diff --git a/common.c b/common.c
    index f6ad44e..1a38502 100644
    --- a/common.c
    +++ b/common.c
    @@ -3185,7 +3185,7 @@ static int acx_update_rx_config(acx_device_t *adev)
                       | RX_CFG2_RCV_DATA_FRAMES
                       /*| RX_CFG2_RCV_BROKEN_FRAMES   */
                       | RX_CFG2_RCV_MGMT_FRAMES
    -                  | RX_CFG2_RCV_PROBE_REQ
    +                  /* | RX_CFG2_RCV_PROBE_REQ */
                       | RX_CFG2_RCV_PROBE_RESP
                       /*| RX_CFG2_RCV_ACK_FRAMES*/
                       | RX_CFG2_RCV_OTHER
    @@ -3341,7 +3341,7 @@ static int acx_set_beacon(acx_device_t *adev, struct sk_buff *beacon)
             * 0x80 bit in ratevector from STA.  We can 'fix' it by not
             * using this template and sending probe responses by
             * hand. TODO --vda */
    -       res = acx_set_probe_response_template(adev, beacon->data, len_wo_tim);
    +       res = acx_set_probe_response_template(adev, beacon->data, beacon->len);
            if (res)
                    goto out;
            /* acx_s_set_probe_response_template_off(adev); */
    @@ -6253,7 +6253,8 @@ int acx_op_add_interface(struct ieee80211_hw *ieee, struct ieee80211_VIF *vif)
    
            /* Reconfigure mac-address globally, affecting all vifs */
            if (!mac_is_equal(mac_vif, adev->dev_addr)) {
    -
    +               memcpy(adev->dev_addr, mac_vif, ETH_ALEN);
    +               memcpy(adev->bssid, mac_vif, ETH_ALEN);
                    acx1xx_set_station_id(adev, mac_vif);
                    SET_IEEE80211_PERM_ADDR(adev->ieee, adev->dev_addr);
            }
    @@ -6406,6 +6407,9 @@ void acx_op_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
    
            if (changed & BSS_CHANGED_BSSID) {
                    MAC_COPY(adev->bssid, info->bssid);
    +
    +               logf0(L_ANY, "Redoing join following bssid update\n");
    +               acx_cmd_join_bssid(adev, adev->bssid);
            }
    
            /* BOM BSS_CHANGED_BEACON */
    @@ -6419,8 +6423,8 @@ void acx_op_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
                            return;
                    }
    
    -               acx_set_beacon(adev, beacon);
                    adev->beacon_interval = info->beacon_int;
    +               acx_set_beacon(adev, beacon);
    
                    dev_kfree_skb(beacon);
            }
    
     
  • The above patch does seem to fix it.

    Probably unrelated:
    This may be an OpenWrt peculiarity, I don't know, but I can't seem to get the AP interface brought up on boot; I have to bring it up manually. Any ideas?

     
  • Hello?

     
  • Oliver Winker
    Oliver Winker
    2012-07-16

    Hi, sorry for the delay - was quite busy last week.

    I didn't tried that yet myself yet (depends a bit if I find the time).

    Anyway, it is indeed like this, that the OpenWRT networking scripts use the mac-addr to address the wifi-device. Now we change that one of course, which maybe puzzles things a bit more.

    Try maybe in part of /etc/config/wireless below onetime the new and also the old mac-addr. Maybe the script first still need to depend on the old one, before you can assign the new mac-addr.

    BR, Oliver

    config wifi-device  radio0
            option type     mac80211
            option channel  11
            option macaddr  00:13:10:49:e4:1c
            option hwmode   11g
            # REMOVE THIS LINE TO ENABLE WIFI:
            #option disabled 1
    
     
  • I don't quite understand: Are you making some kind of suggestion? OpenWrt never had a problem addressing the device. It just can't bring it up on boot.

     
  • Oliver Winker
    Oliver Winker
    2012-07-17

    Try to configure it as shown below. Just tested it on a wag54gv2 with trunk r31685 and in my case it works: device brought up at boot with mac "00:11:22:33:44:55".

    root@OpenWrt:/# cat /etc/config/wireless
    config wifi-device  radio0
            option type     mac80211
            option channel  11
            option macaddr  00:13:10:49:e4:1c
            option hwmode   11g
            # REMOVE THIS LINE TO ENABLE WIFI:
            #option disabled 1
    config wifi-iface
            option device   radio0
            option network  lan
            option mode     ap
            option ssid     OpenWRT
            option encryption psk2
            option key      'SharedSecret'
            option macaddr  00:11:22:33:44:55
    

    -Oliver

     
  • I don't know about r31685, but it sure doesn't work on trunk r32643 on my gt704wg.

     
  • Ideas?

     
  • Oliver Winker
    Oliver Winker
    2012-07-21

    Ideas? … personally I think that it will probably something in the setup scripts, that simply needs to be investigated one time. There will well be some reason for it. Some simple greps below can possibly give already some indications of places.

    Currently I'm busy with something in the driver, so I don't have the time and I'm also not on the latest OpenWrt trunk (and I don't feel like updating right now, since I'm busy …). So remains maybe to read the scripts manually or check maybe with OpenWrt ?

    root@OpenWrt:/etc/config# grep wifi-device -r -I $(find /bin /etc /lib /sbin /us
    r -type f)
    /etc/config/wireless:config wifi-device  radio0
    [...]
    /lib/wifi/mac80211.sh:config wifi-device  radio$devidx
    /sbin/wifi:                     wifi-device)
    root@OpenWrt:/etc/config# 
    root@OpenWrt:/etc/config# grep macaddr -r -I $(find /bin /etc /lib /sbin /usr -t
    ype f)
    [...]
    /lib/functions/uci-defaults.sh:ucidef_set_interface_macaddr() {
    [...]
    /lib/network/config.sh: local macaddr="$3"
    [...]
    /lib/network/config.sh:                 config_get macaddr "$config" macaddr
    /lib/network/config.sh:                                 [ -z "$macaddr" ] && macaddr="$(cat /sys/class/net/$iface/address)"
    [...]
    /lib/network/config.sh:                         ifconfig "$iface" ${macaddr:+hw ether "${macaddr}"} up 2>/dev/null >/dev/null
    [...]
    
     
  • That didn't tell me anything. Here is dmesg from OpenWrt trying to bring it up on boot:

    [   46.660000] Updating initial settings
    [   46.670000] Updating station_id to: AA:AA:AA:AA:AA:AA
    [   46.680000] Updating Tx fallback to 1 retries
    [   46.700000] Updating tx-power-level to: 1
    [   46.710000] Updating antenna[0,1]: 0x4A 0x04
    [   46.730000] Updating the Energy Detect (ED) threshold: 0
    [   46.740000] acx111 doesn't support ED threshold
    [   46.760000] Updating the Channel Clear Assessment (CCA) value: 0x00
    [   46.780000] acx111 doesn't support CCA
    [   46.790000] Updating the short retry limit: 7, long retry limit: 4
    [   46.810000] Updating the tx MSDU lifetime: 4096
    [   46.830000] Updating the regulatory domain: 0x10
    [   46.840000] Updating to mode=0x0002
    [   46.860000] Updating RXconfig to mode=0x0002,rx_config_1:2=2010:0FD5
    [   46.880000] updating sensitivity value: 2
    [   46.890000] Enabling firmware auto radio-recalibration.
    [   46.910000] vif_type=0002
    [   46.920000] NL80211_IFTYPE_STATION
    [   46.930000] Updating to mode=0x0002
    [   46.940000] Updating RXconfig to mode=0x0002,rx_config_1:2=2010:0FD5
    [   46.970000] acx.acx_debugfs_add_adev: adev:94871720 nm:phy0 dirp:943a4d58
    [   46.990000] Virtual interface added (type: 0x00000002, MAC: AA:AA:AA:AA:AA:AA)
    [   47.010000] Updating tx-power-level to: 1
    [   47.030000] ADDRCONF(NETDEV_UP): wlan0: link is not ready
    [   47.050000] acx.acx_debugfs_remove_adev: phy0 943a4d58
    [   47.070000] Updating to mode=0x00ff
    [   47.080000] Virtual interface removed: type=2, MAC=AA:AA:AA:AA:AA:AA
    [   47.100000] acx.acx_op_stop: acxpci: closed device
    

    Here is when I bring it up manually:

    [  155.820000] Updating initial settings
    [  155.830000] Updating station_id to: AA:AA:AA:AA:AA:AA
    [  155.850000] Updating Tx fallback to 1 retries
    [  155.860000] Updating tx-power-level to: 1
    [  155.880000] Updating antenna[0,1]: 0x4A 0x04
    [  155.890000] Updating the Energy Detect (ED) threshold: 0
    [  155.910000] acx111 doesn't support ED threshold
    [  155.920000] Updating the Channel Clear Assessment (CCA) value: 0x00
    [  155.940000] acx111 doesn't support CCA
    [  155.950000] Updating the short retry limit: 7, long retry limit: 4
    [  155.980000] Updating the tx MSDU lifetime: 4096
    [  155.990000] Updating the regulatory domain: 0x10
    [  156.010000] Updating to mode=0x00ff
    [  156.020000] updating sensitivity value: 2
    [  156.030000] Enabling firmware auto radio-recalibration.
    [  156.050000] vif_type=0002
    [  156.060000] NL80211_IFTYPE_STATION
    [  156.070000] Updating to mode=0x0002
    [  156.080000] Updating RXconfig to mode=0x0002,rx_config_1:2=2010:0FD5
    [  156.110000] acx.acx_debugfs_add_adev: adev:94871720 nm:phy0 dirp:94445718
    [  156.130000] Virtual interface added (type: 0x00000002, MAC: AA:AA:AA:AA:AA:AA)
    [  156.150000] Updating tx-power-level to: 1
    [  156.170000] ADDRCONF(NETDEV_UP): wlan0: link is not ready
    [  156.190000] acx.acx_debugfs_remove_adev: phy0 94445718
    [  156.200000] Updating to mode=0x00ff
    [  156.220000] Virtual interface removed: type=2, MAC=AA:AA:AA:AA:AA:AA
    [  156.240000] acx.acx_op_stop: acxpci: closed device
    [  156.260000] device wlan0 entered promiscuous mode
    [  156.280000] Updating initial settings
    [  156.290000] Updating station_id to: AA:AA:AA:AA:AA:AA
    [  156.310000] Updating Tx fallback to 1 retries
    [  156.320000] Updating tx-power-level to: 1
    [  156.340000] Updating antenna[0,1]: 0x4A 0x04
    [  156.350000] Updating the Energy Detect (ED) threshold: 0
    [  156.370000] acx111 doesn't support ED threshold
    [  156.380000] Updating the Channel Clear Assessment (CCA) value: 0x00
    [  156.400000] acx111 doesn't support CCA
    [  156.410000] Updating the short retry limit: 7, long retry limit: 4
    [  156.440000] Updating the tx MSDU lifetime: 4096
    [  156.450000] Updating the regulatory domain: 0x10
    [  156.470000] Updating to mode=0x00ff
    [  156.480000] updating sensitivity value: 2
    [  156.490000] Enabling firmware auto radio-recalibration.
    [  156.510000] vif_type=0003
    [  156.520000] NL80211_IFTYPE_AP
    [  156.530000] Updating station_id to: 00:18:01:A9:B9:40
    [  156.550000] Updating to mode=0x0003
    [  156.560000] Updating RXconfig to mode=0x0003,rx_config_1:2=2010:0FD5
    [  156.580000] acx.acx_debugfs_add_adev: adev:94871720 nm:phy0 dirp:94445d98
    [  156.600000] Virtual interface added (type: 0x00000003, MAC: 00:18:01:A9:B9:40)
    [  156.630000] Updating tx-power-level to: 1
    [  156.640000] ADDRCONF(NETDEV_UP): wlan0: link is not ready
    [  156.680000] Redoing cmd_join_bssid() following template cfg
    [  156.690000] rates_basic:0003, rates_supported:1FFF
    [  156.710000] BSS_Type = 3
    [  156.720000] JoinBSSID MAC:00:18:01:A9:B9:40
    [  157.690000] br-lan: port 3(wlan0) entered forwarding state
    [  157.710000] br-lan: port 3(wlan0) entered forwarding state
    [  157.730000] ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready
    [  159.710000] br-lan: port 3(wlan0) entered forwarding state
    
     
  • OK, I fixed the not-coming-up-on-boot issue by introducing three additional seconds of delay in the init scripts. However, I now realize your test patch doesn't really work properly. I plugged an rt73 stick into my laptop, brought the interface down, and changed the MAC with "ifconfig wlan2 hw ether" slightly. I then fired up hostapd on it. The new MAC was what showed up in "iwlist wlan0 scan" but the old one was still in both /sys/class/ieee80211/phy1/addresses and /sys/class/ieee80211/phy1/macaddress. With the test patch above, /sys/class/ieee80211/phy0/addresses and /sys/class/ieee80211/phy0/macaddress both change to the new MAC when the interface is brought up, which is apparently incorrect behavior, and it breaks some of OpenWrt's scripts.

     
  • Oliver Winker
    Oliver Winker
    2012-07-22

    Hmm interesting, Thanks for the info. So something to check in detail one time.

    Timing-wise a usb-enumeration vs. a direct pci-like probe can explain some differences - and then besides the question of course, where and when the old/new mac-address should finally correctly show up in sysfs. Well, something to be checked.

    Anyway good to hear that you found a workaround in the meanwhile.

    The rt73 usb-stick I don't know in detail. Possibly the behavior you describe can be reproduced independent of a particular usb-device - so I could also try my usb sticks here then.

    -Oliver

     
  • I don't think it has anything to do with USB vs. PCI; I used a USB stick to test purely for convenience. It seems to me the new MAC is meant to never show up in sysfs at all. Do some testing of your own.

     
  • Oliver Winker
    Oliver Winker
    2012-07-22

    Probably the best. I'll do that when I update OpenWrt trunk then … ah, ok, now I get it: you used the rt73 as a test reference for the right sysfs behaviour - ok. Well, that's an interesting hint indeed. Maybe it has something to with wiphy->perm_addr then. I'll have a look once I finished with the current story then.

    -Oliver

     
  • Any news?

     
  • Oliver Winker
    Oliver Winker
    2012-08-03

    Hi, I'll take a look at weekend. Cheers, Oliver

     
  • Oliver Winker
    Oliver Winker
    2012-08-05

    Hi,

    I can reproduce the behavior that you described also with an ath5k card.

    Could you try if the patch below already fixes it for you so far ?

    If this fix is final I would still need to check in detail, since I saw other drivers also changing the PERM_ADDR on a mac-addr change in ieee80211_ops.add_interface() ?! So there is maybe still be a bit of research and confirmation required. I'll check that in detail the coming days then.

    diff --git a/main.c b/main.c
    index 6407e45..fda44b5 100644
    --- a/main.c
    +++ b/main.c
    @@ -605,7 +605,7 @@ int acx_op_add_interface(struct ieee80211_hw *ieee, struct ieee80211_VIF *vif)
                    memcpy(adev->dev_addr, mac_vif, ETH_ALEN);
                    memcpy(adev->bssid, mac_vif, ETH_ALEN);
                    acx1xx_set_station_id(adev, mac_vif);
    -               SET_IEEE80211_PERM_ADDR(adev->ieee, adev->dev_addr);
    +               //SET_IEEE80211_PERM_ADDR(adev->ieee, adev->dev_addr);
            }
    

    -Oliver

     
1 2 > >> (Page 1 of 2)