Don't assume we always run in in host pid space
Pass the path to the proc filesystem down
This commit is contained in:
1 parent
c8e0c12d34
commit
f05bb6c4e0
7 files changed
+29
-22
No files matched your search
@@ -17,8 +17,8 @@ func detectBridgeType(args []string) error {
|
||||
}
|
||||
|
||||
func createBridge(args []string) error {
|
||||
if len(args) != 9 {
|
||||
cmdUsage("create-bridge", "<docker-bridge-name> <weave-bridge-name> <datapath-name> <mtu> <port> <mac> <no-fastdp> <no-bridged-fastdp> <expect-npc>")
|
||||
if len(args) != 10 {
|
||||
cmdUsage("create-bridge", "<docker-bridge-name> <weave-bridge-name> <datapath-name> <mtu> <port> <mac> <no-fastdp> <no-bridged-fastdp> <proc-path> <expect-npc>")
|
||||
}
|
||||
|
||||
mtu, err := strconv.Atoi(args[3])
|
||||
@@ -38,9 +38,10 @@ func createBridge(args []string) error {
|
||||
Mac: args[5],
|
||||
NoFastdp: args[6] != "",
|
||||
NoBridgedFastdp: args[7] != "",
|
||||
ExpectNPC: args[8] == "--expect-npc",
|
||||
ExpectNPC: args[9] == "--expect-npc",
|
||||
}
|
||||
bridgeType, err := weavenet.CreateBridge(&config)
|
||||
procPath := args[8]
|
||||
bridgeType, err := weavenet.CreateBridge(procPath, &config)
|
||||
fmt.Println(bridgeType.String())
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -60,7 +60,8 @@ func setupIface(args []string) error {
|
||||
if err := netlink.LinkSetName(link, newIfName); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := weavenet.ConfigureARPCache(newIfName); err != nil {
|
||||
// This is only called by AttachContainer which is only called in host pid namespace
|
||||
if err := weavenet.ConfigureARPCache("/proc", newIfName); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := ipt.Append("filter", "INPUT", "-i", newIfName, "-d", "224.0.0.0/4", "-j", "DROP"); err != nil {
|
||||
@@ -71,10 +72,11 @@ func setupIface(args []string) error {
|
||||
}
|
||||
|
||||
func configureARP(args []string) error {
|
||||
if len(args) != 1 {
|
||||
cmdUsage("configure-arp", "<iface-name-prefix>")
|
||||
if len(args) != 2 {
|
||||
cmdUsage("configure-arp", "<iface-name-prefix> <root-path>")
|
||||
}
|
||||
prefix := args[0]
|
||||
rootPath := args[1]
|
||||
|
||||
links, err := netlink.LinkList()
|
||||
if err != nil {
|
||||
@@ -83,7 +85,7 @@ func configureARP(args []string) error {
|
||||
for _, link := range links {
|
||||
ifName := link.Attrs().Name
|
||||
if strings.HasPrefix(ifName, prefix) {
|
||||
weavenet.ConfigureARPCache(ifName)
|
||||
weavenet.ConfigureARPCache(rootPath+"/proc", ifName)
|
||||
if addrs, err := netlink.AddrList(link, netlink.FAMILY_V4); err == nil {
|
||||
for _, addr := range addrs {
|
||||
arping.GratuitousArpOverIfaceByName(addr.IPNet.IP, ifName)
|
||||
|
||||
Reference in new issue
Block a user