Re: UDP Broadcasts not delivered to IP address

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Bernd Eckenfels wrote:
> In article <4638EDB5.1FEB7AD9@xxxxxxxxxxx> you wrote:
> > Sometimes you don't want to bind to an interface, but to a stack.
> 
> If you want to bind to a stack, you wound bind to 0.0.0.0.
That binds to all stacks, which is something completely different.

E.g. you have two stacks, 192.168.1.1 and 192.168.2.1.
Now you get a broadcast "Who is there? Tell 192.168.1.100."
from the 192.168.2.0 network.
Now you send "I'm XYZ" to 192.168.1.100.
Now you have two options:

1 - If you bind to 0.0.0.0 and to the interface, the src address of
    that packet is correctly 192.168.2.1, but now 192.168.1.100
    can't reach you, as these packets come through a different
    interface and are only routed to 192.168.2.1.

2 - If you bind to 0.0.0.0 and to the interface, the src address of
    that packet is 192.168.1.1 instead of 192.168.2.1.

So what you want is to bind to 192.168.2.1 only, and still get
broadcasts as well as routed packets.
Right now, I just hacked the code in net/ipv4/udp.c: udp_v4_mcast_next()
to get the broadcasts even when not bound to INADDR_ANY, but I
plan to introduce a specific sockopt for this behaviour.

 Detlef

-- 
Detlef Vollmann   vollmann engineering gmbh
Linux and C++ for Embedded Systems    http://www.vollmann.ch/
Linux for PXA270 Colibri module: http://www.vollmann.ch/en/colibri/
-
To unsubscribe from this list: send the line "unsubscribe linux-net" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux 802.1Q VLAN]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Git]     [Bugtraq]     [Yosemite News and Information]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux PCI]     [Linux Admin]     [Samba]

  Powered by Linux