Project

General

Profile

Actions

Testing #1099

closed

Verify Media System and Player System properly support PiNet's web UI.

Added by Hammel 9 months ago. Updated 7 months ago.

Status:
Closed
Priority:
Immediate
Assignee:
Category:
09 - Testing
Target version:
Start date:
15 Jan 2024
Due date:
% Done:

100%

Estimated time:
Severity:
01 - Critical

Description

This is to make sure that both provide the ability to configure the following.

  1. Eth0
  2. Wifi0
  3. AP only on Media System

Related issues

Related to PiBox - Bug #727: brcmfmac having problems in AP + station modeClosedHammel27 Oct 2019

Actions
Blocked by pibox-network-config - Bug #904: wpa_supplicant.conf is not working with local routerClosedHammel24 Sep 2022

Actions
Actions #1

Updated by Hammel 9 months ago

The Media System failed because the AP cannot be seen by other devices.
This device is: Raspberry Pi 3 Model B Plus Rev 1.3
The following are running on the system with pinet active:

 6337 root      6680 S    hostapd -B /etc/network/hostapd.aponly
 6339 root      7108 S    dhcpd -cf /etc/network/dhcpd.conf.aponly wlan0
 6444 root      3400 S    udhcpc -R -n -p /var/run/udhcpc.eth0.pid -i eth0

That suggests that the AP on a RPi3 doesn't work.

So I searched to see if that was the case and found this alternative configuration, which is similar but not equal to the current one:

interface=wlan0
driver=nl80211
ssid=MyPiAP
hw_mode=g
channel=6
ieee80211n=1
wmm_enabled=1
ht_capab=[HT40][SHORT-GI-20][DSSS_CCK-40]
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=2
wpa_key_mgmt=WPA-PSK
wpa_passphrase=raspberry
rsn_pairwise=CCMP

Now my phone can see the AP but it won't connect to it because it says it offers no Internet. This seems to be because the phone attempts to get an IP address but the AP is not offering one (not logs in /var/log/messages) even though dhcpd is running on the wlan0 interface.

Watching the logs more closely I see the following when the phone tries to connect to the AP.

Jan 22 12:14:37 (none) daemon.info hostapd: wlan0: STA b0:4a:b4:d3:e3:54 IEEE 802.11: associated
Jan 22 12:14:38 (none) daemon.info hostapd: wlan0: STA b0:4a:b4:d3:e3:54 IEEE 802.11: disassociated
Jan 22 19:14:38 (none) kern.err kernel: [594092.794832] ieee80211 phy0: brcmf_vif_set_mgmt_ie: vndr ie set error : -52
Jan 22 12:14:38 (none) daemon.info hostapd: wlan0: STA e1:01:e1:01:e0:01 IEEE 802.11: disassociated
Jan 22 19:14:40 (none) daemon.info ntpd[757]: Deleting interface #57 wlan0, 192.168.36.1#123, interface stats: received=0, se
nt=0, dropped=0, active_time=9 secs
Jan 22 19:14:40 (none) daemon.info ntpd[757]: Deleting interface #59 wlan0, fe80::ba27:ebff:fef7:94cf%3#123, interface stats:
 received=0, sent=0, dropped=0, active_time=9 secs

A raspberry pi linux references some testing that seems to show only 7.45.18.0 firmware is working properly. Current firmware is

$ dmesg | grep "brcmfmac.*Firmware" 
[    5.073620] brcmfmac: brcmf_c_preinit_dcmds: Firmware: BCM4345/6 wl0: Jan  4 2021 19:56:29 version 7.45.229 (617f1f5 CY) F
WID 01-2dbd9d2e

See
  1. https://github.com/raspberrypi/linux/issues/2453#issuecomment-698660149
  2. https://github.com/iiab/iiab/issues/823#issuecomment-662285202 (links to working firmware 7.45.18.0)
Actions #2

Updated by Hammel 9 months ago

Switched to older firmware but that didn't seem to help. The AP's can't be seen, or at least not for very long. Also tried it on a pistore, just so it was different physical hardware. Same story. Tried it with two different phones (Android and PPP) but same story.

This seems to be the best config so far for hostapd:

