浏览代码

Ignore route to local ext IP in hostgw mode

Lv Lv 9 年之前
父节点
当前提交
3d0469e60b
共有 1 个文件被更改,包括 3 次插入0 次删除
  1. 3 0
      backend/hostgw/hostgw.go

+ 3 - 0
backend/hostgw/hostgw.go

@@ -145,6 +145,9 @@ func (rb *HostgwBackend) handleSubnetEvents(batch []subnet.Event) {
 				Gw:        evt.Lease.Attrs.PublicIP.ToIP(),
 				LinkIndex: rb.extIface.Index,
 			}
+			if rb.extIP.Equal(route.Gw) {
+				continue
+			}
 			if err := netlink.RouteAdd(&route); err != nil {
 				log.Errorf("Error adding route to %v via %v: %v", evt.Lease.Subnet, evt.Lease.Attrs.PublicIP, err)
 				continue