Skip to content

Correctly express "any address" to iptables.#2633

Merged
crosbymichael merged 1 commit intomoby:masterfrom
danderson:2598-fix-iptables-anydest
Nov 11, 2013
Merged

Correctly express "any address" to iptables.#2633
crosbymichael merged 1 commit intomoby:masterfrom
danderson:2598-fix-iptables-anydest

Conversation

@danderson
Copy link
Contributor

Iptables interprets "-d 0.0.0.0" as "-d 0.0.0.0/32", not /0. This
results in the DNAT rule never matching any traffic if not bound
to a specific host IP.

Fixes #2598

Iptables interprets "-d 0.0.0.0" as "-d 0.0.0.0/32", not /0. This
results in the DNAT rule never matching any traffic if not bound
to a specific host IP.

Fixes #2598
@keeb-zz
Copy link
Contributor

keeb-zz commented Nov 10, 2013

LGTM

@vieux
Copy link
Contributor

vieux commented Nov 11, 2013

LGTM, @crosbymichael could you take a look just to be sure ?

@crosbymichael
Copy link
Contributor

LGTM

crosbymichael added a commit that referenced this pull request Nov 11, 2013
Correctly express "any address" to iptables.
@crosbymichael crosbymichael merged commit 2fc0084 into moby:master Nov 11, 2013
@codeaholics
Copy link
Contributor

Why would you simply not omit the '-d' if you want to match any address?

@danderson
Copy link
Contributor Author

I originally wrote it as you suggest, but that ends up splitting the iptables commandline over 3 statements - prelude, optional -d, epilogue. Overall, it made the code less readable than keeping the commandline in a single statement. And "-d 0/0" is indistinguishable from no -d if you look at netfilter's configuration dumps (iptables -t nat -Lnvv), so I decided to go with the version that doesn't split the commandline up. But it's certainly possible to do it the other way as well.

@codeaholics
Copy link
Contributor

All good reasons! :-)

@yi-huan
Copy link

yi-huan commented Jun 19, 2018

@danderson Now the latest version doesn't work?

Original ip is not passed to containers

cpuguy83 pushed a commit to cpuguy83/docker that referenced this pull request May 25, 2021
Enforce order of lock acquisitions on network/controller, fixes moby#2632
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Port proxy intercepts *all* connections, not just from localhost

6 participants