瀏覽代碼

Vendor libnetwork @4df06c4

Signed-off-by: Santhosh Manohar <santhosh@docker.com>
Santhosh Manohar 8 年之前
父節點
當前提交
b6b6d3ade4

+ 1 - 1
vendor.conf

@@ -23,7 +23,7 @@ github.com/RackSec/srslog 456df3a81436d29ba874f3590eeeee25d666f8a5
 github.com/imdario/mergo 0.2.1
 
 #get libnetwork packages
-github.com/docker/libnetwork fd27f22aaa35e3d57f88688f919d05b744f431fd
+github.com/docker/libnetwork 4df06c4a7d9b67d0948eab39c5d013d7296acdbf
 github.com/docker/go-events 18b43f1bc85d9cdd42c05a6cd2d444c7a200a894
 github.com/armon/go-radix e39d623f12e8e41c7b5529e9a9dd67a1e2261f80
 github.com/armon/go-metrics eb0af217e5e9747e41dd5303755356b62d28e3ec

+ 1 - 1
vendor/github.com/docker/libnetwork/bitseq/sequence.go

@@ -1,5 +1,5 @@
 // Package bitseq provides a structure and utilities for representing long bitmask
-// as sequence of run-lenght encoded blocks. It operates direclty on the encoded
+// as sequence of run-length encoded blocks. It operates directly on the encoded
 // representation, it does not decode/encode.
 package bitseq
 

+ 2 - 2
vendor/github.com/docker/libnetwork/controller.go

