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
deb782dc
Commit
deb782dc
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
6cd91ede
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
16 deletions
+22
-16
pimdm/Kernel.py
pimdm/Kernel.py
+21
-10
pimdm/Run.py
pimdm/Run.py
+1
-6
No files found.
pimdm/Kernel.py
View file @
deb782dc
...
...
@@ -63,9 +63,9 @@ class Kernel(metaclass=ABCMeta):
self
.
to_format_mrule
=
"ip {ip_version} mrule {cmd} {selector} {interface_name} lookup {table_id}"
.
format
# 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
...
...
@@ -189,9 +189,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
...
...
@@ -449,12 +454,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
()
'''
...
...
@@ -695,12 +703,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 @
deb782dc
...
...
@@ -172,7 +172,7 @@ def run_config(conf_file_path):
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
\
"
"
)
def
print_multicast_routes
(
args
):
if
args
.
ipv4
or
not
args
.
ipv6
:
...
...
@@ -200,22 +200,17 @@ def main():
if
args
.
start
:
start
()
sys
.
exit
(
0
)
elif
args
.
stop
:
client_socket
(
args
)
sys
.
exit
(
0
)
elif
args
.
config
:
run_config
(
os
.
path
.
abspath
(
args
.
config
[
0
]))
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
:
print_multicast_routes
(
args
)
sys
.
exit
(
0
)
elif
not
is_running
():
print
(
"PIM-DM is not running"
)
parser
.
print_usage
()
sys
.
exit
(
0
)
client_socket
(
args
)
...
...
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