Set multicast IP TTL to 255 in case a receiver demands an unrouted packet

Fixing #5 Tinysvcmdns invisible from chrome app mdns-browser
This commit is contained in:
df 2020-07-19 03:03:37 +00:00
parent 16f0faf3ce
commit a2560a481b
1 changed files with 8 additions and 0 deletions

View File

@ -127,6 +127,14 @@ static int create_recv_sock() {
log_message(LOG_ERR, "recv bind(): %m");
}
// (issue #5 Tinysvcmdns invisible from chrome app mdns-browser)
// TTL -> 255 in case receivers demand it (unrouted pkt)
int ttl = 255;
if ((r = setsockopt(sd, IPPROTO_IP, IP_MULTICAST_TTL, (void*) &ttl, sizeof(ttl))) < 0) {
log_message(LOG_ERR, "recv setsockopt(IP_MULTICAST_IP): %m");
return r;
}
// add membership to receiving socket
struct ip_mreq mreq;
memset(&mreq, 0, sizeof(struct ip_mreq));