axsh / openvnet

Data Center Level Virtual Network Toolkit based on Edge Overlaid Network using OpenFlow 1.3.
http://openvnet.org
GNU Lesser General Public License v3.0
75 stars 18 forks source link

enable filtering events not dispatched properly #430

Open toros11 opened 8 years ago

toros11 commented 8 years ago

When updating the filtering flags there is an issue with the options sent causing INTERFACE_DISABLED_FILTERING(2) to not always be dispatched.

toros11 commented 8 years ago

https://github.com/axsh/openvnet/blob/develop/vnet/lib/vnet/node_api/interface.rb

          case options[:ingress_filtering_enabled]
          when "true"
            dispatch_event(INTERFACE_ENABLED_FILTERING, id: interface.id)
          when "false"
            dispatch_event(INTERFACE_DISABLED_FILTERING, id: interface.id)
          end

          case options[:enable_filtering]
          when "true"
            dispatch_event(INTERFACE_ENABLED_FILTERING2, id: interface.id)
          when "false"
            dispatch_event(INTERFACE_DISABLED_FILTERING2, id: interface.id)
          end

There seems to be a problem with these case statements, even though the flag is set there neither true or false generates a response.

toros11 commented 8 years ago

In addition to the above, the current flows does not get updated when filter events are dispatched

https://github.com/axsh/openvnet/blob/develop/vnet/lib/vnet/core/interfaces/if_base.rb

    def flows_for_interface_ipv4(flows, mac_info, ipv4_info)
      cookie = self.cookie_for_ip_lease(ipv4_info[:cookie_id])

      #
      # new Classifier
      #

      if @enabled_filtering
        flows << flow_create(table: TABLE_INTERFACE_EGRESS_CLASSIFIER,
                             goto_table: TABLE_INTERFACE_EGRESS_FILTER,
                             priority: 90,
                             match_interface: @id,
                             cookie: self.cookie
                            )
      else
        flows << flow_create(table: TABLE_INTERFACE_EGRESS_CLASSIFIER,
                             goto_table: TABLE_INTERFACE_EGRESS_VALIDATE,
                             priority: 90,
                             match_interface: @id,
                             cookie: self.cookie
                            )
      end