diederikdehaas / rtl8812AU

Realtek 8812AU USB WiFi driver
Other
475 stars 177 forks source link

Cannot set AP address #43

Open vmspike opened 7 years ago

vmspike commented 7 years ago

I try to setup batman-adv on RPi 3B so have to set Cell id for ad-hoc interface Linux raspberrypi 4.4.20-v7+ #908 SMP Wed Sep 7 14:44:27 BST 2016 armv7l GNU/Linux I've tried with both 4.3.14 and 4.3.22-beta the following way:

## Become root
sudo -i

## Install required packages
apt-get update
apt-get install git dkms build-essential linux-headers-$(uname -r) lshw

## Go to pi home dir
cd ~pi

## Clone repo (specific branch)
git clone -b driver-4.3.22-beta --single-branch https://github.com/diederikdehaas/rtl8812AU.git
cd rtl8812AU

## Configure and install driver using dkms so it will be recompiled on kernel update
DRV_NAME=rtl8812AU
DRV_VERSION=4.3.22-beta
mkdir -p /usr/src/${DRV_NAME}-${DRV_VERSION}
git archive driver-${DRV_VERSION} | tar -x -C /usr/src/${DRV_NAME}-${DRV_VERSION}
# Change platform to RPi (also tried without it)
sed -i -e 's/CONFIG_PLATFORM_ARM_RPI = n/CONFIG_PLATFORM_ARM_RPI = y/' -e 's/CONFIG_PLATFORM_I386_PC = y/CONFIG_PLATFORM_I386_PC = n/' Makefile
# Note: For 64 bit arch (starts from armv8) use link to arm64 instead of arm
ln -s arm /usr/src/linux-headers-$(uname -r)/arch/$(uname -m)
dkms add -m ${DRV_NAME} -v ${DRV_VERSION}
dkms build -m ${DRV_NAME} -v ${DRV_VERSION}  # Could take a long time
dkms install -m ${DRV_NAME} -v ${DRV_VERSION}

Then channel change a bit tricky, but I've found the way how to change it even for several devices on the same host using rtw_channel driver option and /sys/bla-bla (can provide the way if you interested in).

The issue is: When I trying to set cell id for ad-hoc it doesn't set it or even OS completely hangs up for first, second or next attempts if I continue trying.

iwconfig wlan1 mode ad-hoc essid my-mesh-network
iwconfig wlan1 ap 02:11:87:xx:xx:xx  # OS could stuck after this line or just ignore it

If I try to set it in /etc/network/interfaces

iface wlan1 inet static
    address 192.168.11.2
    network 192.168.11.0
    netmask 255.255.255.0
    wireless-essid my-mesh-network
    wireless-mode ad-hoc
    wireless-ap 02:11:87:xx:xx:xx
    wireless-channel 1
    wireless-power off

After ifup wlan1 I get errors:

Error for wireless request "Set AP Address" (8B14) :
    SET failed on device wlan1 ; Operation not permitted.
Error for wireless request "Set Power Management" (8B2C) :
    SET failed on device wlan1 ; Operation not permitted.

If it's a way to workaround it or fix the bug?

vmspike commented 7 years ago

If it's possible to hardcode specific MAC for AP in sources instead of random MAC creation? Where? Tried this hack:

# Custom dirty hack to allow to set Cell MAC address (cell bssid)
sed -i -e '326s/.*/\t_rtw_memcpy(\&pmlmepriv->cur_network.network.MacAddress, bssid, ETH_ALEN);  \/\/ Custom dirty hack/' /usr/src/${DRV_NAME}-${DRV_VERSION}/core/rtw_ioctl_set.c

iwconfig show that bssid changed but batman still doesn't work, so suppose it's not enough.