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

Merge pull request #639 from mavenugo/dgw

Made use of map[string]string for nw options in default-gateway impl
This commit is contained in:
Jana Radhakrishnan 2015-10-12 15:42:24 -07:00
commit f5ae8ec50f
4 changed files with 43 additions and 20 deletions

View file

@ -4,7 +4,6 @@ import (
"fmt"
"github.com/docker/libnetwork/netlabel"
"github.com/docker/libnetwork/options"
"github.com/docker/libnetwork/types"
)
@ -92,25 +91,6 @@ func (sb *sandbox) clearDefaultGW() error {
return nil
}
func (c *controller) createGWNetwork() (Network, error) {
netOption := options.Generic{
"BridgeName": libnGWNetwork,
"EnableICC": false,
"EnableIPMasquerade": true,
}
n, err := c.NewNetwork("bridge", libnGWNetwork,
NetworkOptionGeneric(options.Generic{
netlabel.GenericData: netOption,
netlabel.EnableIPv6: false,
}))
if err != nil {
return nil, fmt.Errorf("error creating external connectivity network: %v", err)
}
return n, err
}
func (sb *sandbox) needDefaultGW() bool {
var needGW bool

View file

@ -0,0 +1,7 @@
package libnetwork
import "github.com/docker/libnetwork/types"
func (c *controller) createGWNetwork() (Network, error) {
return nil, types.NotImplementedErrorf("default gateway functionality is not implemented in freebsd")
}

View file

@ -0,0 +1,29 @@
package libnetwork
import (
"fmt"
"strconv"
"github.com/docker/libnetwork/drivers/bridge"
"github.com/docker/libnetwork/netlabel"
"github.com/docker/libnetwork/options"
)
func (c *controller) createGWNetwork() (Network, error) {
netOption := map[string]string{
bridge.BridgeName: libnGWNetwork,
bridge.EnableICC: strconv.FormatBool(false),
bridge.EnableIPMasquerade: strconv.FormatBool(true),
}
n, err := c.NewNetwork("bridge", libnGWNetwork,
NetworkOptionGeneric(options.Generic{
netlabel.GenericData: netOption,
netlabel.EnableIPv6: false,
}))
if err != nil {
return nil, fmt.Errorf("error creating external connectivity network: %v", err)
}
return n, err
}

View file

@ -0,0 +1,7 @@
package libnetwork
import "github.com/docker/libnetwork/types"
func (c *controller) createGWNetwork() (Network, error) {
return nil, types.NotImplementedErrorf("default gateway functionality is not implemented in windows")
}