Skip to content

Commit

Permalink
Merge pull request #76 from cloudnativelabs/aws-src-dst-check
Browse files Browse the repository at this point in the history
fix Source/destination check disable logic
  • Loading branch information
murali-reddy authored Jul 21, 2017
2 parents 04d0ed3 + 449f1bf commit c64b72e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions app/controllers/network_routes_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,6 @@ func (nrc *NetworkRoutingController) disableSourceDestinationCheck() {
url, err := url.Parse(providerID)
instanceID := url.Path
instanceID = strings.Trim(instanceID, "/")
glog.Infof("Disabling source destination check for the instance: " + instanceID)

sess, _ := session.NewSession(aws.NewConfig().WithMaxRetries(5))
metadataClient := ec2metadata.New(sess)
Expand All @@ -406,6 +405,8 @@ func (nrc *NetworkRoutingController) disableSourceDestinationCheck() {
)
if err != nil {
glog.Errorf("Failed to disable source destination check due to: " + err.Error())
} else {
glog.Infof("Disabled source destination check for the instance: " + instanceID)
}
}
}
Expand Down Expand Up @@ -524,7 +525,6 @@ func (nrc *NetworkRoutingController) OnNodeUpdate(nodeUpdate *watchers.NodeUpdat
glog.Errorf("Failed to add node %s as peer due to %s", nodeIP, err)
}
activeNodes[nodeIP.String()] = true
nrc.disableSourceDestinationCheck()
} else if nodeUpdate.Op == watchers.REMOVE {
glog.Infof("Received node %s removed update from watch API, so remove node from peer", nodeIP)
n := &config.Neighbor{
Expand All @@ -538,6 +538,7 @@ func (nrc *NetworkRoutingController) OnNodeUpdate(nodeUpdate *watchers.NodeUpdat
}
delete(activeNodes, nodeIP.String())
}
nrc.disableSourceDestinationCheck()
}

func (nrc *NetworkRoutingController) startBgpServer() error {
Expand Down

0 comments on commit c64b72e

Please sign in to comment.