$ cat /etc/network/hostapd.aponly 
interface=wlan0
driver=nl80211
ssid=piboxmedia
channel=5
# auth_algs=3
auth_algs=1
wpa=2
wpa_psk_file=/etc/network/hostapd-psk.aponly
wpa_key_mgmt=WPA-PSK
# rsn_pairwise=TKIP
rsn_pairwise=CCMP
# wpa_pairwise=TKIP
wpa_pairwise=CCMP
macaddr_acl=0
ignore_broadcast_ssid=0
hw_mode=g
# New
ieee80211n=1
wmm_enabled=1
ht_capab=[HT40][SHORT-GI-20][DSSS_CCK-40]

Also, adding the following to the wap() function in S40network might help.

        iwconfig wlan0 power off

Actions #3

Updated by Hammel 9 months ago

  • Status changed from New to In Progress
  • % Done changed from 0 to 20

I need to disable the brcm wireless and add a dongle, then retest and see if it works better.

Actions #4

Updated by Hammel 8 months ago

I might be missing files that could help make the wifi work correctly.
To summarize:

   cd  /lib/firmware/brcm/
   sudo ln -s ../cypress/cyfmac43455-sdio.bin brcmfmac43455-sdio.raspberrypi,3-model-b-plus.bin
   sudo ln -s ../cypress/cyfmac43455-sdio.clm_blob brcmfmac43455-sdio.raspberrypi,3-model-b-plus.clm_blob

The cypress files are NOT on the current distribution but are available from the kernel firmware download. So just add them to the kfw.cfg file to copy the files over and add the symlink creation in the postbuild.sh

Actions #5

Updated by Hammel 8 months ago

This was updated and committed (oops, but not pushed) and then tested. It didn't work because the firmware crashed. The cypress firmware apparently doesn't work out of the upstream linux-firmware repo.

So the alternative is to try the firmware-brcm80211_20161130-3+rpt3_all.deb package instead. If this doesn't work, I'm going back to using a dongle.

Actions #6

Updated by Hammel 8 months ago

This worked better - the interface showed up and there are no dmesg crashes - but it doesn't work.

This table suggests some other firwmware, which appears to be the /lib/firmware/brcm/brcmfmac43430-sdio.bin files. I will try those too, just to be complete, before giving up.

Actions #7

Updated by Hammel 8 months ago

FW Version Status
43455 7.45.18 Loads okay. Doesn't connect to router.
43455 7.45.132 Fails to load.

According to that table only 7.45.18 seems to work very well. So I'm going to setup another wifi router and see if I can connect to that.

I need to review RM #727 which is also about getting the onboard wifi working. Once both this RM and that one are fully examined I will know whether or not the onboard should be considered going forward.

Actions #8

Updated by Hammel 8 months ago

  • Related to Bug #727: brcmfmac having problems in AP + station mode added
Actions #9

Updated by Hammel 8 months ago

Switching to MuseN (tplink router updated to latest dd-wrt) seems to work using the default firmware. At least on the rpi4 and one rpi3. What was required on the RPi's was to restart wpa_supplicant with each change to the wpa_supplicant.conf file.

I can't restart the network while testing this because that would stop/restart the wired network I'm using for testing. So that tells me I need to restart wpa_supplicant externally to S40network, or add a mode to S40network that just restarts the wireless.

For reference, here is the wpa_supplicant.conf

network={
    ssid="MuseN" 
    scan_ssid=1
    proto=WPA RSN
    key_mgmt=WPA-PSK
    psk="<>" 
    pairwise=CCMP
    group=CCMP
}

So I can use this to test PiNet on Media and Player systems.

Actions #10

Updated by Hammel 8 months ago

  • % Done changed from 20 to 50
PiNet tested on RPi3 (Media System):
  1. hostapd.aponly requires changing from TKIP to CCMP to allow connection from my phone, otherwise the SSID doesn't show up on the phone. - see RM #904, see libpibox
  2. Wireless connection works but php server fails to serve imwww to firefox on phone. - fixed with CCMP updates.
    1. Chrome displays configuration page but Submit button failed - fixed with CCMP updates.
  3. Wired connection works with php server - can configure that way.
  4. PiNet needs the MAC address for the RPi displayed so users can add it to MAC filter lists. - see pinet
  5. When WebUI does work and the config is saved the WebUI is redisplayed with fields cleared - except the PW field. That needs to be cleared too. see ironman imwww
  6. Need to restart wpa_supplicant when changing wireless configuration (wpa_supplicant.conf) - See pnc, which is where the conf file is saved with updates ; use wpa_cli -i wlan0 reconfigure

