9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] IP Multicast - Results
@ 2016-09-15  3:33 Chris McGee
  2016-09-15  4:23 ` Alex Musolino
  0 siblings, 1 reply; 20+ messages in thread
From: Chris McGee @ 2016-09-15  3:33 UTC (permalink / raw)


After some investigation and trial and error I'm left with the sense that multicast is not entirely implemented on plan9. Here's what I tried.

I tried setting up a udp announce directly against /net/udp for port 564. Before listening I sent an addmulti message as described in the ip manual page. According to /net/iproute there is a new route for my multicast address but it is not bound to any of my interfaces despite specifying the ip of my adapter in the addmulti. There doesn't seem to be a way to specify the interface number in the iproute protocol. My process waits but when another process on another machine sends on that multicast address it is not received.

I tried pinging 224.0.01 from another machine and my plan 9 box doesn't respond to the ping like other machines with multicast enabled.

Finally, after looking at the code in /sys/src/9/ip I find that while a queue of multicast IPmulti structs are assembled nothing at the Ethernet/ARP layer seems to register the multicast with the adapter so that it can receive packets.

Something else that's puzzling is that I can't seem to have multiple processes on the plan9 machine listening on the same udp port. On other OSes there are flags that can be set to allow reuse. I'm not seeing anything similar here.

I'm hoping that there's something that I'm missing. Has anyone else had success setting multicast servers up in any of the plan 9 variants? Otherwise, it would be a project to write the code for it. Perhaps ARP will suit my need better for detecting hosts on the same Ethernet switch.

Thanks,
Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.9fans.net/private/9fans/attachments/20160914/fc25e840/attachment.html>


^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [9fans] IP Multicast - Results
  2016-09-15  3:33 [9fans] IP Multicast - Results Chris McGee
@ 2016-09-15  4:23 ` Alex Musolino
       [not found]   ` <CAEVxPTMkyn3tzFNYMS73zQhse_mXx0KjjD9okYw2ezhGTVsJhA@mail.gmail.com>
                     ` (2 more replies)
  0 siblings, 3 replies; 20+ messages in thread
From: Alex Musolino @ 2016-09-15  4:23 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs


