I’m trying to fix up my stylesheet so I can post code and assembly more neatly.
Now that my Spring semester is over, I’ll be at home for the next 15 weeks or so. It’s a long enough time that I dedicated several hours today to setting up my workstation. At school I use my MacBook Pro exclusively, but while at home I like to multitask on my recently-upgraded iMac G5. I set it up with teleport and AirFoil, and it’s just like I plugged a third display in. (I can even turn on distcc to compile Universal Binaries faster.)
Since my parents use laptops exclusively, the home network is powered by a 802.11g Linksys wireless router. It’s fast enough for my MacBook Pro to enjoy fast, albeit sometimes intermittent, ‘net access. Unfortunately, the iMac G5 doesn’t have AirPort, and at the moment I don’t have a wireless USB adapter. It seemed like the perfect opportunity to try out OS X’s Internet Sharing.
Misadventures with Bluetooth
My first thought was that I have an unused Bluetooth USB adapter I bought on impulse. OS X seems to like it, so I thought I’d try sharing my AirPort connection over the Bluetooth PAN network device I activated under the “Advanced” sheet of the Bluetooth preference pane.
Unfortunately, though the service was offered, the iMac G5 didn’t want to connect to the MacBook Pro’s network. The menu item for it is grayed out. Google didn’t find me any valuable information to speak of. I’ll post back if I dig anything up later; this isn’t the first time I’ve tried (and failed at) sharing an Internet connection with another Mac over Bluetooth.
The Wired Route
Since the computers are only inches apart, I dug out a two-foot Ethernet cable and ran it between them, then told the MacBook Pro to share its connection through it. No luck, though, as the iMac G5 got a self-assigned IP address. Confused, I turned to the Console on the MacBook Pro and saw this repeated every ten seconds:
com.apple.launchd[1] (com.apple.InternetSharing[5303]) Exited with exit code: 1
com.apple.launchd[1] (com.apple.InternetSharing) Throttling respawn: Will start in 10 seconds
Apparently, the whenever the Internet Sharing daemon exits the system just tells it to relaunch. Needless to say, this doesn’t resolve the issue of why it quit in the first place, and just leads to an endless loop.
Manual Override
The locate command tells me that InternetSharing is in /usr/libexec/, and also that there’s a manpage on the program. The latter, in turn, tells me that the -d flag prints out debug details:
$ sudo /usr/libexec/InternetSharing -d
InternetSharing[5205]: InternetSharing starting
/etc/bootpd.plist is empty/missing
InternetSharing[5205]: 802.1X is active - exiting
I’m not entirely sure why it’s complaining about 802.1X — it shouldn’t be active at home, and I went ahead and removed all of my 802.1X profiles in the Network preference pane. This didn’t stop the daemon from complaining and stubbornly refusing to stay open.
Determined to fix the problem, I pulled out a disassembler and looked for the logic that prints out the “802.1X is active” line:
|
|
|
|
0x5906 |
movl |
0x00007274,%eax |
|
0x590b |
calll |
0x00004f52 |
Anon42 |
0x5910 |
testb |
%al,%al |
|
0x5912 |
je |
0x00005930 |
|
|
|
|
|
0x5914 |
movl |
$0x00006ed5,0x04(%esp) |
802.1X is active - exiting |
0x591c |
jmpl |
0x00005378 |
|
The code calls some function Anon42 which returns a boolean value of whether or not 802.1X is active. If so, it jumps to a routine that prints out and exits the program. If we altered the instruction at 0x5912 to be an unconditional jump, the program would run regardless of the state of 802.1X.
Now, there’s undoubtedly a good reason for performing this check, but since it was behaving erroneously, I went ahead and applied the patch and tried sharing again. I’m happy to report that the daemon stays open and shares the Internet connection with the iMac just fine.
Fat Pipe
To give you an idea of the relative speeds of the connections:
|
| MacBook Pro |
 |
| iMac G5 |
 |
It looks like we add 20 ms to our ping and cut back the download rate by 2 MBits/sec, but otherwise the speeds are, in my opinion, respectable.