Merge pull request openziti/fabric#344 from openziti/tweaks

Don't send egress on re-route, since it will always be ignored
This commit is contained in:
Paul Lorenz
2022-03-30 16:19:48 -04:00
committed by GitHub
3 changed files with 15 additions and 11 deletions
+2 -1
View File
@@ -1,4 +1,5 @@
.idea
github_deploy_key
.DS_Store
.vscode/
.vscode/
go.work
+7 -6
View File
@@ -611,7 +611,7 @@ func (network *Network) selectPath(srcR *Router, svc *Service, identity string,
}
func (network *Network) RemoveCircuit(circuitId string, now bool) error {
log := pfxlog.Logger()
log := pfxlog.Logger().WithField("circuitId", circuitId)
if ss, found := network.circuitController.get(circuitId); found {
for _, r := range ss.Path.Nodes {
@@ -629,7 +629,7 @@ func (network *Network) RemoveCircuit(circuitId string, now bool) error {
log.Warnf("failed to notify strategy %v of circuit end. invalid strategy (%v)", ss.Service.TerminatorStrategy, err)
}
log.Debugf("removed circuit [s/%s]", ss.Id)
log.Debug("removed circuit")
return nil
}
@@ -792,10 +792,11 @@ func (network *Network) rerouteLink(l *Link) error {
}
func (network *Network) rerouteCircuit(circuit *Circuit) error {
log := pfxlog.Logger().WithField("circuitId", circuit.Id)
if circuit.Rerouting.CompareAndSwap(false, true) {
defer circuit.Rerouting.Set(false)
logrus.Warnf("rerouting [s/%s]", circuit.Id)
log.Warn("rerouting circuit")
if cq, err := network.UpdatePath(circuit.Path); err == nil {
circuit.Path = cq
@@ -804,11 +805,11 @@ func (network *Network) rerouteCircuit(circuit *Circuit) error {
for i := 0; i < len(cq.Nodes); i++ {
if _, err := sendRoute(cq.Nodes[i], rms[i], network.options.RouteTimeout); err != nil {
logrus.Errorf("error sending route to [r/%s] (%s)", cq.Nodes[i].Id, err)
log.WithError(err).Errorf("error sending route to [r/%s]", cq.Nodes[i].Id)
}
}
logrus.Infof("rerouted circuit [s/%s]", circuit.Id)
log.Info("rerouted circuit")
network.CircuitEvent(CircuitUpdated, circuit)
return nil
@@ -816,7 +817,7 @@ func (network *Network) rerouteCircuit(circuit *Circuit) error {
return err
}
} else {
logrus.Infof("not rerouting [s/%s], already in progress", circuit.Id)
log.Info("not rerouting circuit, already in progress")
return nil
}
}
+6 -4
View File
@@ -138,10 +138,12 @@ func (self *Path) CreateRouteMessages(attempt uint32, circuitId string, terminat
if i == len(self.Links)-1 {
// egress
routeMessage := &ctrl_pb.Route{CircuitId: circuitId, Attempt: attempt}
routeMessage.Egress = &ctrl_pb.Route_Egress{
Binding: terminator.GetBinding(),
Address: self.EgressId,
Destination: terminator.GetAddress(),
if attempt != SmartRerouteAttempt {
routeMessage.Egress = &ctrl_pb.Route_Egress{
Binding: terminator.GetBinding(),
Address: self.EgressId,
Destination: terminator.GetAddress(),
}
}
routeMessage.Forwards = append(routeMessage.Forwards, &ctrl_pb.Route_Forward{
SrcAddress: self.EgressId,