diff options
author | cinap_lenrek <cinap_lenrek@felloff.net> | 2022-11-20 15:38:36 +0000 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2022-11-20 15:38:36 +0000 |
commit | 98a66671cf6900b6239ac1b48638ffa835e75c27 (patch) | |
tree | e2e11db47365f6187bcec0bf49fdb86d8790202e /sys/src/9/ip/devip.c | |
parent | 0ed8a3bd7b1bbe2a3857f2abcaabdc4edd2d8b05 (diff) |
devip: lilu dallas multicast.
Allow accepting udp "connections" using a multicast local address.
Before, it was only possible to receive multicast using the headers
option. Having a connection orirented stream can be very usefull
when receiving multicast audio data. One gets a "connection" for
every source.
Implement (optional) support for IGMPv2 and MLDv1.
This can be usefull if bridges on the network have IGMP/MLD snooping
enabled, and wont forward multicast traffic unless we report what
we excpect. This is experimental for now, so the igmp protocol
must be manually added to the kernel configuration.
Diffstat (limited to 'sys/src/9/ip/devip.c')
-rw-r--r-- | sys/src/9/ip/devip.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/sys/src/9/ip/devip.c b/sys/src/9/ip/devip.c index cb6be1d1c..44800bdb9 100644 --- a/sys/src/9/ip/devip.c +++ b/sys/src/9/ip/devip.c @@ -1173,27 +1173,27 @@ ipwrite(Chan* ch, void *v, long n, vlong off) if(cb->nf < 2) error("addmulti needs interface address"); if(cb->nf == 2){ - if(!ipismulticast(c->raddr)) - error("addmulti for a non multicast address"); if (parseip(ia, cb->f[1]) == -1) error(Ebadip); - ipifcaddmulti(c, c->raddr, ia); + if(ipcmp(c->raddr, IPnoaddr) == 0 || ipismulticast(c->laddr)) + ipifcaddmulti(c, c->laddr, ia); + else + ipifcaddmulti(c, c->raddr, ia); } else { if (parseip(ia, cb->f[1]) == -1 || parseip(ma, cb->f[2]) == -1) error(Ebadip); - if(!ipismulticast(ma)) - error("addmulti for a non multicast address"); ipifcaddmulti(c, ma, ia); } } else if(strcmp(cb->f[0], "remmulti") == 0){ if(cb->nf < 2) error("remmulti needs interface address"); - if(!ipismulticast(c->raddr)) - error("remmulti for a non multicast address"); if (parseip(ia, cb->f[1]) == -1) error(Ebadip); - ipifcremmulti(c, c->raddr, ia); + if(ipcmp(c->raddr, IPnoaddr) == 0 || ipismulticast(c->laddr)) + ipifcremmulti(c, c->laddr, ia); + else + ipifcremmulti(c, c->raddr, ia); } else if(x->ctl != nil) { p = (*x->ctl)(c, cb->f, cb->nf); if(p != nil) @@ -1258,7 +1258,7 @@ Fsproto(Fs *f, Proto *p) p->f = f; - if(p->ipproto > 0){ + if(p->ipproto >= 0){ if(f->t2p[p->ipproto] != nil) return -1; f->t2p[p->ipproto] = p; |