From a7fd6536f76144d7e2d18caa71f4abe516299b91 Mon Sep 17 00:00:00 2001 From: David Härdeman Date: Mon, 22 Jun 2020 14:04:46 +0200 Subject: Some fixes to igmp logic --- igmp.c | 31 ++++++++++++++++--------------- server.c | 8 +++++--- 2 files changed, 21 insertions(+), 18 deletions(-) diff --git a/igmp.c b/igmp.c index a9a8980..dc43a9f 100644 --- a/igmp.c +++ b/igmp.c @@ -289,13 +289,13 @@ igmp_parse(struct igmp *igmp) debug(DBG_IGMP, "igmp_v3_membership_report %s -> %s", src_str, dst_str); - debug(DBG_IGMP, "IGMPv3\n" - " * Type: %x\n" - " * Reserved: %u\n" - " * Csum: %u\n" - " * Reserved: %u\n" - " * NRecs: %u\n" - " * Size: %zu bytes", + debug(DBG_IGMP, "IGMPv3" + " type: %x," + " reserved: %u," + " csum: %u," + " reserved: %u," + " nrecs: %u," + " size: %zu\n", igmp_msg->v3.type, igmp_msg->v3.reserved1, igmp_msg->v3.checksum, @@ -330,12 +330,12 @@ igmp_parse(struct igmp *igmp) inet_ntop(AF_INET, &grp, grp_str, sizeof(grp_str)); debug(DBG_IGMP, "received IGMPv3 record to %s", grp_str); - debug(DBG_IGMP, "IGMPv3 rec" - " * Type: %un" - " * Auxlen: %u" - " * NSrcs: %u" - " * Addr: %s" - " * Size: %zu bytes", + debug(DBG_IGMP, "IGMPv3 rec, " + " type: %u," + " auxlen: %u," + " nsrcs: %u," + " addr: %s," + " size: %zu bytes", record->type, record->auxlen, record->nsrcs, @@ -363,9 +363,10 @@ igmp_parse(struct igmp *igmp) pos += sizeof(record->saddr[addr]); } + /* Yes, EXCL, not INCL, see RFC3376 */ if ((htonl(record->addr) == cinet_addr(224,0,2,60)) && - ((record->type == IGMP_V3_REC_MODE_IS_INCL) || - (record->type == IGMP_V3_REC_MODE_CH_INCL))) + ((record->type == IGMP_V3_REC_MODE_IS_EXCL) || + (record->type == IGMP_V3_REC_MODE_CH_EXCL))) igmp_match(); body_len -= record->auxlen; diff --git a/server.c b/server.c index 5811ef5..e1c2f4b 100644 --- a/server.c +++ b/server.c @@ -247,7 +247,7 @@ server_exec(struct server *server, const char *cmd) r = clone(server_exec_child, stack + sizeof(stack), CLONE_VM | CLONE_VFORK | CLONE_PIDFD | SIGCHLD, (void *)cmd, &pidfd); - if (r != 0) { + if (r < 0) { error("clone: %m: %i", r); return false; } @@ -435,9 +435,11 @@ server_announce_cb(struct uring_task *task, int res) assert_return(task); if (res < 0) - error("failure %i", res); + error("%s: failure %i", server->name, res); + else if (res == server->ann_buf.len) + debug(DBG_ANN, "%s: ok (%i)", server->name, res); else - debug(DBG_ANN, "result %i", res); + debug(DBG_ANN, "%s: unexpected result: %i", server->name, res); uring_task_set_fd(&server->ann_task, -1); } -- cgit v1.2.3