소스 검색

backend/udp: bind to the advertised interface

Before this fix flanneld would bind to 0.0.0.0 instead of the selected
or user specificed interface in `-iface`. This is not only unexpected
but also unnecessary because flanneld advertises its public IP through
etcd and will only expect people to talk through that IP.
Sebastian Messmer 9 년 전
부모
커밋
6c95ca9086
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      backend/udp/network.go

+ 1 - 1
backend/udp/network.go

@@ -64,7 +64,7 @@ func newNetwork(name string, sm subnet.Manager, extIface *backend.ExternalInterf
 	}
 
 	var err error
-	n.conn, err = net.ListenUDP("udp4", &net.UDPAddr{Port: port})
+	n.conn, err = net.ListenUDP("udp4", &net.UDPAddr{IP: extIface.IfaceAddr, Port: port})
 	if err != nil {
 		return nil, fmt.Errorf("failed to start listening on UDP socket: %v", err)
 	}