@@ -312,7 +312,7 @@ func (c *controller) clusterAgentInit() {
 				c.clusterConfigAvailable = true
 				keys := c.keys
 				c.Unlock()
-				// agent initialization needs encyrption keys and bind/remote IP which
+				// agent initialization needs encryption keys and bind/remote IP which
 				// comes from the daemon cluster events
 				if len(keys) > 0 {
 					c.agentSetup()
@@ -786,7 +786,7 @@ func (c *controller) reservePools() {
 		}
 		for _, ep := range epl {
 			if err := ep.assignAddress(ipam, true, ep.Iface().AddressIPv6() != nil); err != nil {
-				logrus.Warnf("Failed to reserve current adress for endpoint %q (%s) on network %q (%s)",
+				logrus.Warnf("Failed to reserve current address for endpoint %q (%s) on network %q (%s)",
 					ep.Name(), ep.ID(), n.Name(), n.ID())
 			}
 		}

+ 6 - 5
vendor/github.com/docker/libnetwork/drivers/bridge/setup_ip_forwarding.go

@@ -2,9 +2,10 @@ package bridge
 
 import (
 	"fmt"
-	log "github.com/Sirupsen/logrus"
-	"github.com/docker/libnetwork/iptables"
 	"io/ioutil"
+
+	"github.com/Sirupsen/logrus"
+	"github.com/docker/libnetwork/iptables"
 )
 
 const (
@@ -40,14 +41,14 @@ func setupIPForwarding(enableIPTables bool) error {
 		}
 		if err := iptables.SetDefaultPolicy(iptables.Filter, "FORWARD", iptables.Drop); err != nil {
 			if err := configureIPForwarding(false); err != nil {
-				log.Errorf("Disabling IP forwarding failed, %v", err)
+				logrus.Errorf("Disabling IP forwarding failed, %v", err)
 			}
 			return err
 		}
 		iptables.OnReloaded(func() {
-			log.Debugf("Setting the default DROP policy on firewall reload")
+			logrus.Debug("Setting the default DROP policy on firewall reload")
 			if err := iptables.SetDefaultPolicy(iptables.Filter, "FORWARD", iptables.Drop); err != nil {
-				log.Warnf("Settig the default DROP policy on firewall reload failed, %v", err)
+				logrus.Warnf("Settig the default DROP policy on firewall reload failed, %v", err)
 			}
 		})
 	}

+ 1 - 1
vendor/github.com/docker/libnetwork/drivers/bridge/setup_ip_tables.go

@@ -71,7 +71,7 @@ func (n *bridgeNetwork) setupIPTables(config *networkConfiguration, i *bridgeInt
 		return fmt.Errorf("Cannot program chains, EnableIPTable is disabled")
 	}
 
-	// Pickup this configuraton option from driver
+	// Pickup this configuration option from driver
 	hairpinMode := !driverConfig.EnableUserlandProxy
 
 	maskedAddrv4 := &net.IPNet{

+ 1 - 1
vendor/github.com/docker/libnetwork/drivers/overlay/overlay.go

@@ -99,7 +99,7 @@ func Init(dc driverapi.DriverCallback, config map[string]interface{}) error {
 	// outside of the restore path can potentially fix the network join and succeed.
 	for nid, n := range d.networks {
 		if n.initErr != nil {
-			logrus.Infof("resetting init error and once variable for network %s after unsuccesful endpoint restore: %v", nid, n.initErr)
+			logrus.Infof("resetting init error and once variable for network %s after unsuccessful endpoint restore: %v", nid, n.initErr)
 			n.initErr = nil
 			n.once = &sync.Once{}
 		}

+ 1 - 1
vendor/github.com/docker/libnetwork/drivers/solaris/bridge/bridge.go

@@ -993,7 +993,7 @@ func (c *networkConfiguration) Conflicts(o *networkConfiguration) error {
 		return fmt.Errorf("same configuration")
 	}
 
-	// Also empty, becasue only one network with empty name is allowed
+	// Also empty, because only one network with empty name is allowed
 	if c.BridgeName == o.BridgeName {
 		return fmt.Errorf("networks have same bridge name")
 	}

+ 1 - 1
vendor/github.com/docker/libnetwork/ipvs/ipvs.go

@@ -47,7 +47,7 @@ type Handle struct {
 
 // New provides a new ipvs handle in the namespace pointed to by the
 // passed path. It will return a valid handle or an error in case an
-// error occured while creating the handle.
+// error occurred while creating the handle.
 func New(path string) (*Handle, error) {
 	setup()
 

+ 1 - 1
vendor/github.com/docker/libnetwork/network_windows.go

@@ -54,7 +54,7 @@ func (n *network) startResolver() {
 						logrus.Errorf("Resolver Setup/Start failed for container %s, %q", n.Name(), err)
 						time.Sleep(1 * time.Second)
 					} else {
-						logrus.Debugf("Resolver bound successfuly for network %s", n.Name())
+						logrus.Debugf("Resolver bound successfully for network %s", n.Name())
 						n.resolver = append(n.resolver, resolver)
 						break
 					}

+ 13 - 5
vendor/github.com/docker/libnetwork/networkdb/cluster.go

@@ -5,6 +5,7 @@ import (
 	"crypto/rand"
 	"encoding/hex"
 	"fmt"
+	"log"
 	"math/big"
 	rnd "math/rand"
 	"net"
@@ -27,15 +28,20 @@ type logWriter struct{}
 
 func (l *logWriter) Write(p []byte) (int, error) {
 	str := string(p)
+	str = strings.TrimSuffix(str, "\n")
 
 	switch {
-	case strings.Contains(str, "[WARN]"):
+	case strings.HasPrefix(str, "[WARN] "):
+		str = strings.TrimPrefix(str, "[WARN] ")
 		logrus.Warn(str)
-	case strings.Contains(str, "[DEBUG]"):
+	case strings.HasPrefix(str, "[DEBUG] "):
+		str = strings.TrimPrefix(str, "[DEBUG] ")
 		logrus.Debug(str)
-	case strings.Contains(str, "[INFO]"):
+	case strings.HasPrefix(str, "[INFO] "):
+		str = strings.TrimPrefix(str, "[INFO] ")
 		logrus.Info(str)
-	case strings.Contains(str, "[ERR]"):
+	case strings.HasPrefix(str, "[ERR] "):
+		str = strings.TrimPrefix(str, "[ERR] ")
 		logrus.Warn(str)
 	}
 
@@ -104,7 +110,9 @@ func (nDB *NetworkDB) clusterInit() error {
 	config.ProtocolVersion = memberlist.ProtocolVersionMax
 	config.Delegate = &delegate{nDB: nDB}
 	config.Events = &eventDelegate{nDB: nDB}
-	config.LogOutput = &logWriter{}
+	// custom logger that does not add time or date, so they are not
+	// duplicated by logrus
+	config.Logger = log.New(&logWriter{}, "", 0)
 
 	var err error
 	if len(nDB.config.Keys) > 0 {

+ 11 - 9
vendor/github.com/docker/libnetwork/networkdb/networkdb.go

@@ -211,10 +211,12 @@ func (nDB *NetworkDB) Peers(nid string) []PeerInfo {
 	defer nDB.RUnlock()
 	peers := make([]PeerInfo, 0, len(nDB.networkNodes[nid]))
 	for _, nodeName := range nDB.networkNodes[nid] {
-		peers = append(peers, PeerInfo{
-			Name: nDB.nodes[nodeName].Name,
-			IP:   nDB.nodes[nodeName].Addr.String(),
-		})
+		if node, ok := nDB.nodes[nodeName]; ok {
+			peers = append(peers, PeerInfo{
+				Name: node.Name,
+				IP:   node.Addr.String(),
+			})
+		}
 	}
 	return peers
 }
@@ -244,7 +246,7 @@ func (nDB *NetworkDB) getEntry(tname, nid, key string) (*entry, error) {
 
 // CreateEntry creates a table entry in NetworkDB for given (network,
 // table, key) tuple and if the NetworkDB is part of the cluster
-// propogates this event to the cluster. It is an error to create an
+// propagates this event to the cluster. It is an error to create an
 // entry for the same tuple for which there is already an existing
 // entry unless the current entry is deleting state.
 func (nDB *NetworkDB) CreateEntry(tname, nid, key string, value []byte) error {
@@ -279,7 +281,7 @@ func (nDB *NetworkDB) CreateEntry(tname, nid, key string, value []byte) error {
 
 // UpdateEntry updates a table entry in NetworkDB for given (network,
 // table, key) tuple and if the NetworkDB is part of the cluster
-// propogates this event to the cluster. It is an error to update a
+// propagates this event to the cluster. It is an error to update a
 // non-existent entry.
 func (nDB *NetworkDB) UpdateEntry(tname, nid, key string, value []byte) error {
 	if _, err := nDB.GetEntry(tname, nid, key); err != nil {
@@ -307,7 +309,7 @@ func (nDB *NetworkDB) UpdateEntry(tname, nid, key string, value []byte) error {
 
 // DeleteEntry deletes a table entry in NetworkDB for given (network,
 // table, key) tuple and if the NetworkDB is part of the cluster
-// propogates this event to the cluster.
+// propagates this event to the cluster.
 func (nDB *NetworkDB) DeleteEntry(tname, nid, key string) error {
 	value, err := nDB.GetEntry(tname, nid, key)
 	if err != nil {
@@ -408,7 +410,7 @@ func (nDB *NetworkDB) WalkTable(tname string, fn func(string, string, []byte) bo
 	return nil
 }
 
-// JoinNetwork joins this node to a given network and propogates this
+// JoinNetwork joins this node to a given network and propagates this
 // event across the cluster. This triggers this node joining the
 // sub-cluster of this network and participates in the network-scoped
 // gossip and bulk sync for this network.
@@ -447,7 +449,7 @@ func (nDB *NetworkDB) JoinNetwork(nid string) error {
 	return nil
 }
 
-// LeaveNetwork leaves this node from a given network and propogates
+// LeaveNetwork leaves this node from a given network and propagates
 // this event across the cluster. This triggers this node leaving the
 // sub-cluster of this network and as a result will no longer
 // participate in the network-scoped gossip and bulk sync for this

+ 1 - 1
vendor/github.com/docker/libnetwork/resolvconf/resolvconf.go

@@ -25,7 +25,7 @@ var (
 	// -- e.g. other link-local types -- either won't work in containers or are unnecessary.
 	// For readability and sufficiency for Docker purposes this seemed more reasonable than a
 	// 1000+ character regexp with exact and complete IPv6 validation
-	ipv6Address = `([0-9A-Fa-f]{0,4}:){2,7}([0-9A-Fa-f]{0,4})`
+	ipv6Address = `([0-9A-Fa-f]{0,4}:){2,7}([0-9A-Fa-f]{0,4})(%\w+)?`
 
 	localhostNSRegexp = regexp.MustCompile(`(?m)^nameserver\s+` + dns.IPLocalhost + `\s*\n*`)
 	nsIPv6Regexp      = regexp.MustCompile(`(?m)^nameserver\s+` + ipv6Address + `\s*\n*`)