It appears that the connection is dropped by the phone because there is no internet. I'm not sure why that is, but it's likely because I don't have a fully configured dhcp provided to the phone including nameservers and gateway. I need to check that.

Actions #11

Updated by Hammel 7 months ago

  • Blocked by Bug #904: wpa_supplicant.conf is not working with local router added
Actions #12

Updated by Hammel 7 months ago

  • % Done changed from 50 to 60
Ready for final testing:
  1. pinet showing mac address needs to be verified it displays correctly.
  2. libpibox needs to be tested on hardware to show it generate CCMP instead of TKIP in wpa_supplicant.conf.
Still need:
  1. Clear pw field in ironman/imwww
  2. Restart wpa_supplicant via wpa_cli in piboxd:net.c:saveWireless() after the settings have been written; use wpa_cli -i wlan0 reconfigure
Actions #13

Updated by Hammel 7 months ago

Retesting a build with the pinet/libpibox updates failed, likely because I didn't have the proper firmware installed. The working version of firmware should be in /home/mjhammel/src/ximba/raspberrypi2/extras and should be copied to /lib/firmware/brcm/brcmfmac43455-sdio.bin. I'll need to figure out where to store this and how to add it to the build once I recheck that this firmware is the solution to my problems.

Update

When booted dmesg reports this.

$ dmesg | grep brcm
[    4.657993] brcmfmac: F1 signature read @0x18000000=0x15264345
[    4.661831] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac43455-sdio for chip BCM4345/6
[    4.663127] usbcore: registered new interface driver brcmfmac
[    4.774216] Bluetooth: hci0: BCM: 'brcm/BCM4345C0.raspberrypi,3-model-b-plus.hcd'
[    4.774223] Bluetooth: hci0: BCM: 'brcm/BCM4345C0.hcd'
[    4.774230] Bluetooth: hci0: BCM: 'brcm/BCM.raspberrypi,3-model-b-plus.hcd'
[    4.774237] Bluetooth: hci0: BCM: 'brcm/BCM.hcd'
[    4.896082] brcmfmac: brcmf_c_preinit_dcmds: Firmware: BCM4345/6 wl0: Apr 15 2021 03:03:20 version 7.45.234 (4ca95bb CY) F
WID 01-996384e2
[    7.405680] brcmfmac: brcmf_cfg80211_set_power_mgmt: power save enabled

Checking version of firmware on the board (latter entry here) and the 7.45.18 file (former entry)

$ strings brcmfmac43455-sdio.bin | grep Version
43455c0-roml/sdio-ag-p2p-pno-aoe-pktfilter-keepalive-mchan-pktctx-proptxstatus-ampduhostreorder-lpc-pwropt-txbf-wnm-okc-ccx-l
tecx-wfds-wl11u-mfp-tdls-ve Version: 7.45.18.0 CRC: d7226371 Date: Sun 2015-03-01 07:31:57 PST Ucode Ver: 1026.2 FWID: 01-6a2
c8ad4
$ strings brcmfmac43455-sdio.bin- | grep Version
43455c0-roml/43455_sdio-pno-aoe-pktfilter-pktctx-lpc-pwropt-43455_ftrs-wfds-mfp-dfsradar-wowlpf-idsup-idauth-noclminc-clm_min
-obss-obssdump-swdiv Version: 7.45.229 (617f1f5 CY) CRC: 253bd863 Date: Mon 2021-01-04 19:58:58 PST Ucode Ver: 1043.2160 FWID
 01-2dbd9d2e

This suggests that the board is picking up firmware from somewhere else! And wherever that is, it's broken because it doesn't always find the wifi device and it can lock up the Pi on reboot. I need to find and remove that file.

Update

The fw in use is brcmfmac43455-sdio.raspberrypi,3-model-b-plus.bin, which is symlinked to ../cypress/cyfmac43455-sdio.bin. This was the fix I put in previously but realized I didn't need. Removing it causes the correct fw to be used, but I still need add the 7.45.18 version in the build somewhere.

Actions #14

Updated by Hammel 7 months ago

The 7.45.18 version of the firmware that we need for RPi3 and RPi4 with the 43455 chip is available from the Linux Firmware gitlab repository.
This is the commit for the RPi3 or RPi4 with the 43455 chip.

