@@ -28,6 +28,7 @@
#define ADDR6_3 "dead:beef:3::1"
#define ADDR6_4 "dead:beef:4::1"
#define PORT_1 10001
+#define PM_CTL "./mptcp_pm_nl_ctl"
#define WITH_DATA true
#define WITHOUT_DATA false
@@ -381,13 +382,18 @@ static int address_init(void)
return -1;
}
-static int endpoint_add(char *addr, char *flags)
+static int endpoint_add(char *addr, char *flags, bool ip_mptcp)
{
- return SYS_NOFAIL("ip -net %s mptcp endpoint add %s %s", NS_TEST, addr, flags);
+ if (ip_mptcp)
+ return SYS_NOFAIL("ip -net %s mptcp endpoint add %s %s",
+ NS_TEST, addr, flags);
+ return SYS_NOFAIL("ip netns exec %s %s add %s flags %s",
+ NS_TEST, PM_CTL, addr, flags);
}
static int endpoint_init(char *flags, u8 endpoints)
{
+ bool ip_mptcp = true;
int ret = -1;
if (!endpoints || endpoints > 4)
@@ -398,17 +404,16 @@ static int endpoint_init(char *flags, u8 endpoints)
if (SYS_NOFAIL("ip -net %s mptcp limits set add_addr_accepted 4 subflows 4",
NS_TEST)) {
- printf("'ip mptcp' not supported, skip this test.\n");
- test__skip();
- goto fail;
+ SYS(fail, "ip netns exec %s %s limits 4 4", NS_TEST, PM_CTL);
+ ip_mptcp = false;
}
if (endpoints > 1)
- ret = endpoint_add(ADDR_2, flags);
+ ret = endpoint_add(ADDR_2, flags, ip_mptcp);
if (endpoints > 2)
- ret = ret ?: endpoint_add(ADDR_3, flags);
+ ret = ret ?: endpoint_add(ADDR_3, flags, ip_mptcp);
if (endpoints > 3)
- ret = ret ?: endpoint_add(ADDR_4, flags);
+ ret = ret ?: endpoint_add(ADDR_4, flags, ip_mptcp);
fail:
return ret;