Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #3632

Re: Problem receiving UDP broadcast packets.

From Grant Edwards <invalid@invalid.invalid>
Newsgroups comp.lang.python
Subject Re: Problem receiving UDP broadcast packets.
Date 2011-04-20 03:05 +0000
Organization PANIX Public Access Internet and UNIX, NYC
Message-ID <iolihl$ffq$1@reader1.panix.com> (permalink)
References (4 earlier) <mailman.592.1303257124.9059.python-list@python.org> <iol875$ah2$3@reader1.panix.com> <mailman.596.1303260785.9059.python-list@python.org> <iolc32$luj$1@reader1.panix.com> <mailman.598.1303262678.9059.python-list@python.org>

Show all headers | View raw


On 2011-04-20, Chris Angelico <rosuav@gmail.com> wrote:
> On Wed, Apr 20, 2011 at 11:15 AM, Grant Edwards <invalid@invalid.invalid> wrote:
>>> 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.
>
> Was hoping that you could make such a change _only_ on the computer
> that's receiving the data - that way it's only one change, the devices
> don't need any tweaking. But if it can't be, it can't be.

There can by any number of devices that have to receive the broadcast
packet, and any of them can be on different subnets (or have no IP
address at all).

>> 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.

It turns out that some OSes (BSD and some flavors of Windows) can't
broadcast to 255.255.255.255, only to the subnet broadcast address.
Hence the requirement for the devices to be able to receive a subnet
broadcast regardless of their IP address.

>> That pretty much clinches the requirement to use a raw socket. :/
>
> Sounds to me like someone majorly abused IP to do weird things.

Indeed.  The other option is to do something that's not based on IP
but done completely at the Ethernet layer.  Implementing management
programs that can do that can be very nasty on Windows, which
unfortunately matters to most customers.

So you bite the bullet on the device end and implement all sorts of
weirdness in order to allow the management program to use standard
UDP.

> Looks like you're stuck doing the same weirdness, in whatever way you
> can manage

Yup.  It doesn't even appear that it can be done with a raw UDP
socket. According to all of the documentation I can find, such a
socket is supposed to receive copies of all UDP packets seen by the
kernel, but it doesn't.  Even if I use a raw UDP socket, the kernel is
still dropping broadcast packets whose source address don't match any
interface's subnet.

AFAICT, I'm going to have to go completely raw and process in
user-space every single IP packet recieved.  That's going to be
brutal on the CPU...

-- 
Grant

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Problem receiving UDP broadcast packets. Grant Edwards <invalid@invalid.invalid> - 2011-04-19 22:21 +0000
  Re: Problem receiving UDP broadcast packets. Irmen de Jong <irmen.NOSPAM@xs4all.nl> - 2011-04-20 01:13 +0200
    Re: Problem receiving UDP broadcast packets. Grant Edwards <invalid@invalid.invalid> - 2011-04-19 23:21 +0000
      Re: Problem receiving UDP broadcast packets. Irmen de Jong <irmen.NOSPAM@xs4all.nl> - 2011-04-20 01:40 +0200
        Re: Problem receiving UDP broadcast packets. Dan Stromberg <drsalists@gmail.com> - 2011-04-19 16:52 -0700
          Re: Problem receiving UDP broadcast packets. Grant Edwards <invalid@invalid.invalid> - 2011-04-20 00:09 +0000
            Re: Problem receiving UDP broadcast packets. Chris Angelico <rosuav@gmail.com> - 2011-04-20 10:53 +1000
              Re: Problem receiving UDP broadcast packets. Grant Edwards <invalid@invalid.invalid> - 2011-04-20 01:15 +0000
                Re: Problem receiving UDP broadcast packets. Chris Angelico <rosuav@gmail.com> - 2011-04-20 11:24 +1000
                Re: Problem receiving UDP broadcast packets. Grant Edwards <invalid@invalid.invalid> - 2011-04-20 03:05 +0000
                Re: Problem receiving UDP broadcast packets. Dan Stromberg <drsalists@gmail.com> - 2011-04-19 20:12 -0700
                Re: Problem receiving UDP broadcast packets. Grant Edwards <invalid@invalid.invalid> - 2011-04-20 14:31 +0000
                Re: Problem receiving UDP broadcast packets. Grant Edwards <invalid@invalid.invalid> - 2011-04-20 15:42 +0000
                Re: Problem receiving UDP broadcast packets. Dan Stromberg <drsalists@gmail.com> - 2011-04-19 20:16 -0700
                Re: Problem receiving UDP broadcast packets. Grant Edwards <invalid@invalid.invalid> - 2011-04-20 14:21 +0000
                Re: Problem receiving UDP broadcast packets. Dan Stromberg <drsalists@gmail.com> - 2011-04-20 18:35 -0700
                Re: Problem receiving UDP broadcast packets. Grant Edwards <invalid@invalid.invalid> - 2011-04-21 14:22 +0000
                Re: Problem receiving UDP broadcast packets. Heiko Wundram <modelnine@modelnine.org> - 2011-04-21 08:22 +0200
            Re: Problem receiving UDP broadcast packets. Roy Smith <roy@panix.com> - 2011-04-19 23:35 -0400
              Re: Problem receiving UDP broadcast packets. Grant Edwards <invalid@invalid.invalid> - 2011-04-20 14:23 +0000
            Re: Problem receiving UDP broadcast packets. Sherm Pendley <sherm.pendley@gmail.com> - 2011-04-20 06:07 -0400
              Re: Problem receiving UDP broadcast packets. Adam Tauno Williams <awilliam@whitemice.org> - 2011-04-20 06:20 -0400
                Re: Problem receiving UDP broadcast packets. Grant Edwards <invalid@invalid.invalid> - 2011-04-20 15:37 +0000
        Re: Problem receiving UDP broadcast packets. Grant Edwards <invalid@invalid.invalid> - 2011-04-19 23:54 +0000
          Re: Problem receiving UDP broadcast packets. Heiko Wundram <modelnine@modelnine.org> - 2011-04-20 08:45 +0200
            Re: Problem receiving UDP broadcast packets. Grant Edwards <invalid@invalid.invalid> - 2011-04-20 14:30 +0000
              Re: Problem receiving UDP broadcast packets. Heiko Wundram <modelnine@modelnine.org> - 2011-04-20 16:53 +0200
                Re: Problem receiving UDP broadcast packets. Grant Edwards <invalid@invalid.invalid> - 2011-04-20 15:24 +0000
                Re: Problem receiving UDP broadcast packets. Grant Edwards <invalid@invalid.invalid> - 2011-04-20 15:32 +0000
              Re: Problem receiving UDP broadcast packets. Grant Edwards <invalid@invalid.invalid> - 2011-04-20 15:50 +0000
  Re: Problem receiving UDP broadcast packets. Dan Stromberg <drsalists@gmail.com> - 2011-04-19 16:40 -0700
    Re: Problem receiving UDP broadcast packets. Grant Edwards <invalid@invalid.invalid> - 2011-04-20 00:00 +0000
      Re: Problem receiving UDP broadcast packets. Chris Angelico <rosuav@gmail.com> - 2011-04-20 10:32 +1000
  Re: Problem receiving UDP broadcast packets. Thomas Heller <theller@ctypes.org> - 2011-04-20 12:18 +0200
    Re: Problem receiving UDP broadcast packets. Grant Edwards <invalid@invalid.invalid> - 2011-04-20 14:35 +0000
  Re: Problem receiving UDP broadcast packets. Grant Edwards <invalid@invalid.invalid> - 2011-04-20 22:25 +0000

csiph-web