$ git show --name-only b9a38d041d3
commit b9a38d041d38ac6cf47274e9933f8083e12fc601
Author: Arend van Spriel <arend@broadcom.com>
Date:   Fri Mar 20 13:44:02 2015 +0100

    brcm: add firmware for BCM43455 SDIO device

    Signed-off-by: Arend van Spriel <arend@broadcom.com>
    Signed-off-by: Kyle McMartin <kyle@kernel.org>

WHENCE
brcm/brcmfmac43455-sdio.bin

This is available for download from
https://gitlab.com/kernel-firmware/linux-firmware
as
https://gitlab.com/kernel-firmware/linux-firmware/-/raw/b9a38d041d38ac6cf47274e9933f8083e12fc601/brcm/brcmfmac

The 7.45.98.38 version of the firmware that we need for RPi3 and RPiW with the 43430 chip is also available from the Linux Firmware gitlab repository.
This is the commit for the RPi W or RPi3 with the 43430 chip.

$ git show --name-only ec734a305ad
commit ec734a305ad2d5ab2f284f2020bc1ae1cadd5979 (HEAD)
Author: Chi-Hsien Lin <chi-hsien.lin@cypress.com>
Date:   Wed May 30 01:54:23 2018 -0500

    brcm: update firmware for bcm43430 sdio

    This firmware include fixes for:

    CVE-2017-13077 - dropping replayed M3 for offloaded 4-way handshake.
    CVE-2017-13078 - dropping replayed M3 for offloaded 4-way handshake.
    CVE-2017-13079 - dropping replayed M3 for offloaded 4-way handshake.
    CVE-2017-13080 - dropping replayed G1 for offloaded GTK rekey.
    CVE-2017-13081 - dropping replayed G1 for offloaded GTK rekey.

    Signed-off-by: Chi-Hsien Lin <chi-hsien.lin@cypress.com>
    Signed-off-by: Josh Boyer <jwboyer@kernel.org>

WHENCE
brcm/brcmfmac43430-sdio.bin

This is available for download from
https://gitlab.com/kernel-firmware/linux-firmware
as
https://gitlab.com/kernel-firmware/linux-firmware/-/raw/ec734a305ad2d5ab2f284f2020bc1ae1cadd5979/brcm/brcmfmac

Actions #15

Updated by Hammel 7 months ago

Still need:
  1. Correct WiFi firmware installed for both RPi3/4 and RPi3/W.
  2. Clear pw field in ironman/imwww
  3. Restart wpa_supplicant via wpa_cli in piboxd:net.c:saveWireless() after the settings have been written; use wpa_cli -i wlan0 reconfigure
Actions #16

Updated by Hammel 7 months ago

Testing the supposed good firmware:

0f 1 2 3 4 5 6f 7f 8 9h 10f

f: interface failed to come up
h: interface up, but no IP from router

That's about 50% boot failures. Terrible. I'm going to boot a Raspbian image, boot it without wifi configured and see how often it fails to come up. If it comes up 100%, then I'll try to find the files it's using.

Actions #17

Updated by Hammel 7 months ago

I've done all I can with the fw and pushed the changes. It's moderately stable in client mode and AP mode is hit-or-miss with my phones. If it doesn't work well with Ironman then I'll add an option to disable onboard wifi (by disabling the drivers) and allowing a wifi dongle to be used instead.

Back to the remaining bits of this issue:
  1. Correct WiFi firmware installed for both RPi3/4 and RPi3/W.
  2. Clear pw field in ironman/imwww I wasn't able to reproduce this.
  3. Restart wpa_supplicant via wpa_cli in piboxd:net.c:saveWireless() after the settings have been written; use wpa_cli -i wlan0 reconfigure
  4. pinet_ap.sh stop needs to be fixed
    1. ifdown wlan0 only
    2. ip route get 1 should be ip route get 2 on Rpi3/4 (probably not on Pi W0
    3. Don't reboot. It's not necessary and user can do that if they choose.

All updates have been implemented and tested on hardware (Media system only so far - pistore will also be tested before closing issue).
Code updates need to be committed and pushed.

Actions #18

Updated by Hammel 7 months ago

  • % Done changed from 60 to 90
Actions #19

Updated by Hammel 7 months ago

Tested and verified working on pistore.
Just need to commit and push pinet, pibox dev and piboxd

Actions #20

Updated by Hammel 7 months ago

  • Status changed from In Progress to Closed
  • % Done changed from 90 to 100

Code committed and pushed.

Closing issue.

Actions

Also available in: Atom PDF