[-- Attachment #1.1: Type: text/plain, Size: 661 bytes --]

I was playing around with multicast on 9front the other week and
managed to get something working (for some definition of working). I
have attached 2 test programs for sending and receiving multicast
datagrams. Unfortunately, it seems you can't send/receive messages
from the same host. I'm not sure what's missing to get that part
working.

Also, note that the dial in mcastrecv.c is just a hack to get the
local address via getnetconninfo, which doesn't seem to work given the
announce directory.

Hopefully these are of some use. Would be interested to hear how to
fix the mentioned (and unmentioned) shortcomings.

--
Cheers,
Alex Musolino

[-- Attachment #1.2: Type: text/html, Size: 962 bytes --]

[-- Attachment #2: mcastrecv.c --]
[-- Type: text/x-csrc, Size: 1050 bytes --]

#include <u.h>
#include <libc.h>

static void
usage(void)
{
	print("usage: %s mcast-ip port\n", argv0);
	exits("usage");
}

void
main(int argc, char **argv)
{
	NetConnInfo *ncinfo;
	char adir[40], ldir[40], buf[1024];
	int fd, acfd, lcfd, dfd, n;

	ARGBEGIN{
	default:
		usage();
	}ARGEND;
	if(argc != 2)
		usage();
	fd = dial(netmkaddr(argv[0], "udp", argv[1]), 0, 0, 0);
	ncinfo = getnetconninfo(nil, fd);
	if(ncinfo == nil)
		sysfatal("getnetconninfo: %r");
	close(fd);
	acfd = announce(netmkaddr(argv[0], "udp", argv[1]), adir);
	if(acfd < 0)
		sysfatal("announce: %r");
	if(fprint(acfd, "addmulti %s %s", ncinfo->lsys, argv[0]) < 0)
		sysfatal("addmulti: %r");
	freenetconninfo(ncinfo);
	for(;;){
		lcfd = listen(adir, ldir);
		if(lcfd < 0)
			sysfatal("listen: %r");
		switch(fork()){
		case -1:
			sysfatal("fork: %r");
		case 0:
			dfd = accept(lcfd, ldir);
			if(dfd < 0)
				sysfatal("accept: %r");
			if((n = read(dfd, buf, sizeof(buf))) < 0)
				sysfatal("read: %r");
			write(1, buf, n);
			exits(0);
		default:
			close(lcfd);
		}
	}
}

[-- Attachment #3: mcastsend.c --]
[-- Type: text/x-csrc, Size: 665 bytes --]

#include <u.h>
#include <libc.h>

static void
usage(void)
{
	print("usage: %s mcast-addr port\n", argv0);
	exits("usage");
}

void
main(int argc, char **argv)
{
	NetConnInfo *ncinfo;
	char buf[1024];
	int fd, cfd, n;

	ARGBEGIN{
	default:
		usage();
	}ARGEND;
	if(argc != 2)
		usage();
	fd = dial(netmkaddr(argv[0], "udp", argv[1]), 0, 0, &cfd);
	if(fd < 0)
		sysfatal("dial: %r");
	ncinfo = getnetconninfo(nil, fd);
	if(ncinfo == nil)
		sysfatal("getnetconninfo: %r");
	if(fprint(cfd, "addmulti %s %s", ncinfo->lsys, argv[0]) < 0)
		sysfatal("addmulti: %r");
	freenetconninfo(ncinfo);
	while((n = read(0, buf, sizeof(buf))) > 0)
		write(fd, buf, n);
	close(fd);
}

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [9fans] IP Multicast - Results
       [not found]   ` <CAEVxPTMkyn3tzFNYMS73zQhse_mXx0KjjD9okYw2ezhGTVsJhA@mail.gmail.com>
@ 2016-09-15  5:05     ` Jules Merit
  0 siblings, 0 replies; 20+ messages in thread
From: Jules Merit @ 2016-09-15  5:05 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

[-- Attachment #1: Type: text/plain, Size: 809 bytes --]

Multi-cast! Alice-code. Mama JDredd.
Belgium pulse badaboom. WhiteHat.

On Sep 14, 2016 9:44 PM, "Alex Musolino" <musolinoa@gmail.com> wrote:

I was playing around with multicast on 9front the other week and
managed to get something working (for some definition of working). I
have attached 2 test programs for sending and receiving multicast
datagrams. Unfortunately, it seems you can't send/receive messages
from the same host. I'm not sure what's missing to get that part
working.

Also, note that the dial in mcastrecv.c is just a hack to get the
local address via getnetconninfo, which doesn't seem to work given the
announce directory.

Hopefully these are of some use. Would be interested to hear how to
fix the mentioned (and unmentioned) shortcomings.

--
Cheers,
Alex Musolino

[-- Attachment #2: Type: text/html, Size: 1338 bytes --]

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [9fans] IP Multicast - Results
  2016-09-15  4:23 ` Alex Musolino
       [not found]   ` <CAEVxPTMkyn3tzFNYMS73zQhse_mXx0KjjD9okYw2ezhGTVsJhA@mail.gmail.com>
@ 2016-09-15 19:06   ` Adriano Verardo
  2016-09-15 20:01     ` Jules Merit
  2016-09-15 23:19   ` Chris McGee
  2 siblings, 1 reply; 20+ messages in thread
From: Adriano Verardo @ 2016-09-15 19:06 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs


Years ago I've successfully used multicast for a project.
The project has been aborted just after the test of the multicast.

Probably I've that (sparse pieces of) sw ... somewhere.
I remember that I wrote them with no problems following the Plan9 man.
I also remember successfully tests of one2many e reply2sender in a net
of ten boxes.

If it could be useful, I'll willing look for that sw in my
dead-projects-repository.

adriano




^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [9fans] IP Multicast - Results
  2016-09-15 19:06   ` Adriano Verardo
@ 2016-09-15 20:01     ` Jules Merit
  0 siblings, 0 replies; 20+ messages in thread
From: Jules Merit @ 2016-09-15 20:01 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

[-- Attachment #1: Type: text/plain, Size: 694 bytes --]

Cirno, ix IV : dr No, Jason born.
IP multi under res, Mira Au
Andromeda's thoughts of Perseus codes my system, and you don't got it.

On Sep 15, 2016 12:44 PM, "Adriano Verardo" <adr.verardo@gmail.com> wrote:

>
> Years ago I've successfully used multicast for a project.
> The project has been aborted just after the test of the multicast.
>
> Probably I've that (sparse pieces of) sw ... somewhere.
> I remember that I wrote them with no problems following the Plan9 man.
> I also remember successfully tests of one2many e reply2sender in a net
> of ten boxes.
>
> If it could be useful, I'll willing look for that sw in my
> dead-projects-repository.
>
> adriano
>
>
>

[-- Attachment #2: Type: text/html, Size: 1026 bytes --]

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [9fans] IP Multicast - Results
  2016-09-15  4:23 ` Alex Musolino
       [not found]   ` <CAEVxPTMkyn3tzFNYMS73zQhse_mXx0KjjD9okYw2ezhGTVsJhA@mail.gmail.com>
  2016-09-15 19:06   ` Adriano Verardo
@ 2016-09-15 23:19   ` Chris McGee
  2016-09-16  3:33     ` Chris McGee
  2 siblings, 1 reply; 20+ messages in thread
From: Chris McGee @ 2016-09-15 23:19 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

Thank you Alex,

I will give these a try tonight. I'm happy to hear that multicast can work and it's likely just some silly mistake on my end.

Chris

> On Sep 15, 2016, at 12:23 AM, Alex Musolino <musolinoa@gmail.com> wrote:
> 
> I was playing around with multicast on 9front the other week and
> managed to get something working (for some definition of working). I
> have attached 2 test programs for sending and receiving multicast
> datagrams. Unfortunately, it seems you can't send/receive messages
> from the same host. I'm not sure what's missing to get that part
> working.
> 
> Also, note that the dial in mcastrecv.c is just a hack to get the
> local address via getnetconninfo, which doesn't seem to work given the
> announce directory.
> 
> Hopefully these are of some use. Would be interested to hear how to
> fix the mentioned (and unmentioned) shortcomings.
> 
> --
> Cheers,
> Alex Musolino
> 
> <mcastrecv.c>
> <mcastsend.c>




^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [9fans] IP Multicast - Results
  2016-09-15 23:19   ` Chris McGee
@ 2016-09-16  3:33     ` Chris McGee
  2016-09-16  3:45       ` Alex Musolino
                         ` (2 more replies)
  0 siblings, 3 replies; 20+ messages in thread
From: Chris McGee @ 2016-09-16  3:33 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

[-- Attachment #1: Type: text/plain, Size: 507 bytes --]

Hi Alex,

I tried the mcastsend and mcastrecv on my two raspberry Pi&#39;s running 9front.

I&#39;m seeing similar routes as in my own experiment without the interface number, tagged as 4m for IPv4 multicast. I can ping each device from the other using their unicast addresses.

Unfortunately, it doesn&#39;t seem to be working. Both ends are sitting idle.

Do you remember if you needed to add/remove routes to make it work? Also, did you use 9front or the bell labs distribution?

Thanks,
Chris

[-- Attachment #2: Type: text/html, Size: 4074 bytes --]

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [9fans] IP Multicast - Results
  2016-09-16  3:33     ` Chris McGee
@ 2016-09-16  3:45       ` Alex Musolino
  2016-09-16  3:52       ` Alex Musolino
  2016-09-16  7:09       ` cinap_lenrek
  2 siblings, 0 replies; 20+ messages in thread
From: Alex Musolino @ 2016-09-16  3:45 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

[-- Attachment #1: Type: text/plain, Size: 341 bytes --]

>
> Do you remember if you needed to add/remove routes to make it work? Also,
> did you use 9front or the bell labs distribution?
>

These programs work without any setup on 9front. Once the programs are
running I can ping the multicast address from either host and a new route
appears in /net/iproute.

--
Cheers,
Alex Musolino

[-- Attachment #2: Type: text/html, Size: 811 bytes --]

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [9fans] IP Multicast - Results
  2016-09-16  3:33     ` Chris McGee
  2016-09-16  3:45       ` Alex Musolino
@ 2016-09-16  3:52       ` Alex Musolino
  2016-09-16 11:12         ` Chris McGee
  2016-09-16  7:09       ` cinap_lenrek
  2 siblings, 1 reply; 20+ messages in thread
From: Alex Musolino @ 2016-09-16  3:52 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

[-- Attachment #1: Type: text/plain, Size: 227 bytes --]

>
> I tried the mcastsend and mcastrecv on my two raspberry Pi's running
> 9front.
>

How are you connecting these devices to the network? I use wired
connections to a single (dumb) switch.

--
Cheers,
Alex Musolino

[-- Attachment #2: Type: text/html, Size: 731 bytes --]

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [9fans] IP Multicast - Results
  2016-09-16  3:33     ` Chris McGee
  2016-09-16  3:45       ` Alex Musolino
  2016-09-16  3:52       ` Alex Musolino
@ 2016-09-16  7:09       ` cinap_lenrek
  2016-09-16 15:00         ` Alex Musolino
  2 siblings, 1 reply; 20+ messages in thread
From: cinap_lenrek @ 2016-09-16  7:09 UTC (permalink / raw)
  To: 9fans

nusb/ether doesnt implement multicast filter.

--
cinap



^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [9fans] IP Multicast - Results
  2016-09-16  3:52       ` Alex Musolino
@ 2016-09-16 11:12         ` Chris McGee
  0 siblings, 0 replies; 20+ messages in thread
From: Chris McGee @ 2016-09-16 11:12 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

[-- Attachment #1: Type: text/plain, Size: 317 bytes --]

Yes, same here. Both are wired directly to a dumb switch using link local addresses. No router.

I tried 225.0.0.1 port 1234 on both ends.

I can&#39;t figure out what the contents of the buffer is. Just random bytes?

It is weird that the ifc number gets filled in after pinging the multicast address.

Chris

[-- Attachment #2: Type: text/html, Size: 3064 bytes --]

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [9fans] IP Multicast - Results
  2016-09-16  7:09       ` cinap_lenrek
@ 2016-09-16 15:00         ` Alex Musolino
  2016-09-16 16:33           ` Chris McGee
  0 siblings, 1 reply; 20+ messages in thread
From: Alex Musolino @ 2016-09-16 15:00 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

[-- Attachment #1: Type: text/plain, Size: 268 bytes --]

Chris,

As cinap says:

nusb/ether doesnt implement multicast filter.
>

This is your problem. I believe the Raspberry Pi has its NIC attached
via USB internally. Therefore, multicast won't (currently) work on the
Raspberry Pi.

--
Cheers,
Alex Musolino

[-- Attachment #2: Type: text/html, Size: 670 bytes --]

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [9fans] IP Multicast - Results
  2016-09-16 15:00         ` Alex Musolino
@ 2016-09-16 16:33           ` Chris McGee
  2016-09-16 19:26             ` Richard Miller
  2016-09-16 21:26             ` cinap_lenrek
  0 siblings, 2 replies; 20+ messages in thread
From: Chris McGee @ 2016-09-16 16:33 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

[-- Attachment #1: Type: text/plain, Size: 292 bytes --]

Thanks Alex, Cinap,

Right, the Pi uses USB for its built in nic.

I wanted to make sure that I have narrowed down where the missing functionality is. It sounds like I need to have a look at how multicast filtering works with supported PCI nic cards and apply that to nusb/ether.

Chris

[-- Attachment #2: Type: text/html, Size: 2975 bytes --]

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [9fans] IP Multicast - Results
  2016-09-16 16:33           ` Chris McGee
@ 2016-09-16 19:26             ` Richard Miller
  2016-09-16 21:26             ` cinap_lenrek
  1 sibling, 0 replies; 20+ messages in thread
From: Richard Miller @ 2016-09-16 19:26 UTC (permalink / raw)
  To: 9fans

> It sounds like I need to have a look at how multicast filtering works with supported PCI nic cards and apply that to nusb/ether.

You don't have to do full filtering - it's enough to enable the adapter
to receive all multicast messages and the kernel driver will filter out
the uninteresting ones.  Some of the PC ether drivers work this way.

There's already a patch in /n/sources/patch/usbether-rpi which enables
multicast for usb/ether.  I had to write this in order to make ipv6 work
on the raspberry pi.




^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [9fans] IP Multicast - Results
  2016-09-16 16:33           ` Chris McGee
  2016-09-16 19:26             ` Richard Miller
@ 2016-09-16 21:26             ` cinap_lenrek
  2016-09-16 22:44               ` Chris McGee
  1 sibling, 1 reply; 20+ messages in thread
From: cinap_lenrek @ 2016-09-16 21:26 UTC (permalink / raw)
  To: 9fans

updated the code for multicast and promisc mode in nusb/ether...

--
cinap



^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [9fans] IP Multicast - Results
  2016-09-16 21:26             ` cinap_lenrek
@ 2016-09-16 22:44               ` Chris McGee
  2016-09-16 23:41                 ` cinap_lenrek
  0 siblings, 1 reply; 20+ messages in thread
From: Chris McGee @ 2016-09-16 22:44 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

Ooh thanks. In hg?

Chris

> On Sep 16, 2016, at 5:26 PM, cinap_lenrek@felloff.net wrote:
>
> updated the code for multicast and promisc mode in nusb/ether...
>
> --
> cinap
>



^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [9fans] IP Multicast - Results
  2016-09-16 22:44               ` Chris McGee
@ 2016-09-16 23:41                 ` cinap_lenrek
  2016-09-17 11:53                   ` Chris McGee
  0 siblings, 1 reply; 20+ messages in thread
From: cinap_lenrek @ 2016-09-16 23:41 UTC (permalink / raw)
  To: 9fans

> Ooh thanks. In hg?

yes.

--
cinap



^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [9fans] IP Multicast - Results
  2016-09-16 23:41                 ` cinap_lenrek
@ 2016-09-17 11:53                   ` Chris McGee
  2016-09-21  3:20                     ` Chris McGee
  0 siblings, 1 reply; 20+ messages in thread
From: Chris McGee @ 2016-09-17 11:53 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

I recompiled with the latest in hg. I'm still not having success with the multicast. I'm going to start adding debugging to figure out what's going on.

Chris



^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [9fans] IP Multicast - Results
  2016-09-17 11:53                   ` Chris McGee
@ 2016-09-21  3:20                     ` Chris McGee
  2016-09-21  7:41                       ` cinap_lenrek
  0 siblings, 1 reply; 20+ messages in thread
From: Chris McGee @ 2016-09-21  3:20 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

Hi All,

Multicast is working fine for me with the latest patches in 9front hg on my raspberry Pi.

Thanks Cinap, Alex et al for pointing me in the right direction.

Current status is that I can use multicast dns to discover nodes on my local network using a Go library and some patches to the Go networking code to add multicast support. I'm going to try and see if I can get that contributed to the next version.

Btw, I noticed that the net manpage doesn't accurately describe the format of /net/ipifc/x/status files. It says there are 9 columns but mine has more than that and also some extra rows for assigned IP addresses. Does anyone know if this is a 9front specific deviation or if the man page is just way out of date?

Chris

> On Sep 17, 2016, at 7:53 AM, Chris McGee <sirnewton_01@yahoo.ca> wrote:
> 
> I recompiled with the latest in hg. I'm still not having success with the multicast. I'm going to start adding debugging to figure out what's going on.
> 
> Chris
> 




^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [9fans] IP Multicast - Results
  2016-09-21  3:20                     ` Chris McGee
@ 2016-09-21  7:41                       ` cinap_lenrek
  0 siblings, 0 replies; 20+ messages in thread
From: cinap_lenrek @ 2016-09-21  7:41 UTC (permalink / raw)
  To: 9fans

> Btw, I noticed that the net manpage doesn't accurately describe the
> format of /net/ipifc/x/status files. It says there are 9 columns but
> mine has more than that and also some extra rows for assigned IP addresses.
> Does anyone know if this is a 9front specific deviation or if the man page
> is just way out of date?

no, the manpage is out of date... the state printing code is the same
as in official plan 9, see:

/sys/src/9/ip/ipifc.c:/^ipifcstate

--
cinap



^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2016-09-21  7:41 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-15  3:33 [9fans] IP Multicast - Results Chris McGee
2016-09-15  4:23 ` Alex Musolino
     [not found]   ` <CAEVxPTMkyn3tzFNYMS73zQhse_mXx0KjjD9okYw2ezhGTVsJhA@mail.gmail.com>
2016-09-15  5:05     ` Jules Merit
2016-09-15 19:06   ` Adriano Verardo
2016-09-15 20:01     ` Jules Merit
2016-09-15 23:19   ` Chris McGee
2016-09-16  3:33     ` Chris McGee
2016-09-16  3:45       ` Alex Musolino
2016-09-16  3:52       ` Alex Musolino
2016-09-16 11:12         ` Chris McGee
2016-09-16  7:09       ` cinap_lenrek
2016-09-16 15:00         ` Alex Musolino
2016-09-16 16:33           ` Chris McGee
2016-09-16 19:26             ` Richard Miller
2016-09-16 21:26             ` cinap_lenrek
2016-09-16 22:44               ` Chris McGee
2016-09-16 23:41                 ` cinap_lenrek
2016-09-17 11:53                   ` Chris McGee
2016-09-21  3:20                     ` Chris McGee
2016-09-21  7:41                       ` cinap_lenrek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).