ShihabZzz / Bug_Reports

0 stars 2 forks source link

"Don't fragment" IP header flag is never set, causing connection problems #25

Open shvchk opened 3 years ago

shvchk commented 3 years ago

Rom name+Build date LineageOS 18.1, 10/10/2021 crDroid 7.11, 10/10/2021

Describe the bug Aurora Store and microG can't connect to some Google servers via some networks. After adding Google account and trying to register device it stays "Not registered". Google Play and Aurora Store don't work for the same reason.

When trying to register device in microG settings or trying to open Aurora Store, PCAPDroid traffic capture shows repeated requests to android.clients.google.com:443 (from microG Services Core or Aurora Store respectively) and some packets are answered, others are not (e.g. 21 sent - 9 received). So it does communicate with that server, but in the process something goes wrong.

I captured traffic from smartphone on my router and found that "Don't fragment" IP header flag is (almost?) never set by smartphone (i.e. this ROM). Because of that, router won't send "Fragmentation needed" ICMP packets if packets are too large to get through, so smartphone never knows about this problem and keeps retransmitting these large packets and never receives a reply. This is probably the root cause of this issue. This would probably not be noticeable on connections with MTU 1500 along the path, but anything less then that will trigger this problem.

Other devices and ROMs do set "Don't fragment" IP header flag on packets, of course.

Temporary workaround is to manually set lower MTU on smartphone (e.g. 1420, yours might be different): ifconfig wlan0 mtu 1420 — but that would reset on WiFi reconnect or reboot, and it requires root.

To Reproduce Steps to reproduce the behavior:

  1. Install ROM
  2. Install Aurora Store
  3. Open Aurora Store, configure leaving default settings as is, grant requested permissions, login or use anonymous login
  4. See empty store trying to load items forever.

Expected behavior OS should set "Don't fragment" IP header flag on packets, which will make routers warn it if packet is too large to get through.

Screenshots

Screenshots ![Screenshot_20211028-021823_microG_Services_Core](https://user-images.githubusercontent.com/872945/139173044-7c11a357-b39b-47bc-ab70-73fb9a6d1d10.png) ![Screenshot_20211028-022137_Aurora_Store](https://user-images.githubusercontent.com/872945/139173068-d7053dcf-34a6-4703-9386-58650a3b2e31.png) ![Screenshot_20211028-022223_Aurora_Store](https://user-images.githubusercontent.com/872945/139173152-206d9c7d-7677-4c2b-96f9-d8858936fa8f.png)

Logs (not to be missed) https://send.vis.ee/download/78c9b71b358652dd/#kK1xylToPg3wLiKvVnWBug Password: Shihab

Recovery: TWRP

Gapps: No (also tested with BitGapps, same problem)

Fingerprint: FPC

Used filesystems: ext4

Additional information:

[No] Dirty flash

[No] Xposed

[No] Custom kernel

[No] Performance/Battery enhancements

Additional context

shvchk commented 3 years ago

sysctl -w net.ipv4.ip_no_pmtu_disc=0 fixes this :tada: Please make it default.

For now I'm using this simple Magisk boot script in /data/adb/service.d:

#!/system/bin/sh
sleep 30
sysctl -w net.ipv4.ip_no_pmtu_disc=0
shvchk commented 2 years ago

Even after being disabled on boot as shown in previous message, net.ipv4.ip_no_pmtu_disc seems to become enabled after some time, so I need to disable it manually time after time. I looked further and found one file in the firmware containing ip_no_pmtu_disc, and that is /vendor/bin/netmgrd. This seems to be its source code: https://github.com/99degree/vendor_qcom_proprietary-msm8909go/blob/master/data/netmgr/src/netmgr_kif.c Function of interest is netmgr_kif_disable_pmtu.