Skip to content

Commit

Permalink
remove IGMP and MLD code... they are now deployed on a separate packa…
Browse files Browse the repository at this point in the history
…ges to ease maintenance
  • Loading branch information
pedrofran12 committed Jan 3, 2021
1 parent 0cdd2a7 commit 369a6b2
Show file tree
Hide file tree
Showing 50 changed files with 42 additions and 2,768 deletions.
4 changes: 2 additions & 2 deletions pimdm/Config.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import yaml
from pimdm.tree import pim_globals
from pimdm.igmp import igmp_globals
from pimdm.mld import mld_globals
from igmp.igmp2 import igmp_globals
from mld.mld1 import mld_globals
from pimdm import Main


Expand Down
114 changes: 0 additions & 114 deletions pimdm/InterfaceIGMP.py

This file was deleted.

199 changes: 0 additions & 199 deletions pimdm/InterfaceMLD.py

This file was deleted.

16 changes: 8 additions & 8 deletions pimdm/InterfacePIM.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def __init__(self, interface_name: str, vif_index:int, state_refresh_capable:boo
# don't receive outgoing packets
s.setsockopt(socket.IPPROTO_IP, socket.IP_MULTICAST_LOOP, 0)

#self.drop_packet_type = None
self.drop_packet_type = None

super().__init__(interface_name, s, s, vif_index)
super()._enable()
Expand Down Expand Up @@ -109,9 +109,11 @@ def send(self, data: bytes, group_ip: str=MCAST_GRP):
"""
Send a new packet destined to group_ip IP
"""
#if self.drop_packet_type is not None and data.payload.get_pim_type() == self.drop_packet_type:
# self.drop_packet_type = None
# return
packet = PacketPimHeader.parse_bytes(data)
if self.drop_packet_type is not None:
if packet.get_pim_type() == self.drop_packet_type:
self.drop_packet_type = None
return

super().send(data=data, group_ip=group_ip)

Expand Down Expand Up @@ -199,15 +201,13 @@ def get_neighbors(self):
"""
Get list of known neighbors
"""
with self.neighbors_lock.genRlock():
return self.neighbors.values()
return list(self.neighbors.values())

def get_neighbor(self, ip):
"""
Get specific neighbor by its IP
"""
with self.neighbors_lock.genRlock():
return self.neighbors.get(ip)
return self.neighbors.get(ip)

def remove_neighbor(self, ip):
"""
Expand Down
16 changes: 8 additions & 8 deletions pimdm/Kernel.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
from pimdm.rwlock.RWLock import RWLockWrite
from pimdm.tree import pim_globals

from pimdm.InterfaceMLD import InterfaceMLD
from pimdm.InterfaceIGMP import InterfaceIGMP
from mld.InterfaceMLD import InterfaceMLD
from igmp.InterfaceIGMP import InterfaceIGMP
from pimdm.InterfacePIM import InterfacePim
from pimdm.InterfacePIM6 import InterfacePim6
from pimdm.tree.KernelEntry import KernelEntry
Expand Down Expand Up @@ -113,14 +113,14 @@ def create_membership_interface(self, interface_name: str):
else:
index = list(range(0, self.MAXVIFS) - self.vif_index_to_name_dic.keys())[0]

ip_interface = None
if interface_name not in self.membership_interface:
igmp_interface = self._create_membership_interface_object(interface_name, index)
self.membership_interface[interface_name] = igmp_interface
ip_interface = igmp_interface.ip_interface
membership_interface = self._create_membership_interface_object(interface_name, index)
self.membership_interface[interface_name] = membership_interface
ip_interface = membership_interface.ip_interface

if not vif_already_exists:
self.create_virtual_interface(ip_interface=ip_interface, interface_name=interface_name, index=index)
if not vif_already_exists:
self.create_virtual_interface(ip_interface=ip_interface, interface_name=interface_name, index=index)
membership_interface.enable()

@abstractmethod
def _create_membership_interface_object(self, interface_name, index):
Expand Down
Loading

0 comments on commit 369a6b2

Please sign in to comment.