Commit 1e75e8f6 authored by Pedro Oliveira's avatar Pedro Oliveira

Allow enabling/disabling StateRefresh on previously disabled/enabled PIM-DM...

Allow enabling/disabling StateRefresh on previously disabled/enabled PIM-DM interfaces without having to remove them
parent 93f87171
# PIM-DM
We have implemented the specification of PIM-DM ([RFC3973](https://tools.ietf.org/html/rfc3973)).
We have implemented PIM-DM specification ([RFC3973](https://tools.ietf.org/html/rfc3973)).
This repository stores the implementation of this protocol. The implementation is written in Python language and is destined to Linux systems.
......@@ -59,8 +60,6 @@ After starting the protocol process you can enable the protocol in specific inte
sudo pim-dm -aiigmp INTERFACE_NAME
```
If you have previously enabled PIM-DM on an interface without State-Refresh and want to enable it, you first need to disable this interface, and then run the command -aisr. The same happens when you want to disable State Refresh in a previously enabled StateRefresh interface.
#### Remove interface
To remove a previously added interface, you need run the following commands:
......
......@@ -82,7 +82,6 @@ class InterfacePim(Interface):
super()._enable()
self.force_send_hello()
def get_ip(self):
return self.ip_interface
......@@ -91,11 +90,9 @@ class InterfacePim(Interface):
packet = ReceivedPacket(raw_bytes, self)
self.PKT_FUNCTIONS[packet.payload.get_pim_type()](self, packet)
def send(self, data: bytes, group_ip: str=MCAST_GRP):
super().send(data=data, group_ip=group_ip)
#Random interval for initial Hello message on bootup or triggered Hello message to a rebooting neighbor
def force_send_hello(self):
if self.hello_timer is not None:
......@@ -142,7 +139,6 @@ class InterfacePim(Interface):
Main.kernel.interface_change_number_of_neighbors()
super().remove()
def check_number_of_neighbors(self):
has_neighbors = len(self.neighbors) > 0
if has_neighbors != self._had_neighbors:
......@@ -177,6 +173,8 @@ class InterfacePim(Interface):
self.interface_logger.debug("Remove neighbor: " + ip)
self.check_number_of_neighbors()
def set_state_refresh_capable(self, value):
self._state_refresh_capable = value
def is_state_refresh_enabled(self):
return self._state_refresh_capable
......@@ -245,7 +243,6 @@ class InterfacePim(Interface):
neighbor.receive_hello(generation_id, hello_hold_time, state_refresh_capable)
def receive_assert(self, packet):
pkt_assert = packet.payload.payload # type: PacketPimAssert
source = pkt_assert.source_address
......@@ -257,7 +254,6 @@ class InterfacePim(Interface):
except:
traceback.print_exc()
def receive_join_prune(self, packet):
pkt_join_prune = packet.payload.payload # type: PacketPimJoinPrune
......@@ -299,7 +295,6 @@ class InterfacePim(Interface):
traceback.print_exc()
continue
def receive_graft_ack(self, packet):
pkt_join_prune = packet.payload.payload # type: PacketPimGraftAck
......@@ -330,7 +325,6 @@ class InterfacePim(Interface):
traceback.print_exc()
PKT_FUNCTIONS = {
0: receive_hello,
3: receive_join_prune,
......
......@@ -128,6 +128,7 @@ class Kernel:
vif_already_exists = pim_interface or igmp_interface
if pim_interface:
# already exists
pim_interface.set_state_refresh_capable(state_refresh_capable)
return
elif igmp_interface:
index = igmp_interface.vif_index
......
......@@ -9,7 +9,7 @@ import os
import argparse
import traceback
VERSION = "1.0.3"
VERSION = "1.0.4"
def client_socket(data_to_send):
# Create a UDS socket
......
......@@ -112,10 +112,8 @@ class KernelEntry:
prune_indicator_flag = packet.payload.payload.prune_indicator_flag #P
interval = packet.payload.payload.interval
received_metric = AssertMetric(metric_preference=metric_preference, route_metric=metric, ip_address=source_of_state_refresh, state_refresh_interval=interval)
self.interface_state[index].recv_state_refresh_msg(received_metric, prune_indicator_flag)
iif = packet.interface.vif_index
if iif != self.inbound_interface_index:
return
......
......@@ -12,11 +12,11 @@ setup(
description="PIM-DM protocol",
long_description=open("README.md", "r").read(),
long_description_content_type="text/markdown",
keywords="PIM-DM Multicast Routing Protocol Dense-Mode Router",
version="1.0.3",
keywords="PIM-DM Multicast Routing Protocol Dense-Mode Router RFC3973",
version="1.0.4",
url="http://github.com/pedrofran12/pim_dm",
author='Pedro Oliveira',
author_email='pedro.francisco.oliveira@tecnico.ulisboa.pt',
author="Pedro Oliveira",
author_email="pedro.francisco.oliveira@tecnico.ulisboa.pt",
license="MIT",
install_requires=dependencies,
packages=find_packages(exclude=["docs"]),
......@@ -46,5 +46,5 @@ setup(
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
],
python_requires='>=3.2',
python_requires=">=3.2",
)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment