Fix duplicate iptables rules#6950
Conversation
|
I'm not sure if this is the best plan of attack, but of the options I could think of it was the least bad. I'll go over what those were. For verifying that That leaves the Of course there is always the option of changing the iptables version in the docs (re hack/PACKAGERS.md & docs/sources/installation/binaries.md) from 1.4 to 1.4.11. |
|
I'll take a look into this. Though I'm not keen on bumping the iptables requirement to 1.4.11, because that would constrain some distributions to have to exclude or carry silly patches to provide docker. |
|
@jfrazelle something we use somewhere else in the code in the try with the new option |
|
ok I think I simplified things |
|
LGTM Docker daemon log `iptables -t nat -L |
|
I have mixed feelings about this! For two reasons.
"But what should we do then?" I would suggest to parse the output of |
pkg/iptables/iptables.go
Outdated
There was a problem hiding this comment.
I would probably move this delete out of the Exist function and have the caller determine if they want to delete the rule or not. I think this is two separate issues, the -C on the check is not always available and then the deletion of duplication rules
|
@jpetazzo I'm not to worried about removing and re-adding the rules so that we know they are correct but I agree that |
|
@jfrazelle @crosbymichael @jpetazzo what's the status of this ? |
|
I'll fix what I have to use
|
ebf5179 to
cd2f653
Compare
|
@crosbymichael @jpetazzo let me know if this is what you had in mind |
|
@jfrazelle this works on RHEL6 (iptables-1.4.7-11) and preserves order. Only thing I'm noticing that is still duplicated on docker daemon restart is the rule |
|
oh right I see the problem, will fix |
cd2f653 to
4f50943
Compare
|
fixed, problem with the ip passed not matching exactly the one given |
pkg/iptables/iptables.go
Outdated
There was a problem hiding this comment.
Perhaps [0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\/[0-9]{1,2} (Net mask is 1 or 2 digits?)
A bit more restrictive on the numer of digits, but will allow 999.999.999.999 so not 100% correct
/+ before the net mask in your Regex seems wrong (I think that allows multiple /, but haven't tested)
There was a problem hiding this comment.
That works and I swapped it out, I was also thinking along the lines of if there was a way to check if the string contains the substring via regex all in one swoop. Because this feels a bit nasty.
4f50943 to
812fb7a
Compare
pkg/iptables/iptables.go
Outdated
There was a problem hiding this comment.
probably not necessary, but [1-9][0-9]{0,2} might be more appropriate for octets
216a2ea to
a3d8291
Compare
|
ping @vbatts |
|
The duplication of that rule is gone now. |
|
\o/ On Thu, Sep 4, 2014 at 11:45 AM, Vincent Batts notifications@github.com
|
|
LGTM ping @jpetazzo |
If iptables version is < 1.4.11, try to delete the rule vs. checking if it exists. Fixes moby#6831. Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jfrazelle@users.noreply.github.com> (github: jfrazelle)
a3d8291 to
f3a68ff
Compare
|
i just rebased, I think we just need an ok from @jpetazzo |
|
ping @jpetazzo who is now back from out of town, sorry to be such a nag, this one has just been around awhile |
|
:boratveryverynice: (Ack, that emoji doesn't exist, shh!) LGTM |
|
yayyy! |
|
LGTM |
|
:squirrel: |
Fix duplicate iptables rules
If iptables version is < 1.4.11, try to delete the rule vs. checking if it exists. Fixes #6831.
Docker-DCO-1.1-Signed-off-by: Jessica Frazelle jfrazelle@users.noreply.github.com (github: jfrazelle)