Bug 15 - dhcp fails with Mac OS X network sharing DHCP server
: dhcp fails with Mac OS X network sharing DHCP server
Status: CLOSED FIXED
Product: SB 2/3
Classification: Unclassified
Component: Setup
: unspecified
: Other All
: P2 normal (vote)
: ---
Assigned To: Squeezebox QA Team email alias
:
Depends on:
Blocks: 5572
  Show dependency treegraph
 
Reported: 2003-12-18 14:57 UTC by Blackketter Dean
Modified: 2008-12-18 11:42 UTC (History)
7 users (show)

See Also:
Category: ---


Attachments
log of DHCP network traffic during failure (3.06 KB, application/octet-stream)
2003-12-18 14:59 UTC, Blackketter Dean
Details
Sorry, ignore this attachment. (285.50 KB, application/octet-stream)
2006-09-14 13:36 UTC, Ross Levine
Details
ethereal capture while trying to connect SB2 via airport on iMac WITH network sharing enabled (362.92 KB, application/octet-stream)
2006-09-14 13:51 UTC, Ross Levine
Details
4 sniffy captures (737.29 KB, application/zip)
2007-11-12 16:18 UTC, Ross Levine
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Blackketter Dean 2003-12-18 14:57:52 UTC
If the player attempts to obtain a DHCP address from a Mac running internet sharing, it fails.
Comment 1 Blackketter Dean 2003-12-18 14:59:07 UTC
Created attachment 1 [details]
log of DHCP network traffic during failure
Comment 2 Dan Sully 2005-08-27 13:23:02 UTC
Is this still an issue?
Comment 3 Blackketter Dean 2005-08-27 14:43:35 UTC
Yes, confirmed it still exists with fw 18 on SB2 also.
Comment 4 Dan Sully 2006-08-04 11:37:27 UTC
Is this still an issue with the latest firmware releases?

Richard checked in some DHCP fixes recently.

Thanks
Comment 5 Richard Titmuss 2006-08-16 04:21:34 UTC
Can you please test this with the latest firmware to see if this is still an issue. Thanks.
Comment 6 Chris Owens 2006-08-16 11:17:19 UTC
My mac test platform has been borrowed for Transporter FCC testing, but I'll look at it soon.

Bug 15!
Comment 7 Chris Owens 2006-09-08 10:38:39 UTC
Ross, since my test mac is still borrowed, could you give this one a try?  I don't know anything about Mac internet sharing, so there may be some research involved?
Comment 8 Ross Levine 2006-09-08 15:37:35 UTC
I'm going to need a nudge. I've looked through various settings in system preferences, I've searched google and still can't seem to figure out where OS X network sharing is. Is it called something else now? Is this something I need to download? 
Comment 9 Blackketter Dean 2006-09-08 19:19:41 UTC
Subject: Re:  dhcp fails with Mac OS X network sharing DHCP server

Try the Sharing system preference pane, click on the Internet tab,  
under OSX 10.4...

Comment 10 Ross Levine 2006-09-13 17:40:53 UTC
Verified to still be a bug in 6.5b3 on OS X 10.4. 

Thanks Dean!
Comment 11 Chris Owens 2006-09-14 11:13:47 UTC
Well, Ross, when you get in, come on over and I'll give you a crash course in using this Ethereal machine to make a capture of the DHCP traffic for Richard to look at.
Comment 12 Ross Levine 2006-09-14 13:36:06 UTC
Created attachment 1538 [details]
Sorry, ignore this attachment.
Comment 13 Ross Levine 2006-09-14 13:51:46 UTC
Created attachment 1539 [details]
ethereal capture while trying to connect SB2 via airport on iMac WITH network sharing enabled
Comment 14 Ross Levine 2006-09-14 13:55:45 UTC
Sorry about the confusion. I created the first ethereal capture without enabling Network Sharing :/ Sorry! 

Thank you Chris for the crash course!
Comment 15 Richard Titmuss 2006-09-14 14:02:10 UTC
Ross thanks for the trace. Can you let me know the WEP key, or if you were using WPA could you capture a trace with no encryption. I can't see the DHCP traffic :)
Comment 16 Ross Levine 2006-09-14 15:05:07 UTC
There is no encryption. 

MAC address of the adapter on the Mac is 00:11:24:a6:b2:b2, MAC address of the SB2 is 00:04:20:05:CA:C7. 

Does this clear up the confusion? Let me know if I did something wrong, I'm very new to the ethereal world. 
Comment 17 Blackketter Dean 2006-09-15 13:20:37 UTC
alas, not going to make it in the 6.5 release.
Comment 18 Richard Titmuss 2006-09-26 13:46:19 UTC
Ross thanks - not sure why I thought the attachment was with encryption. It looks fine tonight :). It would be great to have another trace with a pc (or similar) connecting successfully to compare. Thanks.
Comment 19 Chris Owens 2007-10-15 17:13:14 UTC
Ross, could you set up that Dell for dual boot windows/linux so we could use it for both sniffy and wispy?  Neither should be a hard drive hog, so I think the hard drive should be okay.  What do you think?
Comment 20 Ross Levine 2007-10-23 12:56:54 UTC
Ubuntu and XP are now running on sniffy jr. The Atheros minipci adapter is on it's way; I'll update this bug once I have it completely up and running. What do we need for this bug?
Comment 21 Chris Owens 2007-10-23 13:05:50 UTC
Let's get 

1) a capture of a Squeezebox failing to connect and 
2) another PC connecting successfully

and we'll have a look and see if there's anything in there of interest.
Comment 22 Ross Levine 2007-11-12 16:18:35 UTC
Created attachment 2403 [details]
4 sniffy captures

