Re: [9fans] IP Multicast - Results

2016-09-14 Thread Jules Merit
Multi-cast! Alice-code. Mama JDredd.
Belgium pulse badaboom. WhiteHat.

On Sep 14, 2016 9:44 PM, "Alex Musolino"  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


Re: [9fans] How Plan9 saved the world.

2016-09-14 Thread Jules Merit
James Holmes, San Diego Colorado.
Font BOLD enough for lib-ja.

HMS Ole, multi-passaway, Olga!
Alice Michael
U be illin "chicKen" "RobKen" Dallas, PoPo MacDonald KenTucky fried.
/JamesColeM.S.Anderson

On Sep 13, 2016 8:40 PM,  wrote:

Jules Merit  writes:

> I installed plan9 on mafia systems.

Sorry, bud.  That font didn't even exist back in 1953.  And the JDs in
your chart are from the North Korean nuclear test that took place just a
few days ago.

I've installed Plan 9 on Endoterrestrial systems, though.  (Those are
the people who live inside the hollow Earth.)  Now, if I could just find
the vac for my photos of them... I know I have them in venti,
somewhere...


Re: [9fans] IP Multicast - Results

2016-09-14 Thread Alex Musolino
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
#include 
#include 

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);
		}
	}
}
#include 
#include 

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);
}


[9fans] IP Multicast - Results

2016-09-14 Thread Chris McGee
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