Browse Source

Merge pull request #693 from spacexnice/master

Keep route: [ 0.0.0.0/0 via ECS instance ] to work with alicloud DNAT…
Tom Denham 7 years ago
parent
commit
11e31e3327
1 changed files with 5 additions and 0 deletions
  1. 5 0
      backend/alivpc/alivpc.go

+ 5 - 0
backend/alivpc/alivpc.go

@@ -167,6 +167,11 @@ func (be *AliVpcBackend) recreateRoute(c *ecs.Client, table ecs.RouteTableSetTyp
 				log.Infof("Keep target entry: rtableid=%s, CIDR=%s, NextHop=%s \n", e.RouteTableId, e.DestinationCidrBlock, e.InstanceId)
 				continue
 			}
+			// 0.0.0.0/0 => ECS1 this kind of route is used for DNAT. so we keep it
+			if e.DestinationCidrBlock == "0.0.0.0/0" {
+				log.Infof("Keep route entry: rtableid=%s, CIDR=%s, NextHop=%s For DNAT\n", e.RouteTableId, e.DestinationCidrBlock, e.InstanceId)
+				continue
+			}
 			// Fix: here we delete all the route which targeted to us(instance) except the specified route.
 			// That means only one CIDR was allowed to target to the instance. Think if We need to change this
 			// to adapt to multi CIDR and deal with unavailable route entry.