Skip to content

usbnet: ipheth: add CDC NCM support - #15209

Merged
openwrt-bot merged 1 commit into
openwrt:mainfrom
httpstorm:usbnet-ipheth-add-CDC-NCM-support
Apr 21, 2024
Merged

openwrt-bot merged 1 commit into
openwrt:mainfrom
httpstorm:usbnet-ipheth-add-CDC-NCM-support

Conversation

@httpstorm

Copy link
Copy Markdown
Contributor

[PATCH 1/4] usbnet: ipheth: fix risk of NULL pointer deallocation

The cleanup precedure in ipheth_probe will attempt to free a NULL pointer in dev->ctrl_buf if the memory allocation for this buffer is not successful. While kfree ignores NULL pointers, and the existing code is safe, it is a better design to rearrange the goto labels and avoid this.

[PATCH 2/4] usbnet: ipheth: transmit URBs without trailing padding

The behaviour of the official iOS tethering driver on macOS is to not transmit any trailing padding at the end of URBs. This is applicable to both NCM and legacy modes, including older devices.

Adapt the driver to not include trailing padding in TX URBs, matching the behaviour of the official macOS driver.

[PATCH 3/4] usbnet: ipheth: add CDC NCM support

Recent iOS releases support CDC NCM encapsulation on RX. This mode is the default on macOS and Windows. In this mode, an iOS device may include one or more Ethernet frames inside a single URB.

Freshly booted iOS devices start in legacy mode, but are put into NCM mode by the official Apple driver. When reconnecting such a device from a macOS/Windows machine to a Linux host, the device stays in NCM mode, making it unusable with the legacy ipheth driver code.

To correctly support such a device, the driver has to either support the NCM mode too, or put the device back into legacy mode.

To match the behaviour of the macOS/Windows driver, and since there is no documented control command to revert to legacy mode, implement NCM support. The device is attempted to be put into NCM mode by default, and falls back to legacy mode if the attempt fails.

[PATCH 4/4] usbnet: ipheth: update Kconfig description

This module has for a long time not been limited to iPhone <= 3GS. Update description to match the actual state of the driver.

Remove dead link from 2010, instead reference an existing userspace iOS device pairing implementation as part of libimobiledevice.

Tested on: WRT3200ACM, TL-WR1043ND.
Fixes: #12566 ipv4 tethering not working with iPhone 14 pro max with nanoPI r1

@github-actions github-actions Bot added the kernel pull request/issue with Linux kernel related changes label Apr 19, 2024
@httpstorm

Copy link
Copy Markdown
Contributor Author

@neheb

neheb commented Apr 19, 2024

Copy link
Copy Markdown
Contributor

Summarize the changes instead of posting each patch description in the commit message. Maybe something like:

kernel: backport ipeth CDC NCM support

Fixes obtaining an IPv4 address when tethering iOS devices. 

@httpstorm
httpstorm force-pushed the usbnet-ipheth-add-CDC-NCM-support branch from 4cfb15d to 1584be9 Compare April 20, 2024 09:14
@httpstorm

Copy link
Copy Markdown
Contributor Author

@neheb
Thanks! I added links and left the bare minimum description. The reason devices cannot obtain an IPv4 address, is because there is no Ethernet communication in first place. Backporting CNC NCM support fixes that.

@Ansuel
Ansuel force-pushed the usbnet-ipheth-add-CDC-NCM-support branch 2 times, most recently from 7e53724 to 7fad44f Compare April 21, 2024 20:50
Fixes no communication with tethered iOS devices in CDC NCM mode.
Freshly booted iOS devices start in legacy mode, but are put into
NCM mode by the official Apple driver.

[1] torvalds/linux@a2d274c

Fixes: openwrt#12566
Tested-by: Georgi Valkov <[email protected]>
Signed-off-by: Foster Snowhill <[email protected]>
Signed-off-by: Georgi Valkov <[email protected]>
[ better reference fixed issue ]
Signed-off-by: Christian Marangi <[email protected]>
@Ansuel
Ansuel force-pushed the usbnet-ipheth-add-CDC-NCM-support branch from 7fad44f to 680f873 Compare April 21, 2024 20:50
@openwrt-bot
openwrt-bot merged commit 680f873 into openwrt:main Apr 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kernel pull request/issue with Linux kernel related changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ipv4 tethering not working with iPhone 14 pro max with nanoPI r1

3 participants