blumonks / android_device_blu_p6601

LineageOS 14.1 Device Tree for BLU R1 HD
GNU General Public License v2.0
1 stars 1 forks source link

Hotspot doesn't work #7

Closed zhaofengli closed 6 years ago

zhaofengli commented 7 years ago

It turns on but the hotspot isn't visible. Again, probably danielhk can help us out again :stuck_out_tongue:

natekc commented 6 years ago

@zhaofengli Have you tried https://github.com/danielhk/android_device_lenovo_aio_otfp/commit/17b36707aa1459f3f839e2f7b7e6499aa3812a3e#diff-902b77378d78c23fcb4ed3a12a634424 ?

zhaofengli commented 6 years ago

@jianC Not yet. I'll give it a try later.

zhaofengli commented 6 years ago

Neat! Now it works perfectly with the patch.

(Comment written using the hotspot)

Nope, scratch that. My laptop connected to another one automatically :( The AP does show up when there isn't a usable data connection, but it errors when there is one.

Relevant logs:

09-19 22:14:14.872   305   763 V NatController: runCmd(/system/bin/ip6tables -w -A natctrl_FORWARD -g natctrl_tether_counters) res=0
09-19 22:14:14.974   305   763 V NatController: runCmd(/system/bin/iptables -w -A natctrl_FORWARD -i ccmni0 -o ap0 -m state --state ESTABLISHED,RELATED -g natctrl_tether_counters) res=0
09-19 22:14:15.073   305   763 V NatController: runCmd(/system/bin/iptables -w -A natctrl_FORWARD -i ap0 -o ccmni0 -m state --state INVALID -j DROP) res=0
09-19 22:14:15.171   305   763 V NatController: runCmd(/system/bin/iptables -w -A natctrl_FORWARD -i ap0 -o ccmni0 -g natctrl_tether_counters) res=0
09-19 22:14:15.269   305   763 V NatController: runCmd(/system/bin/ip6tables -w -t raw -A natctrl_raw_PREROUTING -i ap0 -m rpfilter --invert ! -s fe80::/64 -j DROP) res=1
09-19 22:14:15.367   305   763 V NatController: runCmd(/system/bin/iptables -w -D natctrl_FORWARD -i ap0 -o ccmni0 -g natctrl_tether_counters) res=0
09-19 22:14:15.465   305   763 V NatController: runCmd(/system/bin/iptables -w -D natctrl_FORWARD -i ap0 -o ccmni0 -m state --state INVALID -j DROP) res=0
09-19 22:14:15.564   305   763 V NatController: runCmd(/system/bin/iptables -w -D natctrl_FORWARD -i ccmni0 -o ap0 -m state --state ESTABLISHED,RELATED -g natctrl_tether_counters) res=0
09-19 22:14:15.564   305   763 E NatController: Error setting forward rules
09-19 22:14:15.663   305   763 V NatController: runCmd(/system/bin/iptables -w -F natctrl_FORWARD) res=0
09-19 22:14:15.761   305   763 V NatController: runCmd(/system/bin/ip6tables -w -F natctrl_FORWARD) res=0
09-19 22:14:15.859   305   763 V NatController: runCmd(/system/bin/iptables -w -A natctrl_FORWARD -j DROP) res=0
09-19 22:14:15.957   305   763 V NatController: runCmd(/system/bin/iptables -w -t nat -F natctrl_nat_POSTROUTING) res=0
09-19 22:14:16.054   305   763 V NatController: runCmd(/system/bin/ip6tables -w -t raw -F natctrl_raw_PREROUTING) res=0
09-19 22:14:16.055   473   512 E NetdConnector: NDC Command {294 nat enable ap0 ccmni0 1 192.168.43.0/24} took too long (1442ms)
09-19 22:14:16.055   473   512 E TetherInterfaceSM: Exception enabling Nat: java.lang.IllegalStateException: command '294 nat enable ap0 ccmni0 1 192.168.43.0/24' failed with '400 294 Nat operation failed (No such device)'
09-19 22:14:16.056   305   763 D TetherController: untetherInterface(ap0)
09-19 22:14:16.263   305   763 D CommandListener: Setting iface cfg
09-19 22:14:16.276   305   763 D CommandListener: Trying to bring down ap0
09-19 22:14:16.278  3852  3852 I hostapd : ap0: INTERFACE-DISABLED 

The interface ccmni0 exists.

natekc commented 6 years ago

He has this patch related to ccmn interface too: https://github.com/danielhk/android_device_lenovo_aio_otfp/blob/cm-14.1/platform_patches/system_core_libnetutils.patch

Thanks for working on it btw

zhaofengli commented 6 years ago

Oh wow, why didn't I see that? 😅 Will try it out later.

natekc commented 6 years ago

Also, I see that danielHK has his own wifi HAL here: https://github.com/danielhk/android_hardware_lenovo_aio_otfp/tree/cm-14.1/wlan

I also see some of these possibly related errors in logcat

01-01 21:55:40.669   718   999 E NetdConnector: NDC Command {5 softap fwreload wlan0 STA} took too long (1720ms)
01-01 21:55:41.087   718   718 E NetdConnector: NDC Command {6 strict enable} took too long (1308ms)
01-01 21:55:41.601  1331  1331 E wpa_supplicant: wpa_driver_nl80211_driver_cmd: failed to issue private commands

I'll get around to fixing them after the camera, if you haven't fixed them by then..

natekc commented 6 years ago

DeckerSu also has a wifi hotspot patch here (which might be more applicable to us): https://github.com/DeckerSU/android_device_doogee_x5max_pro/blob/lineage-14.0/patches_decker/0010-wifi-tethering-fix.patch

zhaofengli commented 6 years ago

82ff1d8 and be45852 basically do what DeckerSu's patch does. However, the same errors still occur. I haven't tried danielhk's HAL, though. Will get to it later.

zhaofengli commented 6 years ago

Okay, I think I know what's going on. The "No such device" (ENODEV) is a red-herring, generated when netd's trying to set forward rules. The one that failed is:

09-19 22:14:15.269   305   763 V NatController: runCmd(/system/bin/ip6tables -w -t raw -A natctrl_raw_PREROUTING -i ap0 -m rpfilter --invert ! -s fe80::/64 -j DROP) res=1

I think if we enable rpfilter in kernel, we will be fine.

zhaofengli commented 6 years ago

Now it works, and this comment is posted using the hotspot (for real this time). I'll close this issue after cleaning up the unneeded patches/configs.

zhaofengli commented 6 years ago

Posting with USB tethering this time, and everything seems to work well. Lesson learned: Don't just post logs - Actually read them 🤣