aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/csource/linux_common.go
diff options
context:
space:
mode:
authorHangbin Liu <liuhangbin@gmail.com>2018-04-11 12:16:55 +0800
committerDmitry Vyukov <dvyukov@google.com>2018-04-11 11:18:45 +0200
commita9b12a986c738062490d64b40e7bb05ffe785720 (patch)
tree7df0874448fa2579a298f5a78f9b09d0d0057137 /pkg/csource/linux_common.go
parent8b8de4271424f3341b8a4c78e7d1856ba05a8632 (diff)
executor: add salve interface for bond0/team0
Add a veth pair with name bond/team_slave and set their master to bond0/team0. Remove veth from devtypes because the cmd `ip link add veth0 type veth` will actually failed with "RTNETLINK answers: File exists" and no veth interface created. When create veth device, kernel will create a pair of veth, so no need to create them one by one. Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
Diffstat (limited to 'pkg/csource/linux_common.go')
-rw-r--r--pkg/csource/linux_common.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/pkg/csource/linux_common.go b/pkg/csource/linux_common.go
index 84cfa9aa2..a28bc8baa 100644
--- a/pkg/csource/linux_common.go
+++ b/pkg/csource/linux_common.go
@@ -548,7 +548,7 @@ static void initialize_tun(void)
static void initialize_netdevices(void)
{
unsigned i;
- const char* devtypes[] = {"ip6gretap", "bridge", "vcan", "bond", "veth", "team"};
+ const char* devtypes[] = {"ip6gretap", "bridge", "vcan", "bond", "team"};
const char* devnames[] = {"lo", "sit0", "bridge0", "vcan0", "tunl0",
"gre0", "gretap0", "ip_vti0", "ip6_vti0",
"ip6tnl0", "ip6gre0", "ip6gretap0",
@@ -560,7 +560,7 @@ static void initialize_netdevices(void)
#endif
for (i = 0; i < sizeof(devtypes) / (sizeof(devtypes[0])); i++)
execute_command(0, "ip link add dev %s0 type %s", devtypes[i], devtypes[i]);
- execute_command(0, "ip link add dev veth1 type veth");
+ execute_command(0, "ip link add type veth");
for (i = 0; i < sizeof(devnames) / (sizeof(devnames[0])); i++) {
char addr[32];
snprintf_check(addr, sizeof(addr), DEV_IPV4, i + 10);
@@ -571,6 +571,10 @@ static void initialize_netdevices(void)
execute_command(0, "ip link set dev %s address %s", devnames[i], addr);
execute_command(0, "ip link set dev %s up", devnames[i]);
}
+
+ execute_command(0, "ip link add name bond_slave type veth peer name team_slave");
+ execute_command(0, "ip link set bond_slave master bond0");
+ execute_command(0, "ip link set team_slave master team0");
}
#endif