4.23.0.0 VR: PREROUTING-ethX-def saves CONNMARK before setting MARK, static NAT replies leave via the wrong interface

未关闭
#14,464 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
68/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
java, linux

调研方向

Find the CloudStack code that generates the PREROUTING-ethX-def iptables mangle chain, focusing on where MARK and CONNMARK --save-mark rules are appended or inserted. Reproduce the Static NAT toggle scenario and inspect the generated rule order. Done means the chain sets the mark before saving it, and subsequent connection packets retain the expected mark and egress interface; run the relevant networking or router tests if available.

由索引模型根据 Issue 内容生成。

描述

bug
problem

Isolated network router, source NAT on eth2 (192.0.2.43), static NAT IP 203.0.113.114 on eth3
(second VLAN) to VM 10.168.10.37. After Disable/Enable Static NAT the mangle chain was:

-A PREROUTING -s 10.168.10.37/32 -m state --state NEW -j PREROUTING-eth3-def
-A PREROUTING-eth3-def -j CONNMARK --save-mark --nfmask 0xffffffff --ctmask 0xffffffff
-A PREROUTING-eth3-def -j MARK --set-xmark 0x67/0xffffffff

CONNMARK --save-mark runs before MARK, so the connection is stored with mark=0. The first packet
(SYN) is routed by fwmark 0x67 to Table_eth3 and SNATed to 203.0.113.114, but later packets of the
connection get mark 0 from --restore-mark, follow the main table out eth2 with source
203.0.113.114 and are dropped upstream. "curl -4 ifconfig.me" in the VM hangs; conntrack shows
ESTABLISHED/UNREPLIED entries with mark=0. On an earlier router build the order was MARK then
CONNMARK --save-mark and it worked.

versions

CloudStack 4.23.0.0, KVM, systemvm template 4.22.0 (router reports version 4.22.0), isolated network.

The steps to reproduce the bug
  1. Isolated network with source NAT on the untagged range; acquire a public IP from a second VLAN.
  2. Enable Static NAT to a VM, then Disable and Enable it again.
  3. In the router: iptables -t mangle -S PREROUTING-ethX-def -> CONNMARK --save-mark comes first.
  4. In the VM: curl -4 ifconfig.me hangs; conntrack -L -s shows mark=0.
What to do about it?

Generate the chain with MARK before CONNMARK --save-mark (append in that order, or insert both
at fixed positions). Workaround: iptables -t mangle -I PREROUTING-ethX-def 1 -j MARK --set-xmark 0x6N
and conntrack -D -s .

主要语言
Java
星标
3.1k
派生
1.4k
平均合并
7 天 16 小时
30 天内合并 PR
15

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

apache/cloudstack 的其他 Issue

查看 apache/cloudstack 的全部 Issue

相似的 Issue

更多 Java Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。