Skip to content

Commit fa77abb

Browse files
committed
Allow operator to disable usage of random-fully
In some specific use case, the cloud operator expects the source port of a packet to stay the same across all masquerading layer up to the destination host. With the implementation of the random-fully code, this behavior was changed as source_port is always rewritten no matter which type of architecture / network CIDRs is being used in the backend. This setting allows a user to fallback to the original behavior of the masquerading process which is to keep the source_port consistent across all layers. The initial random-fully fix prevents packet drops when duplicate tuples are generated from two different namespace when the source_ip:source_port goes toward the same destination so enabling this setting would allow this issue to show again. Perhaps a right approach here would be to fix this "racey" situation in the kernel by perhaps using the mac address as a seed to the tuple ... Change-Id: Idfe5e51007b9a3eaa48779cd01edbca2f586eee5 Closes-bug: #1987396 (cherry picked from commit bbefe52)
1 parent 820b25a commit fa77abb

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
lines changed

neutron/agent/linux/iptables_manager.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -497,6 +497,10 @@ def random_fully(self):
497497
version = self._get_version()
498498
self.__class__._random_fully = utils.is_version_greater_equal(
499499
version, n_const.IPTABLES_RANDOM_FULLY_VERSION)
500+
501+
self._random_fully = self._random_fully and \
502+
cfg.CONF.AGENT.use_random_fully
503+
500504
return self._random_fully
501505

502506
@property

neutron/conf/agent/common.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,9 @@
135135
"of iptables-save. This option should not be turned "
136136
"on for production systems because it imposes a "
137137
"performance penalty.")),
138+
cfg.BoolOpt('use_random_fully',
139+
default=True,
140+
help=_("Use random-fully in SNAT masquerade rules.")),
138141
]
139142

140143
PROCESS_MONITOR_OPTS = [
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
features:
3+
- |
4+
Add ``use_random_fully`` setting to allow an operator to disable
5+
the iptables random-fully property on an iptable rules.
6+
issues:
7+
- |
8+
If the ``use_random_fully`` setting is disabled, it will prevent
9+
random fully from being used and if there're 2 guests in different
10+
networks using the same source_ip and source_port and they try to
11+
reach the same dest_ip and dest_port, packets might be dropped in
12+
the kernel do to the racy tuple generation . Disabling this
13+
setting should only be done if source_port is really important such
14+
as in network firewall ACLs and that the source_ip are never repeating
15+
within the platform.

0 commit comments

Comments
 (0)