Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug 1910378: networkpolicy: pass traffic through NAT to handle possible tuple collisions #269

Merged
merged 1 commit into from
Mar 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion pkg/network/node/networkpolicy.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,10 @@ func (np *networkPolicyPlugin) Start(node *OsdnNode) error {

otx := node.oc.NewTransaction()
for _, cn := range np.node.networkInfo.ClusterNetworks {
otx.AddFlow("table=21, priority=200, ip, nw_dst=%s, actions=ct(commit,table=30)", cn.ClusterCIDR.String())
// Must pass packets through CT NAT to ensure NAT state is handled
// correctly by OVS when NAT-ed packets have tuple collisions.
// https://bugzilla.redhat.com/show_bug.cgi?id=1910378
otx.AddFlow("table=21, priority=200, ip, nw_dst=%s, ct_state=-rpl, actions=ct(commit,nat(src=0.0.0.0),table=30)", cn.ClusterCIDR.String())
}
otx.AddFlow("table=80, priority=200, ip, ct_state=+rpl, actions=output:NXM_NX_REG2[]")
if err := otx.Commit(); err != nil {
Expand Down
4 changes: 2 additions & 2 deletions pkg/network/node/ovscontroller.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const (
Vxlan0 = "vxlan0"

// rule versioning; increment each time flow rules change
ruleVersion = 8
ruleVersion = 9

ruleVersionTable = 253
)
Expand Down Expand Up @@ -153,7 +153,7 @@ func (oc *ovsController) SetupOVS(clusterNetworkCIDR []string, serviceNetworkCID
otx.AddFlow("table=30, priority=300, ip, nw_dst=%s, actions=output:2", localSubnetGateway)
otx.AddFlow("table=30, priority=100, ip, nw_dst=%s, actions=goto_table:60", serviceNetworkCIDR)
if oc.useConnTrack {
otx.AddFlow("table=30, priority=300, ip, nw_dst=%s, ct_state=+rpl, actions=ct(nat,table=70)", localSubnetCIDR)
otx.AddFlow("table=30, priority=250, ip, nw_dst=%s, ct_state=+rpl, actions=ct(nat,table=70)", localSubnetCIDR)
}
otx.AddFlow("table=30, priority=200, ip, nw_dst=%s, actions=goto_table:70", localSubnetCIDR)
for _, clusterCIDR := range clusterNetworkCIDR {
Expand Down