Commit 3aeaaa59 authored by Matthieu Baerts's avatar Matthieu Baerts Committed by David S. Miller

selftests:mptcp: fix failure due to whitespace damage

'pm_nl_ctl' was adding a trailing whitespace after having printed the
IP. But at the end, the IP element is currently always the last one.

The bash script launching 'pm_nl_ctl' had trailing whitespaces in the
expected result on purpose. But these whitespaces have been removed when
the patch has been applied upstream. To avoid trailing whitespaces in
the bash code, 'pm_nl_ctl' and expected results have now been adapted.

The MPTCP PM selftest can now pass again.

Fixes: eedbc685 (selftests: add PM netlink functional tests)
Signed-off-by: default avatarMatthieu Baerts <matthieu.baerts@tessares.net>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 76dcbd23
...@@ -75,29 +75,29 @@ subflows 0" "defaults limits" ...@@ -75,29 +75,29 @@ subflows 0" "defaults limits"
ip netns exec $ns1 ./pm_nl_ctl add 10.0.1.1 ip netns exec $ns1 ./pm_nl_ctl add 10.0.1.1
ip netns exec $ns1 ./pm_nl_ctl add 10.0.1.2 flags subflow dev lo ip netns exec $ns1 ./pm_nl_ctl add 10.0.1.2 flags subflow dev lo
ip netns exec $ns1 ./pm_nl_ctl add 10.0.1.3 flags signal,backup ip netns exec $ns1 ./pm_nl_ctl add 10.0.1.3 flags signal,backup
check "ip netns exec $ns1 ./pm_nl_ctl get 1" "id 1 flags 10.0.1.1 " "simple add/get addr" check "ip netns exec $ns1 ./pm_nl_ctl get 1" "id 1 flags 10.0.1.1" "simple add/get addr"
check "ip netns exec $ns1 ./pm_nl_ctl dump" \ check "ip netns exec $ns1 ./pm_nl_ctl dump" \
"id 1 flags 10.0.1.1 "id 1 flags 10.0.1.1
id 2 flags subflow dev lo 10.0.1.2 id 2 flags subflow dev lo 10.0.1.2
id 3 flags signal,backup 10.0.1.3 " "dump addrs" id 3 flags signal,backup 10.0.1.3" "dump addrs"
ip netns exec $ns1 ./pm_nl_ctl del 2 ip netns exec $ns1 ./pm_nl_ctl del 2
check "ip netns exec $ns1 ./pm_nl_ctl get 2" "" "simple del addr" check "ip netns exec $ns1 ./pm_nl_ctl get 2" "" "simple del addr"
check "ip netns exec $ns1 ./pm_nl_ctl dump" \ check "ip netns exec $ns1 ./pm_nl_ctl dump" \
"id 1 flags 10.0.1.1 "id 1 flags 10.0.1.1
id 3 flags signal,backup 10.0.1.3 " "dump addrs after del" id 3 flags signal,backup 10.0.1.3" "dump addrs after del"
ip netns exec $ns1 ./pm_nl_ctl add 10.0.1.3 ip netns exec $ns1 ./pm_nl_ctl add 10.0.1.3
check "ip netns exec $ns1 ./pm_nl_ctl get 4" "" "duplicate addr" check "ip netns exec $ns1 ./pm_nl_ctl get 4" "" "duplicate addr"
ip netns exec $ns1 ./pm_nl_ctl add 10.0.1.4 id 10 flags signal ip netns exec $ns1 ./pm_nl_ctl add 10.0.1.4 id 10 flags signal
check "ip netns exec $ns1 ./pm_nl_ctl get 4" "id 4 flags signal 10.0.1.4 " "id addr increment" check "ip netns exec $ns1 ./pm_nl_ctl get 4" "id 4 flags signal 10.0.1.4" "id addr increment"
for i in `seq 5 9`; do for i in `seq 5 9`; do
ip netns exec $ns1 ./pm_nl_ctl add 10.0.1.$i flags signal >/dev/null 2>&1 ip netns exec $ns1 ./pm_nl_ctl add 10.0.1.$i flags signal >/dev/null 2>&1
done done
check "ip netns exec $ns1 ./pm_nl_ctl get 9" "id 9 flags signal 10.0.1.9 " "hard addr limit" check "ip netns exec $ns1 ./pm_nl_ctl get 9" "id 9 flags signal 10.0.1.9" "hard addr limit"
check "ip netns exec $ns1 ./pm_nl_ctl get 10" "" "above hard addr limit" check "ip netns exec $ns1 ./pm_nl_ctl get 10" "" "above hard addr limit"
for i in `seq 9 256`; do for i in `seq 9 256`; do
...@@ -110,7 +110,7 @@ id 4 flags signal 10.0.1.4 ...@@ -110,7 +110,7 @@ id 4 flags signal 10.0.1.4
id 5 flags signal 10.0.1.5 id 5 flags signal 10.0.1.5
id 6 flags signal 10.0.1.6 id 6 flags signal 10.0.1.6
id 7 flags signal 10.0.1.7 id 7 flags signal 10.0.1.7
id 8 flags signal 10.0.1.8 " "id limit" id 8 flags signal 10.0.1.8" "id limit"
ip netns exec $ns1 ./pm_nl_ctl flush ip netns exec $ns1 ./pm_nl_ctl flush
check "ip netns exec $ns1 ./pm_nl_ctl dump" "" "flush addrs" check "ip netns exec $ns1 ./pm_nl_ctl dump" "" "flush addrs"
......
...@@ -335,14 +335,14 @@ static void print_addr(struct rtattr *attrs, int len) ...@@ -335,14 +335,14 @@ static void print_addr(struct rtattr *attrs, int len)
error(1, errno, "wrong IP (v4) for family %d", error(1, errno, "wrong IP (v4) for family %d",
family); family);
inet_ntop(AF_INET, RTA_DATA(attrs), str, sizeof(str)); inet_ntop(AF_INET, RTA_DATA(attrs), str, sizeof(str));
printf("%s ", str); printf("%s", str);
} }
if (attrs->rta_type == MPTCP_PM_ADDR_ATTR_ADDR6) { if (attrs->rta_type == MPTCP_PM_ADDR_ATTR_ADDR6) {
if (family != AF_INET6) if (family != AF_INET6)
error(1, errno, "wrong IP (v6) for family %d", error(1, errno, "wrong IP (v6) for family %d",
family); family);
inet_ntop(AF_INET6, RTA_DATA(attrs), str, sizeof(str)); inet_ntop(AF_INET6, RTA_DATA(attrs), str, sizeof(str));
printf("%s ", str); printf("%s", str);
} }
if (attrs->rta_type == MPTCP_PM_ADDR_ATTR_ID) { if (attrs->rta_type == MPTCP_PM_ADDR_ATTR_ID) {
memcpy(&id, RTA_DATA(attrs), 1); memcpy(&id, RTA_DATA(attrs), 1);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment