seemoo-lab / nexmon_tx_task

Scheduled frame transmission on Broadcom Wi-Fi Chips
11 stars 1 forks source link

Does Nexmon can change the channel coding scheme of the router? #5

Closed Walthard closed 8 months ago

Walthard commented 10 months ago

I have learnt that the channel coding scheme for wifi may be BCC or LDPC codes. I would like to know if nexmon supports changing the channel coding scheme.

jlinktu commented 10 months ago

Following the comment on rate settings: https://github.com/seemoo-lab/nexmon_tx_task/blob/8d550c187261c4f1a637fa2ac316dd379fb51260/utils/tx_task.sh#L78

there is a define indicating LDPC coding here:

#define RATES_LDPC_CODING       0x00400000

https://github.com/seemoo-lab/nexmon/blob/8fd5ddef14d5b0c2eb607ec25b395efa7e501a0b/patches/include/rates.h#L54

Try setting this bit to 1 in the rate argument.

jlinktu commented 9 months ago

Please open a dedicated issue for that.

Did you try my suggested solution for this issue? If yes, is this solved and can be closed?

Walthard commented 9 months ago

Sorry for that. According to your instruction, I found the 22th bit of parameter rt (in tx_task.sh) represent the BCC or LDPC coding. So, I just manually set the 22th bit of rt to 1. But the transmitted wave still BCC encoded.

jlinktu commented 9 months ago

To set the mentioned bit, you could replace with the following:

rt=$(${PRINTF} "\\\x%1x%1x\\\x00\\\x4%01x\\\xc2" ${spatial_streams} ${mcs} ${bandwidth})

Maybe you also have to change to a HT rate, like this:

rt=$(${PRINTF} "\\\x08\\\x00\\\x4%01x\\\xc1" ${bandwidth})

If that doesn't work one might need to activate LDPC first somehow.

Walthard commented 9 months ago

I replace with the rt=$(${PRINTF} "\\\x%1x%1x\\\x00\\\x4%01x\\\xc2" ${spatial_streams} ${mcs} ${bandwidth}) mentioned above. I use the SDR to receive the signals and recover VHT-SIG-A2 field. Unfortunately, it shows the VHT frame still uses BCC coding.

jlinktu commented 9 months ago

What about the second option, using HT?

Walthard commented 9 months ago

I tried the second option. It seems the parameters are incorrect and lead the router cannot transmit the wave (I cannot find any signals in my configured channel, though the _txtask.sh can be implemented). And I also cannot receive any 802.11 packets with my WiFi dongle.

Walthard commented 8 months ago

After I change the last byte c2 to c1, the router can transmit the HT packets normally. But it is still BCC coding.

jlinktu commented 8 months ago

Right, my bad. Should have been c1.

There is one more simple thing that you can try. On the router run (replace <interface>):

/jffs/nexutil -I<interface> -s263 -l512 -b -v`printf "ldpc_tx\x00\x01\x00\x00\x00" | openssl enc -base64 | tr -d "\n"`

This calls a named IOVAR with the name "ldpc_tx" with the value 1 (ON). It might allow transmitting with LDPC.

To turn it OFF (0):

/jffs/nexutil -I<interface> -s263 -l512 -b -v`printf "ldpc_tx\x00\x00\x00\x00\x00" | openssl enc -base64 | tr -d "\n"`

To set on AUTO( -1):

/jffs/nexutil -I<interface> -s263 -l512 -b -v`printf "ldpc_tx\x00\xff\xff\xff\xff" | openssl enc -base64 | tr -d "\n"`
Walthard commented 8 months ago

The above method works! The demodulated HT-SIG field shows packets sent are encoded by LDPC. Thank you very much for your help! 1

jlinktu commented 8 months ago

Great, happy to help and thank you for reporting back.