]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commit
Make floatingip reachable from the same network
authorItsuro Oda <oda@valinux.co.jp>
Wed, 25 Feb 2015 04:34:04 +0000 (13:34 +0900)
committerItsuro Oda <oda@valinux.co.jp>
Tue, 31 Mar 2015 01:05:03 +0000 (10:05 +0900)
commit5154d974fdce4625710d3b4f360d45568678eb2f
tree827a425c0bed1a07f82bae46cc86a10f1c5580ba
parent0bf6f6235ac9180892d4fcab3b4dc686b8f9c6d7
Make floatingip reachable from the same network

The problem is that if one tries to communicate from a tenant network
to floatingip which attached to a port on the same network, the
communication fails.

This problem is a regression cased by [1].
[1] https://review.openstack.org/131905/

Before [1] SNAT rule is as follows:
-s %(internal_cidr)s -j SNAT --to-source ...
(for each internal interface)

After [1] SNAT rule is as follows:
-o %(interface_name)s -j SNAT --to-source ...
(for an external interface)

The new rule was considered a super-set of the packets going out to
the external interface compared to the old rules. This is true but
there is a lack of consideration.

Note that the packet is 'going out to external interface' OR 'DNATed'
at this point since the rule:
! -o %(interdace_name)s -m conntrack ! --ctstate DNAT -j ACCEPT
was applied already. So we should consider the following three cases.

1) going out to external interface
should be SNATed. It is OK under the new rule but there was a lack
of rules for packets from indirectly connected to the router under the
old rules. ([1] fixed this.)

2) DNATed (and going out to internal interface)
2-1) came in from internal interface
should be SNATed because the return traffic needs to go through the
router to complete the conntrack association and to reverse the effect
of DNAT on the return packets. If a packet is not SNATed, the return
packet may be sent directly to the private IP of the initiator.
The old rules done SNAT in this case but the new rule doesn't.

2-2) came in from external interface
nothing to do.

This patch adds a rule for the case 2-1).
This patch also adds mangle rules to examine whether a packet came from
external interface.

Change-Id: Ifa695ac5428fb0edba60129a4d61ec0e127a5818
Closes-Bug: #1428887
etc/l3_agent.ini
neutron/agent/l3/config.py
neutron/agent/l3/router_info.py
neutron/agent/linux/iptables_manager.py
neutron/tests/functional/agent/test_l3_agent.py
neutron/tests/unit/test_iptables_manager.py
neutron/tests/unit/test_l3_agent.py
neutron/tests/unit/test_security_groups_rpc.py