Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
pim_dm
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
pim_dm
Commits
a6e036b2
Commit
a6e036b2
authored
Jun 06, 2020
by
Pedro Oliveira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix membership removal of interface (IGMP/MLD)
parent
83a7946a
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
21 additions
and
14 deletions
+21
-14
pimdm/Kernel.py
pimdm/Kernel.py
+3
-3
pimdm/Main.py
pimdm/Main.py
+14
-7
pimdm/Run.py
pimdm/Run.py
+2
-2
pimdm/UnicastRouting.py
pimdm/UnicastRouting.py
+1
-1
setup.py
setup.py
+1
-1
No files found.
pimdm/Kernel.py
View file @
a6e036b2
...
...
@@ -124,16 +124,16 @@ class Kernel(metaclass=ABCMeta):
def
_create_membership_interface_object
(
self
,
interface_name
,
index
):
raise
NotImplementedError
def
remove_interface
(
self
,
interface_name
,
igmp
:
bool
=
False
,
pim
:
bool
=
False
):
def
remove_interface
(
self
,
interface_name
,
membership
:
bool
=
False
,
pim
:
bool
=
False
):
with
self
.
interface_lock
:
pim_interface
=
self
.
pim_interface
.
get
(
interface_name
)
membership_interface
=
self
.
membership_interface
.
get
(
interface_name
)
if
(
igmp
and
not
membership_interface
)
or
(
pim
and
not
pim_interface
)
or
(
not
igm
p
and
not
pim
):
if
(
membership
and
not
membership_interface
)
or
(
pim
and
not
pim_interface
)
or
(
not
membershi
p
and
not
pim
):
return
if
pim
:
pim_interface
=
self
.
pim_interface
.
pop
(
interface_name
)
pim_interface
.
remove
()
elif
igm
p
:
elif
membershi
p
:
membership_interface
=
self
.
membership_interface
.
pop
(
interface_name
)
membership_interface
.
remove
()
...
...
pimdm/Main.py
View file @
a6e036b2
...
...
@@ -42,11 +42,16 @@ def add_membership_interface(interface_name, ipv4=True, ipv6=False):
kernel_v6
.
create_membership_interface
(
interface_name
=
interface_name
)
def
remove_interface
(
interface_name
,
pim
=
False
,
igmp
=
False
,
ipv4
=
True
,
ipv6
=
False
):
def
remove_interface
(
interface_name
,
pim
=
False
,
membership
=
False
,
ipv4
=
True
,
ipv6
=
False
):
if
interface_name
==
"*"
:
for
interface_name
in
netifaces
.
interfaces
():
remove_interface
(
interface_name
,
pim
,
membership
,
ipv4
,
ipv6
)
return
if
ipv4
and
kernel
is
not
None
:
kernel
.
remove_interface
(
interface_name
,
pim
=
pim
,
igmp
=
igm
p
)
kernel
.
remove_interface
(
interface_name
,
pim
=
pim
,
membership
=
membershi
p
)
if
ipv6
and
kernel_v6
is
not
None
:
kernel_v6
.
remove_interface
(
interface_name
,
pim
=
pim
,
m
ld
=
igm
p
)
kernel_v6
.
remove_interface
(
interface_name
,
pim
=
pim
,
m
embership
=
membershi
p
)
def
list_neighbors
(
ipv4
=
False
,
ipv6
=
False
):
...
...
@@ -181,9 +186,11 @@ def list_routing_state(ipv4=False, ipv6=False):
def
stop
():
remove_interface
(
"*"
,
pim
=
True
,
igmp
=
True
,
ipv4
=
True
,
ipv6
=
True
)
kernel
.
exit
()
kernel_v6
.
exit
()
remove_interface
(
"*"
,
pim
=
True
,
membership
=
True
,
ipv4
=
True
,
ipv6
=
True
)
if
kernel
is
not
None
:
kernel
.
exit
()
if
kernel_v6
is
not
None
:
kernel_v6
.
exit
()
unicast_routing
.
stop
()
...
...
@@ -235,4 +242,4 @@ def main():
try
:
enable_ipv6_kernel
()
except
:
pass
\ No newline at end of file
pass
pimdm/Run.py
View file @
a6e036b2
...
...
@@ -86,10 +86,10 @@ class MyDaemon(Daemon):
Main
.
remove_interface
(
args
.
remove_interface
[
0
],
pim
=
True
,
ipv4
=
args
.
ipv4
,
ipv6
=
args
.
ipv6
)
connection
.
shutdown
(
socket
.
SHUT_RDWR
)
elif
'remove_interface_igmp'
in
args
and
args
.
remove_interface_igmp
:
Main
.
remove_interface
(
args
.
remove_interface_igmp
[
0
],
igm
p
=
True
,
ipv4
=
True
,
ipv6
=
False
)
Main
.
remove_interface
(
args
.
remove_interface_igmp
[
0
],
membershi
p
=
True
,
ipv4
=
True
,
ipv6
=
False
)
connection
.
shutdown
(
socket
.
SHUT_RDWR
)
elif
'remove_interface_mld'
in
args
and
args
.
remove_interface_mld
:
Main
.
remove_interface
(
args
.
remove_interface_mld
[
0
],
igm
p
=
True
,
ipv4
=
False
,
ipv6
=
True
)
Main
.
remove_interface
(
args
.
remove_interface_mld
[
0
],
membershi
p
=
True
,
ipv4
=
False
,
ipv6
=
True
)
connection
.
shutdown
(
socket
.
SHUT_RDWR
)
elif
'stop'
in
args
and
args
.
stop
:
Main
.
stop
()
...
...
pimdm/UnicastRouting.py
View file @
a6e036b2
...
...
@@ -194,7 +194,7 @@ class UnicastRouting(object):
print(if_name + ": " + operation)
UnicastRouting.lock.release()
if operation == 'DOWN':
Main.kernel.remove_interface(if_name,
igm
p=True, pim=True)
Main.kernel.remove_interface(if_name,
membershi
p=True, pim=True)
subnet = ipaddress.ip_network("0.0.0.0/0")
Main.kernel.notify_unicast_changes(subnet)
'''
...
...
setup.py
View file @
a6e036b2
...
...
@@ -12,7 +12,7 @@ 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 RFC3973"
,
keywords
=
"PIM-DM Multicast Routing Protocol Dense-Mode Router RFC3973
IPv4 IPv6
"
,
version
=
"1.1"
,
url
=
"http://github.com/pedrofran12/pim_dm"
,
author
=
"Pedro Oliveira"
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment