Commit d054353d by Guba Sándor

netdriver: added flow rule clear before adding new rules

parent 6d7065ef
...@@ -217,6 +217,9 @@ def port_create(network): ...@@ -217,6 +217,9 @@ def port_create(network):
# Set VLAN parameter for tap interface # Set VLAN parameter for tap interface
set_port_vlan(network.name, network.vlan) set_port_vlan(network.name, network.vlan)
# Clear all old rules
clear_port_rules(network)
# Getting network FlowPortNumber # Getting network FlowPortNumber
port_number = get_fport_for_network(network) port_number = get_fport_for_network(network)
...@@ -241,15 +244,17 @@ def port_delete(network): ...@@ -241,15 +244,17 @@ def port_delete(network):
# Getting network FlowPortNumber # Getting network FlowPortNumber
port_number = get_fport_for_network(network) port_number = get_fport_for_network(network)
# Clear network rules # Clear network rules - debuggin 1 by 1 delete
if network.managed: #if network.managed:
ban_dhcp_server(network, port_number, remove=True) # ban_dhcp_server(network, port_number, remove=True)
ipv4_filter(network, port_number, remove=True) # ipv4_filter(network, port_number, remove=True)
ipv6_filter(network, port_number, remove=True) # ipv6_filter(network, port_number, remove=True)
arp_filter(network, port_number, remove=True) # arp_filter(network, port_number, remove=True)
enable_dhcp_client(network, port_number, remove=True) # enable_dhcp_client(network, port_number, remove=True)
else: #else:
mac_filter(network, port_number, remove=True) # mac_filter(network, port_number, remove=True)
clear_port_rules(network)
# Explicit deny all other traffic # Explicit deny all other traffic
disable_all_not_allowed_trafic(network, port_number, remove=True) disable_all_not_allowed_trafic(network, port_number, remove=True)
...@@ -261,6 +266,13 @@ def port_delete(network): ...@@ -261,6 +266,13 @@ def port_delete(network):
del_tuntap_interface(network.name) 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): def pull_up_interface(network):
""" Pull up interface named network. """ Pull up interface named network.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment