It helps to get IGMP join and leaves the right way round
Change-Id: I7ada6835fa56aefaa421610ae8a303f2751be2b3
diff --git a/src/main/java/org/onosproject/igmp/IgmpSnoop.java b/src/main/java/org/onosproject/igmp/IgmpSnoop.java
index 2cec57b..03f561b 100644
--- a/src/main/java/org/onosproject/igmp/IgmpSnoop.java
+++ b/src/main/java/org/onosproject/igmp/IgmpSnoop.java
@@ -275,9 +275,10 @@
IGMPMembership membership = (IGMPMembership) group;
// TODO allow pulling source from IGMP packet
- IpAddress source = IpAddress.valueOf("0.0.0.0");
- if (ssmTranslateTable.containsKey(group.getGaddr())) {
- source = ssmTranslateTable.get(group.getGaddr());
+ IpAddress source = ssmTranslateTable.get(group.getGaddr());
+ if (source == null) {
+ log.warn("No source found in SSM translate table for {}", group.getGaddr());
+ return;
}
McastRoute route = new McastRoute(source,
@@ -287,14 +288,13 @@
if (membership.getRecordType() == IGMPMembership.MODE_IS_INCLUDE ||
membership.getRecordType() == IGMPMembership.CHANGE_TO_INCLUDE_MODE) {
+ multicastService.removeSink(route, location);
+ // TODO remove route if all sinks are gone
+ } else if (membership.getRecordType() == IGMPMembership.MODE_IS_EXCLUDE ||
+ membership.getRecordType() == IGMPMembership.CHANGE_TO_EXCLUDE_MODE) {
multicastService.add(route);
multicastService.addSink(route, location);
-
- } else if (membership.getRecordType() == IGMPMembership.MODE_IS_EXCLUDE ||
- membership.getRecordType() == IGMPMembership.CHANGE_TO_EXCLUDE_MODE) {
- multicastService.removeSink(route, location);
- // TODO remove route if all sinks are gone
}
});