2 captures showing an ibook connecting successfully and 2 captures showing a transporter failing to reach DHCP
Comment 23 Chris Owens 2007-11-14 21:36:19 UTC
added felix so he can see if there's anything in Ross's new captures that can help get this fixed.
Comment 24 Spies Steven 2008-03-14 13:24:27 UTC
I came across this article on Mac OS X hints:
http://www.macosxhints.com/article.php?story=20071223001432304

It mentions using NetInfo Manager to change the reply_threshold_seconds value from the default value of 4 to 0.  I just tried this change and now all our products are now able to get DHCP from my Macintosh!  I have no idea what the ramifications are for changing this value but it works like a charm.

Hopefully this discovery will lead to a solution of our own.
Comment 25 Felix Mueller 2008-03-14 13:30:55 UTC
This is great news, well done. I guess, we are just not waiting long enough for an answer from DHCP.
Comment 26 Blackketter Dean 2008-03-14 16:39:34 UTC
Aha... more details from another post at http://episteme.arstechnica.com/eve/forums/a/tpc/f/8300945231/m/679001968831:

Looks like we need to tweak the "secs" field in the DHCP request to be >4.

Felix, can you give this a quick shot?

------------------------------------------------------

Essentially, 


Title: Internet Sharing incompatible with e.g. Xbox 360, due to DHCP reply threshold

Summary: 

/usr/libexec/InternetSharing sets bootpd's reply_threshold_seconds to a nonzero value. (Much more detail on this in the Notes section.) This effectively means that some devices, most prominently the Microsoft Xbox 360, will never obtain an IP address from an OS X machine that is acting as a DHCP server using Internet Sharing. Setting reply_threshold_seconds to 0 solves the problem (but is overridden whenever Internet Sharing is on).


Steps to Reproduce:

1) Enable Internet Sharing in System Preferences. For example, share a connection from AirPort to computers using Ethernet.
2) Connect an Xbox 360 using Ethernet and set it to obtain an IP address using DHCP.


Expected Results:

The Mac's DHCP server replies to the Xbox 360's DHCPDISCOVER messages, and the Xbox is able to obtain an IP address and connect to the Internet through the Mac.


Actual Results:

bootpd never replies to the Xbox.


Regression:

The problem is confirmed under 10.4.10 and 10.5.1. I have not had a chance to test under 10.4.11 but I assume it happens there as well.


Notes:

The core problem is that /usr/libexec/InternetSharing, which is the daemon that is launched whenever Internet Sharing is enabled and which then launches bootpd, is apparently hard-coded to set bootpd's reply_threshold_seconds value to 4. Under Leopard, this setting exists in /etc/bootpd.plist, while under Tiger it is found in the local NetInfo domain at /config/dhcp. It seems that /usr/libexec/InternetSharing writes to the plist (Leopard) or NetInfo (Tiger) immediately before launching bootpd, every time it launches bootpd, which makes it impossible for the user to override this behavior (e.g., by changing the value in the plist or NetInfo and then killing bootpd).

Setting reply_threshold_seconds to 4 means that bootpd will ignore DHCPDISCOVER messages whose "secs" field, as described in RFC 2131, Table 1, is less than 4. Unfortunately, some devices, including the Xbox 360 with the current firmware as of 11/18/2007, always set this field to 0 in their DHCPDISCOVER messages. (I have heard that this problem exists with the original Xbox too, as well as some other, less popular devices.) This appears to be allowed by the RFC (see p. 36), but it means that bootpd ignores all such devices and never gives them an IP address.

Since reply_threshold_seconds need not be set for bootpd to run, and it will use 0 if no value is set, I assume that this behavior is deliberate and that it exists to reduce the number of problems caused by users enabling Internet Sharing on LANs where there is already a DHCP server. Note, however, that the DHCP server that Windows XP SP2 runs when its Internet sharing is turned on doesn't exhibit the same behavior (it works with the Xbox 360).

My preference would be that the default setting be changed to 0, but if this is deemed undesirable then I would like there to be some kind of hidden, or not-so-hidden, setting to override it. I've looked everywhere I can think of and have finally been forced to conclude that no such setting currently exists and this value of 4 must be hard-coded. (The source of /usr/libexec/InternetSharing doesn't appear to be available to the public.) If it were instead configurable in /Library/Preferences/SystemConfiguration/com.apple.nat.plist, as some other advanced Internet Sharing settings already are, knowledgeable users like me could at least override it on their machines. Even better would be an "Advanced..." button in the Sharing pane of System Preferences that led to a dialog that allowed the user to, for example, check a box to eliminate the reply threshold (set it to 0).

I copied the bootpd.plist that Internet Sharing creates, disabled Internet Sharing, modified the plist to set the reply threshold to 0 and then ran bootpd manually. The Xbox 360 was then able to obtain an IP address from the Mac as desired. I have attached debugging output from bootpd in the before and after cases.
Comment 27 Blackketter Dean 2008-03-14 16:42:24 UTC
Holy crap, I just looked in the dhcp_client.c file and found that I put a patch in there that attempted to fix this a while back.

I guess it didn't work.  :(
Comment 28 Felix Mueller 2008-03-28 04:54:16 UTC
Fixed in SB fw 88, TR fw 37, SBR fw 23
Comment 29 James Richardson 2008-05-02 10:54:36 UTC
Verified Fixed with 7.0.1 r2409 / r23
Comment 30 James Richardson 2008-05-15 12:25:47 UTC
This bug has recently been fixed in the latest release of SqueezeCenter 7.0.1

Please try that version, if you still see the error, then reopen this bug.

To download this version, please navigate to: http://www.slimdevices.com/su_downloads.html