1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

WIP - Code moves

Signed-off-by: Arnaud Porterie <arnaud.porterie@docker.com>
This commit is contained in:
Arnaud Porterie 2015-02-22 21:42:34 -08:00
parent 4a8b8498a7
commit 3125c1f7c7
3 changed files with 15 additions and 59 deletions

View file

@ -79,15 +79,3 @@ func Create(config *Configuration) (libnetwork.Network, error) {
return &bridgeNetwork{*config}, nil return &bridgeNetwork{*config}, nil
} }
type bridgeNetwork struct {
Config Configuration
}
func (b *bridgeNetwork) Type() string {
return NetworkType
}
func (b *bridgeNetwork) Link(name string) ([]*libnetwork.Interface, error) {
return nil, nil
}

View file

@ -0,0 +1,15 @@
package bridge
import "github.com/docker/libnetwork"
type bridgeNetwork struct {
Config Configuration
}
func (b *bridgeNetwork) Type() string {
return NetworkType
}
func (b *bridgeNetwork) Link(name string) ([]*libnetwork.Interface, error) {
return nil, nil
}

View file

@ -1,47 +0,0 @@
package bridge
/*
func electBridgeNetwork(config *Configuration) (*net.IPNet, error) {
// Is a bridge IP is provided as part of the configuration, we only check
// its validity.
if config.AddressIPv4 != "" {
ip, network, err := net.ParseCIDR(config.AddressIPv4)
if err != nil {
return nil, err
}
network.IP = ip
return network, nil
}
// No bridge IP was specified: we have to elect one ourselves from a set of
// predetermined networks.
for _, n := range bridgeNetworks {
// TODO CheckNameserverOverlaps
// TODO CheckRouteOverlaps
return n, nil
}
return nil, fmt.Errorf("Couldn't find an address range for interface %q", config.BridgeName)
}
func createBridgeInterface(name string) (netlink.Link, error) {
link := &netlink.Bridge{
LinkAttrs: netlink.LinkAttrs{
Name: name,
},
}
// Only set the bridge's MAC address if the kernel version is > 3.3, as it
// was not supported before that.
kv, err := kernel.GetKernelVersion()
if err == nil && (kv.Kernel >= 3 && kv.Major >= 3) {
link.Attrs().HardwareAddr = generateRandomMAC()
log.Debugf("Setting bridge mac address to %s", link.Attrs().HardwareAddr)
}
if err := netlink.LinkAdd(link); err != nil {
return nil, err
}
return netlink.LinkByName(name)
}
*/