[erlang-questions] clarify: gen_udp Set outbound ip address
Per Hedeland
per@REDACTED
Tue Nov 13 23:00:14 CET 2007
mog <mogorman@REDACTED> wrote:
[ I wrote: ]
>>
>> Hm, I'm afraid I still can't parse the "message received as address"
>> part:-) - are you referring to the source address of the multicast
>> packets you send out? If so, why would you expect it to be anything
>> other than the unicast address of the sender? Sending packets with a
>> multicast source address should be almost as bad as sending with a
>> broadcast source address, and such packets will probably be dropped by
>> most receiving stacks.
[snip]
>when I respond, so machine A sends message to machine B it looks like
>this
>+-------------------------------+
>| Source Address: 192.168.1.50 |
>| Dest Address: 192.168.1.30 |
>+-------------------------------+
This is correct behaviour.
>which is not what i want. I want this
>
>+-------------------------------+
>| Source Address: 224.0.1.185 |
>| Dest Address: 192.168.1.30 |
>+-------------------------------+
OK, so it's not the source address of the multicast packets, but the
source address of responses to multicast packets, that you want to be
the multicast address. Why? It sounds like maybe you are trying to trick
some application that expects to send to a unicast address (where
getting a response with reversed src <-> dst addresses can be expected)
to send to a multicast address instead - probably not a good idea if so.
In any case, sending with a multicast source address is "wrong" and just
won't work in general at least - e.g. here's a snippet from Linux kernel
code, the ip_route_input_slow() function:
if (MULTICAST(saddr) || BADCLASS(saddr) || LOOPBACK(saddr))
goto martian_source;
I.e. such a packet will be dropped (possibly logged first) by the
receiving kernel before it gets anywhere near the intended recipient
application. Other stacks may have similar code, though from a quick
browse FreeBSD seems to allow a multicast source address (there's a
comment to the effect that maybe it shouldn't...).
--Per
More information about the erlang-questions
mailing list