[erlang-questions] UDP multicast on Raspberry Pi
Rad Gruchalski
radek@REDACTED
Sat May 16 19:57:40 CEST 2015
Additionally, even when both machines have the udp_multicast program running and both were recorded by tcpdump (RPi 3 times), doing:
$ ping 239.0.0.251
Results in:
PING 239.0.0.251 (239.0.0.251): 56 data bytes
64 bytes from 10.128.30.24: icmp_seq=0 ttl=64 time=0.101 ms
64 bytes from 10.128.30.24: icmp_seq=1 ttl=64 time=0.079 ms
64 bytes from 10.128.30.24: icmp_seq=2 ttl=64 time=0.125 ms
64 bytes from 10.128.30.24: icmp_seq=3 ttl=64 time=0.200 ms
64 bytes from 10.128.30.24: icmp_seq=4 ttl=64 time=0.047 ms
64 bytes from 10.128.30.24: icmp_seq=5 ttl=64 time=0.099 ms
64 bytes from 10.128.30.24: icmp_seq=6 ttl=64 time=0.087 ms
Only one host is replying. RPi isn’t in that group.
Kind regards,
Radek Gruchalski
radek@REDACTED (mailto:radek@REDACTED)
(mailto:radek@REDACTED)
de.linkedin.com/in/radgruchalski/ (http://de.linkedin.com/in/radgruchalski/)
Confidentiality:
This communication is intended for the above-named person and may be confidential and/or legally privileged.
If it has come to you in error you must take no action based on it, nor must you copy or show it to anyone; please delete/destroy and inform the sender immediately.
On Saturday, 16 May 2015 at 19:31, Rad Gruchalski wrote:
> Hi Peter,
>
> Thank you for your suggestions. I’m getting somewhere but not exactly sure where to, yet.
>
> I’m running this on RPi:
>
> tcpdump -i eth0 igmp
>
> When I join multicast group from my dev box, I get the following in the tcpdump output:
>
> 19:16:48.370585 IP drone…..german-fiber.net (http://german-fiber.net) > 239.0.0.251: igmp v2 report 239.0.0.251
>
> When I join with the RPi itself, I see:
>
> 19:18:15.245935 IP raspberrypi…..german-fiber.net (http://german-fiber.net) > igmp.mcast.net (http://igmp.mcast.net): igmp v3 report, 1 group record(s)
> 19:18:16.035929 IP raspberrypi…..german-fiber.net (http://german-fiber.net) > igmp.mcast.net (http://igmp.mcast.net): igmp v3 report, 1 group record(s)
>
>
> I read is that Ubuntu/Debian IGMP default version is 3. OS X (which the host is), defaults to 3 as well:
>
> $ sysctl net.inet.igmp.default_version
> net.inet.igmp.default_version: 3
>
>
> Erlang (?) for whatever reason announces multicast with version 2 from OS X but version 3 on Raspbian. The weird thing is that I also get double join.
>
> I tried changing the IGMP version on Raspbian to 2 by using:
>
> echo “2” > /proc/sys/net/ipv4/conf/eth0/force_igmp_version
>
> After the change, RPi join looks like this:
>
> 19:24:14.115945 IP raspberrypi…..german-fiber.net (http://german-fiber.net) > 239.0.0.251: igmp v2 report 239.0.0.251
> 19:24:14.395920 IP raspberrypi…..german-fiber.net (http://german-fiber.net) > 239.0.0.251: igmp v2 report 239.0.0.251
> 19:24:19.185936 IP raspberrypi…..german-fiber.net (http://german-fiber.net) > 239.0.0.251: igmp v2 report 239.0.0.251
>
>
> For whatever reason there are 3 joins. I’m not quite sure where the problem is. It would appear that Erlang add_membership is IGMPv2? Or would that be handled by the kernel? If it is handled by the kernel, why is it not v3 as suggested by OS X sysctl default? Following on that one, why would this behaviour be different on Raspbian?
>
>
>
>
>
>
>
>
>
>
> Kind regards,
> Radek Gruchalski
>
radek@REDACTED (mailto:radek@REDACTED)
(mailto:radek@REDACTED)
> de.linkedin.com/in/radgruchalski/ (http://de.linkedin.com/in/radgruchalski/)
>
> Confidentiality:
> This communication is intended for the above-named person and may be confidential and/or legally privileged.
> If it has come to you in error you must take no action based on it, nor must you copy or show it to anyone; please delete/destroy and inform the sender immediately.
>
>
>
> On Saturday, 16 May 2015 at 16:05, Peter Membrey wrote:
>
> > Hi Max,
> >
> > I'm afraid I don't have a direct answer for your problem, but here's some things that might help you track it down.
> >
> > First, after running your Erlang listener run the following command:
> >
> > $ netstat -g
> >
> > This will show you all of the multicast groups that you are subscribing to and on which interface. Make sure that you see the group you care about in that list.
> >
> > If it is in that list, then start a tcpdump session on that interface as root and take a look at what goes on the wire i.e:
> >
> > # tcpdump -i <interface name> port <multicast dest port>
> >
> > # tcpdump -i eth0 port 10000
> >
> > This lot will tell you if your Pi is looking for multicast and whether or not they're hitting the Pi itself. In other words this should help you isolate the problem.
> >
> > In addition you can try:
> >
> > # tcpdump -i eth0 igmp
> >
> > Which should (I'm going from memory) isolate all igmp traffic. You should see packets sent when you join and leave a group. So if you start this command first, then start your Erlang app, you should see an IGMP join going out.
> >
> > Hope some of this helps!
> >
> > Kind Regards,
> >
> > Peter Membrey
> >
> > From: "Rad Gruchalski" <radek@REDACTED (mailto:radek@REDACTED)>
> > To: "Max Lapshin" <max.lapshin@REDACTED (mailto:max.lapshin@REDACTED)>
> > Cc: "erlang questions" <erlang-questions@REDACTED (mailto:erlang-questions@REDACTED)>
> > Sent: Saturday, 16 May, 2015 21:30:13
> > Subject: Re: [erlang-questions] UDP multicast on Raspberry Pi
> >
> > Unfortunately, I get exactly the same result.
> > No data received on RPi when using multicast group.
> > It’s very strange as data published over multicast from RPi arrives at the destination. Only RPi isn’t getting any data.
> > Just to make sure I was not having any general UDP issues - this is is the no multicast server running on RPi:
> >
> > -module(udp_nomulticast).
> >
> > -behaviour(gen_server).
> >
> > -export([start_link/0, stop/0]).
> > -export([init/1, handle_call/3, handle_cast/2, handle_info/2, code_change/3, terminate/2]).
> >
> > start_link() ->
> > gen_server:start_link({local, ?MODULE}, ?MODULE, [], []).
> >
> > stop() -> gen_server:cast(?MODULE, stop).
> >
> > init([]) ->
> > Port = 6666,
> > IfaceIp = {0,0,0,0},
> > {ok, OverlaySocket} = gen_udp:open(Port, [ binary,
> > {ip, IfaceIp} ] ),
> > { ok, OverlaySocket }.
> >
> > handle_info({udp, _ClientSocket, _ClientIp, _ClientPort, Msg}, State) ->
> > error_logger:info_msg("Received multicast data: ~p", [ Msg ]),
> > {noreply, State}.
> >
> > handle_call( _, _From, State) ->
> > { reply, ok, State }.
> >
> > code_change(_OldVsn, State, _Extra) ->
> > {ok, State}.
> >
> > terminate(_, _) ->
> > ok.
> >
> > handle_cast(stop, LoopData) ->
> > {noreply, LoopData}.
> >
> >
> > And the client sending to it from the dev box (RPi IP on the local network is 10.128.30.23):
> > -module(nmcc).
> >
> > -export([run/0]).
> >
> > run() ->
> > Port = 6666,
> > IfaceIp = {0,0,0,0},
> > RPiIp = {10,128,30,23},
> > {ok, OverlaySocket} = gen_udp:open(Port, [ binary,
> > {ip, IfaceIp} ] ),
> > gen_udp:send( OverlaySocket, RPiIp, Port, <<"some random datas">> ),
> > gen_udp:close( OverlaySocket ).
> >
> >
> > This is arriving just fine:
> > pi@REDACTED ~ $ erl
> > Erlang/OTP 17 [erts-6.4] [source] [smp:4:4] [async-threads:10] [kernel-poll:false]
> >
> > Eshell V6.4 (abort with ^G)
> > 1> c("udp_nomulticast").
> > {ok,udp_nomulticast}
> > 2> udp_nomulticast:start_link().
> > {ok,<0.40.0>}
> > 3>
> > =INFO REPORT==== 16-May-2015::15:05:35 ===
> > Received multicast data: <<"some random datas”>>
> >
> >
> > I’m often jumping too fast to conclusions but I genuinely believe this could be some Erlang related problem but I am not sure how to diagnose it.
> > I tried multiple combinations, binding the server to {0,0,0,0} or multicast IP, different multicast groups. Result is always the same, traffic not arriving at RPi when using multicast UDP. What’s the best way to elevate? File a bug?
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > Kind regards,
> > Radek Gruchalski
> >
radek@REDACTED (mailto:radek@REDACTED)
(mailto:radek@REDACTED)
> > de.linkedin.com/in/radgruchalski/ (http://de.linkedin.com/in/radgruchalski/)
> >
> > Confidentiality:
> > This communication is intended for the above-named person and may be confidential and/or legally privileged.
> > If it has come to you in error you must take no action based on it, nor must you copy or show it to anyone; please delete/destroy and inform the sender immediately.
> >
> >
> >
> > On Saturday, 16 May 2015 at 08:25, Max Lapshin wrote:
> >
> > > Replace {ip, MulticastIp}, with {ip, IfaceIp},
> > >
> > >
> > >
> >
> >
> >
> > _______________________________________________
> > erlang-questions mailing list
> > erlang-questions@REDACTED (mailto:erlang-questions@REDACTED)
> > http://erlang.org/mailman/listinfo/erlang-questions
> > _______________________________________________
> > erlang-questions mailing list
> > erlang-questions@REDACTED (mailto:erlang-questions@REDACTED)
> > http://erlang.org/mailman/listinfo/erlang-questions
> >
> >
> >
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20150516/95083178/attachment.htm>
More information about the erlang-questions
mailing list