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
57191ead
Commit
57191ead
authored
Mar 31, 2022
by
Léo-Paul Géneau
👾
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Kernel.py: wait for thread when exiting
Wait for thread loop to return when exiting
parent
38074386
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
18 deletions
+24
-18
pimdm/Kernel.py
pimdm/Kernel.py
+21
-10
pimdm/Run.py
pimdm/Run.py
+3
-8
No files found.
pimdm/Kernel.py
View file @
57191ead
...
...
@@ -51,9 +51,9 @@ class Kernel(metaclass=ABCMeta):
self
.
tree_logger
=
Main
.
logger
.
getChild
(
'KernelTree'
)
# receive signals from kernel with a background thread
handler_thread
=
Thread
(
target
=
self
.
handler
)
handler_thread
.
daemon
=
True
handler_thread
.
start
()
self
.
handler_thread
=
Thread
(
target
=
self
.
handler
)
self
.
handler_thread
.
daemon
=
True
self
.
handler_thread
.
start
()
'''
Structure to create/remove virtual interfaces
...
...
@@ -177,9 +177,14 @@ class Kernel(metaclass=ABCMeta):
raise
NotImplementedError
@
abstractmethod
def
exi
t
(
self
):
def
close_socke
t
(
self
):
raise
NotImplementedError
def
exit
(
self
):
self
.
running
=
False
self
.
close_socket
()
self
.
handler_thread
.
join
()
@
abstractmethod
def
handler
(
self
):
raise
NotImplementedError
...
...
@@ -412,12 +417,15 @@ class Kernel4(Kernel):
if
len
(
self
.
routing
[
kernel_entry
.
source_ip
])
==
0
:
self
.
routing
.
pop
(
kernel_entry
.
source_ip
)
def
exit
(
self
):
self
.
running
=
False
def
close_socket
(
self
):
with
socket
.
socket
(
socket
.
AF_INET
,
socket
.
SOCK_RAW
,
socket
.
IPPROTO_IGMP
)
as
s
:
s
.
sendto
(
b''
,
(
''
,
0
))
self
.
socket
.
close
()
def
exit
(
self
):
# MRT DONE
self
.
socket
.
setsockopt
(
socket
.
IPPROTO_IP
,
self
.
MRT_DONE
,
1
)
s
elf
.
socket
.
close
()
s
uper
().
exit
()
'''
...
...
@@ -660,12 +668,15 @@ class Kernel6(Kernel):
if
len
(
self
.
routing
[
kernel_entry
.
source_ip
])
==
0
:
self
.
routing
.
pop
(
kernel_entry
.
source_ip
)
def
exit
(
self
):
self
.
running
=
False
def
close_socket
(
self
):
with
socket
.
socket
(
socket
.
AF_INET6
,
socket
.
SOCK_RAW
,
socket
.
IPPROTO_ICMPV6
)
as
s
:
s
.
sendto
(
b'0000'
,
(
''
,
0
))
self
.
socket
.
close
()
def
exit
(
self
):
# MRT DONE
self
.
socket
.
setsockopt
(
socket
.
IPPROTO_IPV6
,
self
.
MRT6_DONE
,
1
)
s
elf
.
socket
.
close
()
s
uper
().
exit
()
'''
/*
...
...
pimdm/Run.py
View file @
57191ead
...
...
@@ -179,10 +179,8 @@ def main():
if
args
.
start
:
start
()
sys
.
exit
(
0
)
elif
args
.
stop
:
client_socket
(
args
)
sys
.
exit
(
0
)
elif
args
.
config
:
try
:
from
pimdm
import
Config
...
...
@@ -190,21 +188,18 @@ def main():
pim_globals
.
MULTICAST_TABLE_ID
,
pim_globals
.
UNICAST_TABLE_ID
=
Config
.
get_vrfs
(
conf_file_path
)
start
(
conf_file_path
)
except
(
ImportError
,
ModuleNotFoundError
):
sys
.
exit
(
"PYYAML needs to be installed. Execute
\
"
pip3 install pyyaml
\
"
"
)
raise
Exception
(
"PYYAML needs to be installed. Execute
\
"
pip3 install pyyaml
\
"
"
)
elif
args
.
verbose
:
os
.
system
(
"tail -f {}"
.
format
(
PROCESS_LOG_STDOUT_FILE
.
format
(
pim_globals
.
MULTICAST_TABLE_ID
)))
sys
.
exit
(
0
)
elif
args
.
multicast_routes
:
if
args
.
ipv4
or
not
args
.
ipv6
:
os
.
system
(
"ip mroute show table "
+
str
(
pim_globals
.
MULTICAST_TABLE_ID
))
elif
args
.
ipv6
:
os
.
system
(
"ip -6 mroute show table "
+
str
(
pim_globals
.
MULTICAST_TABLE_ID
))
sys
.
exit
(
0
)
elif
not
is_running
():
print
(
"PIM-DM is not running"
)
parser
.
print_usage
()
sys
.
exit
(
0
)
else
:
client_socket
(
args
)
def
process_file_path
():
...
...
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