12 April, 2012

iPhone Internet Tethering | Personal Hotspot
on Backtrack 5 running kernel 3.2.6

I am an occasional user of the Internet Tethering feature of my old iPhone 3G running iOS 4.1. The feature is now called Personal Hotspot in iOS 5. On my laptop, I (also) run a Backtrack Linux installation which has no built-in support for iPhone USB tethering and - differently than plain Ubuntu - no installable option from the default repositories.

For some unclear reason, the modified dkms from the pmcenery repository stopped working once I removed the old kernel modules (one of the anomalies being the interface shown as wwan0 instead of the usual eth1, even after removal and rebuild).

Executing the below commands *literaly* across updates might be unsafe for the system, it worked fine for 2 of my - updated - BT5R2 systems as of today, though:
apt-get install ifuse gvfs libimobiledevice0 libimobiledevice-utils \
linux-source-3.2.6 linux-headers-3.2.6 build-essential

cd /usr/src

(of course, only if not already done before ;-)
tar xfvj /usr/src/linux-source-3.2.6.tar.bz2

(same as above)
ln -s /usr/src/linux-source-3.2.6 /usr/src/linux
ln -s /usr/src/linux-source-3.2.6/arch/x86/Makefile_32.cpu \
/usr/src/linux-headers-3.2.6/arch/x86/Makefile_32.cpu

a broken link to asm (repaired in the line that follows)
rm linux-headers-3.2.6/include/asm
ln -s /usr/src/linux-source-3.2.6/arch/x86/include/asm \
/usr/src/linux-headers-3.2.6/include/asm

At this moment, the git archive offers a version released in late 2011 supporting the iPhone 4S as well.
git clone git://github.com/dgiagio/ipheth.git

cd ipheth/ipheth-pair

make
make install

cd ../../ipheth/ipheth-driver

a) write the following 1 line patch file (it's named ipheth.c.patch in the line that follows)

90a91,92
> #define HAVE_NET_DEVICE_OPS true
>

apply the patch
patch ipheth.c ipheth.c.patch

or, more quickly ;-)

b) just add the #define line to ipheth.c

then
make
make install

insmod /usr/src/ipheth/ipheth-driver/ipheth.ko

if everything went fine, the above insmod command is all should be necessary from now on to load the driver. Given the occasional use, I am not going to make any permanent configuration for this, but probably just an alias. To verify the module is loaded
lsmod | grep ipheth

which should return something like
ipheth                 13238  0

plugging in the iPhone (with Internet Tethering enabled ;-) should immediately make up a new ethernet ethn interface;

executing ideviceinfo may be required to trigger pairing and dhclient ethn to obtain the familiar 172.10.20.2/28 IPv4 address.



credits/references:
the iPhone USB Ethernet Driver

3.2.6 kernel src/modules symlinks

No comments: