Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removal of a unexisting flow leads to the removal of all flows #130

Open
italovalcy opened this issue May 19, 2021 · 1 comment
Open

Removal of a unexisting flow leads to the removal of all flows #130

italovalcy opened this issue May 19, 2021 · 1 comment

Comments

@italovalcy
Copy link
Contributor

Hi folks,

Arturo (@ArturoQuintana) and I were testing Kytos/FlowManager napp and we reached a possible critical bug: the request to remove an unexisting flow leads to the removal of all flows using the strict deletion action!!

How to reproduce:

  1. Run Kytos docker container with the most updated version (in our case, we are using amlight/kytos:latest docker image, which is based on Kytos master branch) and any topology (in our case, we are running with Mininet linear topology: mn --topo=linear,3 --controller=remote,ip=127.0.0.1
  2. Create a number of flows, for example:
for i in $(seq 100 200); do curl -X POST -H 'Content-type: application/json' http://127.0.0.1:8181/api/kytos/flow_manager/v2/flows/00:00:00:00:00:00:00:01 -d "{\"flows\": [{\"priority\": 100, \"match\": {\"in_port\": 1, \"dl_vlan\": $i}, \"actions\": [{\"action_type\": \"output\", \"port\": 2}]}]}"; done
  1. Make sure the flows were created:
mininet> sh ovs-ofctl dump-flows s1 | wc -l
102
  1. Delete an unexisting flow:
curl -X DELETE -H 'Content-type: application/json' http://127.0.0.1:8181/api/kytos/flow_manager/v2/flows/00:00:00:00:00:00:00:01 -d '{"flows": [{"priority": 100, "match": {"in_port": 1, "dl_vlan": 201}, "actions": [{"action_type": "output", "port": 2}]}]}'

Expected result: No flow-mod should be sent (because the flow does not exist) and also the existing flows should be preserved.

Actual result: all flows were removed! Example (we are providing the storehouse below just so you can check how it looks like after the request):

mininet> sh ovs-ofctl dump-flows s1 | wc -l
103
mininet> sh curl -X DELETE -H 'Content-type: application/json' http://127.0.0.1:8181/api/kytos/flow_manager/v2/flows/00:00:00:00:00:00:00:01 -d '{"flows": [{"priority": 100, "match": {"in_port": 1, "dl_vlan": 201}, "actions": [{"action_type": "output", "port": 2}]}]}'
{"response":"FlowMod Messages Sent"}
mininet> sh ovs-ofctl dump-flows s1
 cookie=0x0, duration=173.791s, table=0, n_packets=57, n_bytes=2394, priority=1000,dl_vlan=3799,dl_type=0x88cc actions=CONTROLLER:65535
mininet> 
mininet> sh curl http://gitlab-runner.ampath.net:18181/api/kytos/storehouse/v1/kytos.flow.persistence/5a9d454e774042e9b8ac4fb065b2154d | jq -r
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 36474  100 36474    0     0  2374k      0 --:--:-- --:--:-- --:--:-- 2544k
{
  "flow_persistence": {
    "00:00:00:00:00:00:00:01": {
      "flow_list": [
        {
          "command": "add",
          "flow": {
            "actions": [
              {
                "action_type": "output",
                "port": 4294967293
              }
            ],
            "match": {
              "dl_type": 35020,
              "dl_vlan": 3799
            },
            "priority": 1000,
            "table_id": 0
          }
        },
        {
          "command": "delete",
          "flow": {
            "actions": [
              {
                "action_type": "output",
                "port": 2
              }
            ],
            "match": {
              "dl_vlan": 201,
              "in_port": 1
            },
            "priority": 100
          }
        },
        {
          "command": "delete_strict",
          "flow": {
            "actions": [
              {
                "action_type": "output",
                "port": 2
              }
            ],
            "cookie": 0,
            "hard_timeout": 0,
            "id": "2a81f1a7534ba31a088e56a31c99f143",
            "idle_timeout": 0,
            "match": {
              "dl_vlan": 100,
              "in_port": 1
            },
            "priority": 100,
            "stats": {
              "byte_count": 0,
              "duration_nsec": 573000000,
              "duration_sec": 125,
              "packet_count": 0
            },
            "switch": "00:00:00:00:00:00:00:01",
            "table_id": 0
          }
        },
        {
          "command": "delete_strict",
          "flow": {
            "actions": [
              {
                "action_type": "output",
                "port": 2
              }
            ],
            "cookie": 0,
            "hard_timeout": 0,
            "id": "ce7e4407f4a053bb3c31d700ae26a8ef",
            "idle_timeout": 0,
            "match": {
              "dl_vlan": 101,
              "in_port": 1
            },
            "priority": 100,
            "stats": {
              "byte_count": 0,
              "duration_nsec": 538000000,
              "duration_sec": 125,
              "packet_count": 0
            },
            "switch": "00:00:00:00:00:00:00:01",
            "table_id": 0
          }
        },
...
      ]
    }
  }
}
@cmagnobarbosa
Copy link
Member

Hello, following the steps you described I found the same error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants