Skip to content

Fix duplicate POSTROUTING MASQUERADE rules#375

Merged
mavenugo merged 1 commit intomoby:masterfrom
chenchun:dup_masq_rule
Aug 3, 2015
Merged

Fix duplicate POSTROUTING MASQUERADE rules#375
mavenugo merged 1 commit intomoby:masterfrom
chenchun:dup_masq_rule

Conversation

@chenchun
Copy link
Copy Markdown
Contributor

Signed-off-by: Chun Chen ramichen@tencent.com

[root@c182 /data/home/gaia]# iptables -S POSTROUTING -t nat
-P POSTROUTING ACCEPT
-A POSTROUTING -s 192.168.1.0/24 ! -o docker0 -j MASQUERADE 
-A POSTROUTING -s 192.168.1.0/24 ! -o docker0 -j MASQUERADE 
-A POSTROUTING -s 192.168.1.0/24 ! -o docker0 -j MASQUERADE 

//docker log
time="2015-07-13T16:01:07.998115730+08:00" level=debug msg="/sbin/iptables, [-t nat -C POSTROUTING -s 192.168.1.1/24 ! -o docker0 -j MASQUERADE]" 
time="2015-07-13T16:01:08.000518242+08:00" level=debug msg="/sbin/iptables, [-t nat -I POSTROUTING -s 192.168.1.1/24 ! -o docker0 -j MASQUERADE]" 

moby/moby#12437 removed regexp from Exists function and it has side effects on creating these duplicate rules with old iptable version.
Since iptables -S POSTROUTING -t nat print masked ip address, we should use masked ip address to check if POSTROUTING MASQUERADE rule exits.

Signed-off-by: Chun Chen <ramichen@tencent.com>
@aboch
Copy link
Copy Markdown
Contributor

aboch commented Jul 13, 2015

Thanks for taking care of this. We had it on our list.

LGTM

@mavenugo
Copy link
Copy Markdown
Contributor

mavenugo commented Aug 3, 2015

LGTM.

mavenugo added a commit that referenced this pull request Aug 3, 2015
Fix duplicate POSTROUTING MASQUERADE rules
@mavenugo mavenugo merged commit 89ab8f7 into moby:master Aug 3, 2015
@chenchun chenchun deleted the dup_masq_rule branch August 4, 2015 01:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants