Skip to content

L4 policies stay in bpf map after policy change #2270

@joestringer

Description

@joestringer

General Information

  • Cilium 0.13.90 a1b0d89ec858 Tue, 5 Dec 2017 18:05:34 -0800 go version go1.9.2 linux/amd64
  • Linux cilium-master 4.9.17-040917-generic #201703220831 SMP Wed Mar 22 12:33:05 UTC 2017 x86_64 x86_64 x86_64GNU/Linux
  • No orchestration layer (Just running the regular development VM with docker commands)
  • Policies:
$  cat l3l4.json
[{
    "endpointSelector": {"matchLabels":{"id":"app1"}},
    "ingress": [{
        "fromEndpoints": [
            {"matchLabels":{"id":"app2"}}
        ],
        "toPorts": [{
            "ports": [{"port": "80", "protocol": "TCP"}]
        }]
    }]
}]
$ cat l3.json
[{
    "endpointSelector": {"matchLabels":{"id":"app1"}},
    "ingress": [{
        "fromEndpoints": [
            {"matchLabels":{"id":"app2"}}
        ]
    }]
}]

How to reproduce the issue

  1. docker run -d --name "app1" --net cilium-net -l "id=app1" cilium/demo-httpd
  2. cilium policy import l3l4.json
  3. docker run --rm -ti --net cilium-net -l "id=app2" cilium/demo-client curl 'http://app1/public'
  4. cilium policy delete --all
  5. cilium policy import l3.json
  6. docker run --rm -ti --net cilium-net -l "id=app2" cilium/demo-client curl 'http://app1/public'
  7. cilium bpf policy get <choose app1 epid>
$ cilium bpf policy get 173   
Was impossible to retrieve label ID 260: [GET /identity/{id}][404] getIdentityIdNotFound
Was impossible to retrieve label ID 258: [GET /identity/{id}][404] getIdentityIdNotFound
LABELS (source:key[=value])   PORT   ACTION    BYTES   PACKETS
260                           any    allowed   0       0
258                           80     allowed   0       0

The IDs are different, but we can see that the old policy entry which filtered on specific L4 ports is still available, even though we deleted the cilium policy.

Final policy:

$ cilium policy get
[
  {
    "endpointSelector": {
      "matchLabels": {
        "any:id": "app1"
      }
    },
    "ingress": [
      {
        "fromEndpoints": [
          {
            "matchLabels": {
              "any:id": "app2"
            }
          }
        ]
      }
    ]
  }
]
Revision: 17

Metadata

Metadata

Labels

area/datapathImpacts bpf/ or low-level forwarding details, including map management and monitor messages.kind/bugThis is a bug in the Cilium logic.priority/highThis is considered vital to an upcoming release.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions