blob: 50aad57bf7bdfee25b27e37c0c243daf15a2ed1f [file] [log] [blame]
Igmpproxy currently only sends IGMP membership reports upstream
for a new flow. Once mdb entry is created, it does not forward
the reports upstream as the flow is already active. However,
some ISPs require IGMP membership reports even for an active flow
as their infrastructure might timeout if the reports are not received
periodically. This patch ensures that every received membership
report from downstream is forwarded upstream as well.
Reviewed on https://chromium-review.googlesource.com/2182981
---
diff -Naur -U 10 --show-c-function src/rttable.c src-new/rttable.c
--- src/rttable.c 2020-05-01 10:45:14.431750115 -0700
+++ src-new/rttable.c 2020-05-04 18:04:55.124490050 -0700
@@ -178,20 +178,46 @@ static void sendJoinLeaveUpstream(struct
}
}
else
{
i = MAX_UPS_VIFS;
}
}
}
/**
+* Internal function to send updated membership report to
+* a specified route upstream...
+*/
+static void sendReportUpstream(uint32_t group) {
+ struct IfDesc* upstrIf;
+ int i;
+
+ for(i=0; i<MAX_UPS_VIFS; i++)
+ {
+ if (-1 != upStreamIfIdx[i])
+ {
+ // Get the upstream IF...
+ upstrIf = getIfByIx( upStreamIfIdx[i] );
+ if(upstrIf == NULL) {
+ my_log(LOG_ERR, 0 ,"FATAL: Unable to get Upstream IF.");
+ }
+ my_log(LOG_NOTICE, 0,
+ "Sending report %s upstream on IF address %s",
+ inetFmt(group, s1), inetFmt(upstrIf->InAdr.s_addr, s2));
+ sendIgmp(upstrIf->InAdr.s_addr, group, IGMP_V2_MEMBERSHIP_REPORT,
+ 0, group, 0);
+ }
+ }
+}
+
+/**
* Clear all routes from routing table, and alerts Leaves upstream.
*/
void clearAllRoutes(void) {
struct RouteTable *croute, *remainroute;
// Loop through all routes...
for(croute = routing_table; croute; croute = remainroute) {
remainroute = croute->nextroute;
@@ -357,20 +383,23 @@ int insertRoute(uint32_t group, int ifx)
if(!internUpdateKernelRoute(croute, 1)) {
my_log(LOG_WARNING, 0, "The insertion into Kernel failed.");
return 0;
}
}
// Send join message upstream, if the route has no joined flag...
if(croute->upstrState != ROUTESTATE_JOINED) {
// Send Join request upstream
sendJoinLeaveUpstream(croute, 1);
+ } else {
+ // Send Report upstream
+ sendReportUpstream(group);
}
logRouteTable("Insert Route");
return 1;
}
/**
* Activates a passive group. If the group is already
* activated, it's reinstalled in the kernel. If