Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gelencsér Szabolcs
/
vmdriver
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Wiki
Members
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
d054353d
authored
Jan 30, 2014
by
Guba Sándor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
netdriver: added flow rule clear before adding new rules
parent
6d7065ef
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
9 deletions
+21
-9
netdriver.py
+21
-9
No files found.
netdriver.py
View file @
d054353d
...
...
@@ -217,6 +217,9 @@ def port_create(network):
# Set VLAN parameter for tap interface
set_port_vlan
(
network
.
name
,
network
.
vlan
)
# Clear all old rules
clear_port_rules
(
network
)
# Getting network FlowPortNumber
port_number
=
get_fport_for_network
(
network
)
...
...
@@ -241,15 +244,17 @@ def port_delete(network):
# Getting network FlowPortNumber
port_number
=
get_fport_for_network
(
network
)
# Clear network rules
if
network
.
managed
:
ban_dhcp_server
(
network
,
port_number
,
remove
=
True
)
ipv4_filter
(
network
,
port_number
,
remove
=
True
)
ipv6_filter
(
network
,
port_number
,
remove
=
True
)
arp_filter
(
network
,
port_number
,
remove
=
True
)
enable_dhcp_client
(
network
,
port_number
,
remove
=
True
)
else
:
mac_filter
(
network
,
port_number
,
remove
=
True
)
# Clear network rules - debuggin 1 by 1 delete
#if network.managed:
# ban_dhcp_server(network, port_number, remove=True)
# ipv4_filter(network, port_number, remove=True)
# ipv6_filter(network, port_number, remove=True)
# arp_filter(network, port_number, remove=True)
# enable_dhcp_client(network, port_number, remove=True)
#else:
# mac_filter(network, port_number, remove=True)
clear_port_rules
(
network
)
# Explicit deny all other traffic
disable_all_not_allowed_trafic
(
network
,
port_number
,
remove
=
True
)
...
...
@@ -261,6 +266,13 @@ def port_delete(network):
del_tuntap_interface
(
network
.
name
)
def
clear_port_rules
(
network
):
""" Clear all rules for a port. """
port_number
=
get_fport_for_network
(
network
)
flow_cmd
=
build_flow_rule
(
in_port
=
port_number
)
ofctl_command_execute
([
"del-flows"
,
network
.
bridge
,
flow_cmd
])
def
pull_up_interface
(
network
):
""" Pull up interface named network.
...
...
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