Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WiFi and pppos co-exist problems (IDFGH-2548) #4634

Closed
AxelLin opened this issue Jan 16, 2020 · 6 comments
Closed

WiFi and pppos co-exist problems (IDFGH-2548) #4634

AxelLin opened this issue Jan 16, 2020 · 6 comments

Comments

@AxelLin
Copy link
Contributor

AxelLin commented Jan 16, 2020

  • Module or chip used: ESP32-WROOM-32
  • IDF version: v4.1-dev-1935-g647cb628a11a
  • Build System: CMake
  • Compiler version: xtensa-esp32-elf-gcc (crosstool-NG esp-2019r2) 8.2.0
  • Operating System: Linux
  • Power Supply: USB
  1. If I start PPPoS first, then make wifi to join AP, I'm not able to get IP address.
    The device stuck at below messages:
    I (23480) net_utils: Joining AP: TEST_AP
    I (23574) phy: phy_version: 4180, cb3948e, Sep 12 2019, 16:39:13, 0, 0
    I (23576) wifi: mode : sta (24:0a:c4:15:2b:00)

    PS. It can get IP address if I don't start PPPoS.

  2. If I start PPPoS first, then make ESP32 running as AP.
    I'm not able to join the ESP32 AP, it stuck with below messages:
    I (58802) wifi: new:<6,1>, old:<6,1>, ap:<6,1>, sta:<0,0>, prof:6
    I (58803) wifi: station: c8:ff:28:04:f8:09 join, AID=1, bgn, 40U
    I (104589) wifi: station: c8:ff:28:04:f8:09 leave, AID = 1, bss_flags is 134243, bss:0x3ffd3448
    I (104590) wifi: new:<6,0>, old:<6,1>, ap:<6,1>, sta:<0,0>, prof:6
    I (141975) wifi: new:<6,1>, old:<6,0>, ap:<6,1>, sta:<0,0>, prof:6
    I (141976) wifi: station: c8:ff:28:04:f8:09 join, AID=1, bgn, 40U
    I (187509) wifi: station: c8:ff:28:04:f8:09 leave, AID = 1, bss_flags is 134243, bss:0x3ffd3448
    I (187510) wifi: new:<6,0>, old:<6,1>, ap:<6,1>, sta:<0,0>, prof:6

  3. If I start STA/AP first:

a)
When WiFi is in AP mde, I sometimes got below error message after PPPoS connected.
E (70041) wifi: age_bss: null bss

b) When WiFi is in AP or STA mode, the PPPoS shows wrong IP/Gateway address, see below:

I (22742) pppos_example: Modem PPP Started
I (22994) esp-netif_lwip-ppp: Connected
I (22995) esp-netif_lwip-ppp: Name Server1: 168.95.1.1
I (22995) esp-netif_lwip-ppp: Name Server2: 168.95.192.1
I (23000) net_utils: Unhandled IP event_id:5
I (23005) pppos_example: IP event! 5
I (23009) pppos_example: Modem Connect to PPP Server
I (23015) pppos_example: ~~~~~~~~~~~~~~
I (23019) pppos_example: IP : 0.0.0.0
I (23024) pppos_example: Netmask : 196.253.64.63
I (23030) pppos_example: Gateway : 0.0.0.0
I (23035) pppos_example: Name Server1: 168.95.1.1
I (23040) pppos_example: Name Server2: 168.95.192.1
I (23046) pppos_example: ~~~~~~~~~~~~~~
I (23050) pppos_example: GOT ip event!!!

I think you can easily reproduce the issue by combine pppos_client example with
wifi/getting_started/station/softAP or wifi/getting_started/station/station examples.

Above symptoms are 100% reproducable.

@github-actions github-actions bot changed the title WiFi and pppos co-exist problems WiFi and pppos co-exist problems (IDFGH-2548) Jan 16, 2020
@AxelLin
Copy link
Contributor Author

AxelLin commented Jan 31, 2020

Hi @david-cermak
Can you commit a fix for this issue?

I just figure out why I got wrong IP/netmask/gateway on PPP interface.
In components/esp_netif/lwip/esp_netif_lwip_ppp.c
on_ppp_status_changed()

It uses "ip_event_ap_staipassigned_t evt"
for err = esp_event_post(IP_EVENT, netif->get_ip_event, &evt, sizeof(evt), 0);

However, in on_ip_event() it assumes:
ip_event_got_ip_t *event = (ip_event_got_ip_t *)event_data;

I think the fix is:
change "ip_event_ap_staipassigned_t evt = {}" to "ip_event_got_ip_t evt = {}" in on_ppp_status_changed.
And setup the corresponding fields in evt.
e.g.
evt.esp_netif = netif;
evt.ip_info = ipinfo;
I'm not sure if evt.ip_changed should be set or not.

@AxelLin
Copy link
Contributor Author

AxelLin commented Jan 31, 2020

BTW, there is a typo in
examples/protocols/pppos_client/main/pppos_client_main.c on_ip_event()

    ESP_LOGI(TAG, "Gateway     : " IPSTR, IP2STR(&event->ip_info.ip));

should change to
ESP_LOGI(TAG, "Gateway : " IPSTR, IP2STR(&event->ip_info.gw));

@david-cermak
Copy link
Collaborator

Hi @AxelLin

Thanks for the investigation and finding the bug!
I will look into it and provide fixes.

@AxelLin
Copy link
Contributor Author

AxelLin commented Feb 12, 2020

Hi @david-cermak

I'm wodering why I got below message:

E (48334) wifi: age_bss: null bss
E (56330) wifi: age_bss: null bss
E (56890) wifi: age_bss: null bss
E (71330) wifi: age_bss: null bss
E (71991) wifi: age_bss: null bss
E (89865) wifi: age_bss: null bss

It only happen when using AP+PPPoS and pretty easy to reproduce.
It looks like an error message, I'm not sure if I can just ignore it.

In AP+PPPoS case sometimes the AP will disappear and never back.
The only way to recover it is reboot device.
I'm not sure if it's related to above message.

@iosix
Copy link

iosix commented Feb 12, 2020 via email

@Alvin1Zhang Alvin1Zhang reopened this Feb 12, 2020
@liuzfesp
Copy link
Contributor

liuzfesp commented Mar 1, 2020

HI @AxelLin, the log "age_bss: null bss" is not a real bug, just ignore it, we will remove it in later IDF release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants