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
4bfb18c6
Commit
4bfb18c6
authored
Jul 25, 2017
by
Pedro Oliveira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove mfc and vif from kernel
parent
e74f7f2d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
6 deletions
+11
-6
Kernel.py
Kernel.py
+11
-6
No files found.
Kernel.py
View file @
4bfb18c6
...
...
@@ -63,9 +63,6 @@ class Kernel:
except
Exception
:
continue
#self.set_multicast_route("10.2.2.2", "224.12.12.112", 0)
# TODO: background thread for receiving signals
# receive signals from kernel with a background thread
handler_thread
=
threading
.
Thread
(
target
=
self
.
handler
)
handler_thread
.
daemon
=
True
...
...
@@ -99,9 +96,12 @@ class Kernel:
def
remove_virtual_interface
(
self
,
ip_interface
):
index
=
self
.
vif_dic
[
ip_interface
]
return
struct_vifctl
=
struct
.
pack
(
"HBBI 4s 4s"
,
index
,
0
,
0
,
0
,
socket
.
inet_aton
(
"0.0.0.0"
),
socket
.
inet_aton
(
"0.0.0.0"
))
self
.
socket
.
setsockopt
(
socket
.
IPPROTO_IP
,
Kernel
.
MRT_DEL_VIF
,
struct_vifctl
)
# TODO alterar MFC's para colocar a 0 esta interface
del
self
.
vif_dic
[
ip_interface
]
'''
...
...
@@ -140,8 +140,11 @@ class Kernel:
# TODO: ver melhor tabela routing
self
.
routing
[(
socket
.
inet_ntoa
(
source_ip
),
socket
.
inet_ntoa
(
group_ip
))]
=
{
"inbound_interface_index"
:
inbound_interface_index
,
"outbound_interfaces"
:
outbound_interfaces
}
def
remove_multicast_route
(
self
):
return
def
remove_multicast_route
(
self
,
source_ip
,
group_ip
):
outbound_interfaces_and_other_parameters
=
[
0
]
+
[
0
]
*
Kernel
.
MAXVIFS
+
[
0
]
*
4
struct_mfcctl
=
struct
.
pack
(
"4s 4s H "
+
"B"
*
Kernel
.
MAXVIFS
+
" IIIi"
,
source_ip
,
group_ip
,
*
outbound_interfaces_and_other_parameters
)
self
.
socket
.
setsockopt
(
socket
.
IPPROTO_IP
,
Kernel
.
MRT_DEL_MFC
,
struct_mfcctl
)
def
exit
(
self
):
self
.
running
=
False
...
...
@@ -183,4 +186,6 @@ class Kernel:
self
.
set_multicast_route
(
im_src
,
im_dst
,
im_vif
)
# TODO: handler
except
Exception
:
import
traceback
traceback
.
print_exc
()
continue
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