[l3][port_forwarding] should not allow creating port_forwarding to a port which already has a binding floating IP

Bug #1799137 reported by LIU Yulong
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
neutron
Fix Released
Medium
LIU Yulong

Bug Description

Should not allow creating port_forwarding to a port which already has a binding floating IP for dvr routers.

ENV: devstack master

step to reproduce:
1. create one distributed router, and connected it to private subnet, and set public gateway.
2. create VM to the private subnet
3. binding floating IP A to VM port
4. create floating IP B with port forwarding to the VM port

Then floating IP B with port forwarding will not work. This should be restricted by neutron.

LIU Yulong (dragon889)
description: updated
description: updated
Changed in neutron:
importance: Undecided → Medium
Akihiro Motoki (amotoki)
tags: added: l3-ipam-dhcp
LIU Yulong (dragon889)
description: updated
Revision history for this message
Armando Migliaccio (armando-migliaccio) wrote :

What about step 5? I feel like you're missing to report what happens after 4.

Changed in neutron:
status: New → Incomplete
Revision history for this message
LIU Yulong (dragon889) wrote :

@Armando Migliaccio (armando-migliaccio)
Thanks for the comment. There is no step 5.
And this is the consequence:
"""
Then floating IP B with port forwarding will not work.
"""

Let's say something in detail, if VM port has binding floating IP-A (1.1.1.1).
And then floating IP-B (1.1.1.2) added a port forwarding to the VM port with the following inputs:
"port_forwarding": {
"external_port": 8080,
"internal_port": 22,
"protocol": "tcp",
"internal_ip_address": "10.111.0.4",
"internal_port_id": "9f4fccec-fb70-4ff0-a9ed-14d6c4701413"
}

Then, this floating IP-B port forwarding will not work, because the DVR rules in the compute node will redirect the traffic.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron (master)

Fix proposed to branch: master
Review: https://review.openstack.org/614452

Changed in neutron:
assignee: nobody → LIU Yulong (dragon889)
status: Incomplete → In Progress
Revision history for this message
zhaobo (zhaobo6) wrote :

I remember that DVR case just support the centrilized cases, which is the l3 agent of network node in DVR_SNAT, and compute node is 'DVR_NO_EXTERNAL'. That's the valid case.

Could you please tell us about the deployment details?

Revision history for this message
LIU Yulong (dragon889) wrote :

@zhaobo, there is no restrictive conditions for user to create port forwarding to DVR routers.
And, for a port which already has a binding floating IP, we should not let user to waste IP for it.
That binding floating IP can process all protocol/connection etc.
So in conclusion, we should limit the user to create port forwarding to a port which has binding floating IP.
To make things simple, all type of routers will be considered, aka to save the public IP address.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron (master)

Reviewed: https://review.openstack.org/614452
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=b8d2ab8543a27b03bde534ef994027d9b44556c4
Submitter: Zuul
Branch: master

commit b8d2ab8543a27b03bde534ef994027d9b44556c4
Author: LIU Yulong <email address hidden>
Date: Mon Oct 8 14:52:16 2018 +0800

    Prevent create port forwarding to port which has binding fip

    For dvr scenario, if port has a bound floating, and then create
    port forwarding to it, this port forwarding will not work, due to
    the traffic is redirected to dvr rules.

    This patch restricts such API request, if user try to create port
    forwarding to a port, check if it has bound floating IP first.
    This will be run for all type of routers, since neutron should
    not let user to waste public IP address on a port which already
    has a floating IP, it can take care all the procotol port
    numbers.

    Closes-Bug: #1799137
    Change-Id: I4ba4b023d79185f8d478d60ce16417d3501bf785

Changed in neutron:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/neutron 14.0.0.0b1

This issue was fixed in the openstack/neutron 14.0.0.0b1 development milestone.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron (stable/rocky)

Fix proposed to branch: stable/rocky
Review: https://review.opendev.org/666235

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron (stable/rocky)

Reviewed: https://review.opendev.org/666235
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=9749fd270c1f7493fe4daf8b0e8412fcf0412184
Submitter: Zuul
Branch: stable/rocky

commit 9749fd270c1f7493fe4daf8b0e8412fcf0412184
Author: LIU Yulong <email address hidden>
Date: Mon Oct 8 14:52:16 2018 +0800

    Prevent create port forwarding to port which has binding fip

    For dvr scenario, if port has a bound floating, and then create
    port forwarding to it, this port forwarding will not work, due to
    the traffic is redirected to dvr rules.

    This patch restricts such API request, if user try to create port
    forwarding to a port, check if it has bound floating IP first.
    This will be run for all type of routers, since neutron should
    not let user to waste public IP address on a port which already
    has a floating IP, it can take care all the procotol port
    numbers.

    Conflicts:
        neutron/services/portforwarding/pf_plugin.py

    Closes-Bug: #1799137
    Change-Id: I4ba4b023d79185f8d478d60ce16417d3501bf785
    (cherry picked from commit b8d2ab8543a27b03bde534ef994027d9b44556c4)

tags: added: in-stable-rocky
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/neutron 13.0.5

This issue was fixed in the openstack/neutron 13.0.5 release.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.