New way of initializing; remove --iface option
This commit is contained in:
1 parent
abadbf883a
commit
a26fc67ded
2 files changed
+11
-15
No files matched your search
+10
-15
@@ -129,7 +129,6 @@ func main() {
|
|||||||
networkConfig weave.NetworkConfig
|
networkConfig weave.NetworkConfig
|
||||||
protocolMinVersion int
|
protocolMinVersion int
|
||||||
resume bool
|
resume bool
|
||||||
ifaceName string
|
|
||||||
routerName string
|
routerName string
|
||||||
nickName string
|
nickName string
|
||||||
password string
|
password string
|
||||||
@@ -145,7 +144,6 @@ func main() {
|
|||||||
peers []string
|
peers []string
|
||||||
noDNS bool
|
noDNS bool
|
||||||
dnsConfig dnsConfig
|
dnsConfig dnsConfig
|
||||||
datapathName string
|
|
||||||
trustedSubnetStr string
|
trustedSubnetStr string
|
||||||
dbPrefix string
|
dbPrefix string
|
||||||
discoveryEndpoint string
|
discoveryEndpoint string
|
||||||
@@ -168,7 +166,6 @@ func main() {
|
|||||||
mflag.IntVar(&config.Port, []string{"#port", "-port"}, mesh.Port, "router port")
|
mflag.IntVar(&config.Port, []string{"#port", "-port"}, mesh.Port, "router port")
|
||||||
mflag.IntVar(&protocolMinVersion, []string{"-min-protocol-version"}, mesh.ProtocolMinVersion, "minimum weave protocol version")
|
mflag.IntVar(&protocolMinVersion, []string{"-min-protocol-version"}, mesh.ProtocolMinVersion, "minimum weave protocol version")
|
||||||
mflag.BoolVar(&resume, []string{"-resume"}, false, "resume connections to previous peers")
|
mflag.BoolVar(&resume, []string{"-resume"}, false, "resume connections to previous peers")
|
||||||
mflag.StringVar(&ifaceName, []string{"#iface", "-iface"}, "", "name of interface to capture/inject from (disabled if blank)")
|
|
||||||
mflag.StringVar(&bridgeConfig.WeaveBridgeName, []string{"-weave-bridge"}, "weave", "name of weave bridge")
|
mflag.StringVar(&bridgeConfig.WeaveBridgeName, []string{"-weave-bridge"}, "weave", "name of weave bridge")
|
||||||
mflag.StringVar(&bridgeConfig.DockerBridgeName, []string{"-docker-bridge"}, "", "name of Docker bridge")
|
mflag.StringVar(&bridgeConfig.DockerBridgeName, []string{"-docker-bridge"}, "", "name of Docker bridge")
|
||||||
mflag.StringVar(&routerName, []string{"#name", "-name"}, "", "name of router (defaults to MAC of interface)")
|
mflag.StringVar(&routerName, []string{"#name", "-name"}, "", "name of router (defaults to MAC of interface)")
|
||||||
@@ -195,7 +192,8 @@ func main() {
|
|||||||
mflag.DurationVar(&dnsConfig.ClientTimeout, []string{"-dns-fallback-timeout"}, nameserver.DefaultClientTimeout, "timeout for fallback DNS requests")
|
mflag.DurationVar(&dnsConfig.ClientTimeout, []string{"-dns-fallback-timeout"}, nameserver.DefaultClientTimeout, "timeout for fallback DNS requests")
|
||||||
mflag.StringVar(&dnsConfig.EffectiveListenAddress, []string{"-dns-effective-listen-address"}, "", "address DNS will actually be listening, after Docker port mapping")
|
mflag.StringVar(&dnsConfig.EffectiveListenAddress, []string{"-dns-effective-listen-address"}, "", "address DNS will actually be listening, after Docker port mapping")
|
||||||
mflag.StringVar(&dnsConfig.ResolvConf, []string{"-resolv-conf"}, "", "path to resolver configuration for fallback DNS lookups")
|
mflag.StringVar(&dnsConfig.ResolvConf, []string{"-resolv-conf"}, "", "path to resolver configuration for fallback DNS lookups")
|
||||||
mflag.StringVar(&datapathName, []string{"-datapath"}, "", "ODP datapath name")
|
mflag.StringVar(&bridgeConfig.DatapathName, []string{"-datapath"}, "", "ODP datapath name")
|
||||||
|
mflag.BoolVar(&bridgeConfig.NoFastdp, []string{"-no-fastdp"}, false, "Disable Fast Datapath")
|
||||||
mflag.StringVar(&trustedSubnetStr, []string{"-trusted-subnets"}, "", "comma-separated list of trusted subnets in CIDR notation")
|
mflag.StringVar(&trustedSubnetStr, []string{"-trusted-subnets"}, "", "comma-separated list of trusted subnets in CIDR notation")
|
||||||
mflag.StringVar(&dbPrefix, []string{"-db-prefix"}, "/weavedb/weave", "pathname/prefix of filename to store data")
|
mflag.StringVar(&dbPrefix, []string{"-db-prefix"}, "/weavedb/weave", "pathname/prefix of filename to store data")
|
||||||
mflag.BoolVar(&bridgeConfig.IsAWSVPC, []string{"-awsvpc"}, false, "use AWS VPC for routing")
|
mflag.BoolVar(&bridgeConfig.IsAWSVPC, []string{"-awsvpc"}, false, "use AWS VPC for routing")
|
||||||
@@ -247,7 +245,6 @@ func main() {
|
|||||||
networkConfig.PacketLogging = nopPacketLogging{}
|
networkConfig.PacketLogging = nopPacketLogging{}
|
||||||
}
|
}
|
||||||
|
|
||||||
bridgeConfig.DatapathName = datapathName
|
|
||||||
if bridgeConfig.DockerBridgeName != "" {
|
if bridgeConfig.DockerBridgeName != "" {
|
||||||
if err := weavenet.EnforceAddrAssignType(bridgeConfig.DockerBridgeName); err != nil {
|
if err := weavenet.EnforceAddrAssignType(bridgeConfig.DockerBridgeName); err != nil {
|
||||||
Log.Errorf("While checking address assignment type of %s: %s", bridgeConfig.DockerBridgeName, err)
|
Log.Errorf("While checking address assignment type of %s: %s", bridgeConfig.DockerBridgeName, err)
|
||||||
@@ -259,7 +256,7 @@ func main() {
|
|||||||
|
|
||||||
config.Password = determinePassword(password)
|
config.Password = determinePassword(password)
|
||||||
|
|
||||||
overlay, bridge := createOverlay(datapathName, ifaceName, bridgeConfig, config.Host, config.Port, bufSzMB, config.Password != nil)
|
overlay, bridge := createOverlay(bridgeType, bridgeConfig, config.Host, config.Port, bufSzMB, config.Password != nil)
|
||||||
networkConfig.Bridge = bridge
|
networkConfig.Bridge = bridge
|
||||||
|
|
||||||
if bridge != nil {
|
if bridge != nil {
|
||||||
@@ -466,29 +463,27 @@ func (nopPacketLogging) LogPacket(string, weave.PacketKey) {
|
|||||||
func (nopPacketLogging) LogForwardPacket(string, weave.ForwardPacketKey) {
|
func (nopPacketLogging) LogForwardPacket(string, weave.ForwardPacketKey) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func createOverlay(datapathName string, ifaceName string, config weavenet.BridgeConfig, host string, port int, bufSzMB int, enableEncryption bool) (weave.NetworkOverlay, weave.Bridge) {
|
func createOverlay(bridgeType weavenet.BridgeType, config weavenet.BridgeConfig, host string, port int, bufSzMB int, enableEncryption bool) (weave.NetworkOverlay, weave.Bridge) {
|
||||||
overlay := weave.NewOverlaySwitch()
|
overlay := weave.NewOverlaySwitch()
|
||||||
var bridge weave.Bridge
|
var bridge weave.Bridge
|
||||||
var ignoreSleeve bool
|
var ignoreSleeve bool
|
||||||
|
|
||||||
switch {
|
switch bridgeType {
|
||||||
case config.IsAWSVPC:
|
case weavenet.AWSVPC:
|
||||||
vpc := weave.NewAWSVPC()
|
vpc := weave.NewAWSVPC()
|
||||||
overlay.Add("awsvpc", vpc)
|
overlay.Add("awsvpc", vpc)
|
||||||
bridge = weave.NullBridge{}
|
bridge = weave.NullBridge{}
|
||||||
// Currently, we do not support any overlay with AWSVPC
|
// Currently, we do not support any overlay with AWSVPC
|
||||||
ignoreSleeve = true
|
ignoreSleeve = true
|
||||||
case datapathName != "" && ifaceName != "":
|
case weavenet.Fastdp, weavenet.BridgedFastdp:
|
||||||
Log.Fatal("At most one of --datapath and --iface must be specified.")
|
iface, err := weavenet.EnsureInterface(config.DatapathName)
|
||||||
case datapathName != "":
|
|
||||||
iface, err := weavenet.EnsureInterface(datapathName)
|
|
||||||
checkFatal(err)
|
checkFatal(err)
|
||||||
fastdp, err := weave.NewFastDatapath(iface, port, enableEncryption)
|
fastdp, err := weave.NewFastDatapath(iface, port, enableEncryption)
|
||||||
checkFatal(err)
|
checkFatal(err)
|
||||||
bridge = fastdp.Bridge()
|
bridge = fastdp.Bridge()
|
||||||
overlay.Add("fastdp", fastdp.Overlay())
|
overlay.Add("fastdp", fastdp.Overlay())
|
||||||
case ifaceName != "":
|
case weavenet.Bridge:
|
||||||
iface, err := weavenet.EnsureInterface(ifaceName)
|
iface, err := weavenet.EnsureInterface(weavenet.PcapIfaceName)
|
||||||
checkFatal(err)
|
checkFatal(err)
|
||||||
bridge, err = weave.NewPcap(iface, bufSzMB*1024*1024) // bufsz flag is in MB
|
bridge, err = weave.NewPcap(iface, bufSzMB*1024*1024) // bufsz flag is in MB
|
||||||
checkFatal(err)
|
checkFatal(err)
|
||||||
|
|||||||
@@ -578,6 +578,7 @@ configure_veth_attached_bridge() {
|
|||||||
router_bridge_opts() {
|
router_bridge_opts() {
|
||||||
echo --docker-bridge "$DOCKER_BRIDGE" --weave-bridge "$BRIDGE" --datapath "$DATAPATH"
|
echo --docker-bridge "$DOCKER_BRIDGE" --weave-bridge "$BRIDGE" --datapath "$DATAPATH"
|
||||||
[ -z "$WEAVE_MTU" ] || echo --mtu "$WEAVE_MTU"
|
[ -z "$WEAVE_MTU" ] || echo --mtu "$WEAVE_MTU"
|
||||||
|
[ -z $WEAVE_NO_FASTDP ] || echo --no-fastdp
|
||||||
}
|
}
|
||||||
|
|
||||||
ask_version() {
|
ask_version() {
|
||||||
|
|||||||
Reference in new issue
Block a user