From: Grant Edwards Newsgroups: comp.lang.python Subject: Re: Problem receiving UDP broadcast packets. Date: Wed, 20 Apr 2011 01:15:14 +0000 (UTC) Organization: PANIX Public Access Internet and UNIX, NYC Lines: 34 Message-ID: References: <4dae172e$0$65870$e4fe514c@news.xs4all.nl> <4dae1d82$0$81483$e4fe514c@news.xs4all.nl> NNTP-Posting-Host: 67-220-17-92.usiwireless.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: reader1.panix.com 1303262114 22483 67.220.17.92 (20 Apr 2011 01:15:14 GMT) X-Complaints-To: abuse@panix.com NNTP-Posting-Date: Wed, 20 Apr 2011 01:15:14 +0000 (UTC) User-Agent: slrn/0.9.9p1 (Linux) Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.stben.net!border3.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!feeder2.cambriumusenet.nl!feed.tweaknews.nl!209.197.12.246.MISMATCH!nx02.iad01.newshosting.com!newshosting.com!news-out.readnews.com!transit3.readnews.com!panix!not-for-mail Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:3624 On 2011-04-20, Chris Angelico wrote: > On Wed, Apr 20, 2011 at 10:09 AM, Grant Edwards wrote: >> The management program can then send another broadcast packet to >> configure the IP address of a device. After that, the management >> program switches over to normal unicast TCP and UDP protocols (HTTP, >> TFTP, etc.) to set up the device. >> > > Wonder if it would be possible to (ab)use DHCP for this. If every > device registers itself with a central DHCP server, you could query > that to find out what's around, and configuring of IP addresses would > then be out of your hands. I can't require the presense of a DHCP server, and many installations won't have one. > Or can you simply use a stupid netmask like /1 that picks up all the > IP ranges? That way, the source-IP check wouldn't fail. That would require that the device somehow knows that it's not configured correctly and should change the netmask to /1. The device doesn't have any way to know that, and it must respond to the discovery commands both before and after it's properly configured. I've reread the protocol documentation and noticed that the device has to respond not only to broadcasts to 255.255.255.255 but also to subnet broadcasts send to subnets it's not on. That pretty much clinches the requirement to use a raw socket. :/ -- Grant